Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Sep 2, 2024
1 parent 2cf975c commit 5c2a6ae
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
36 changes: 18 additions & 18 deletions PolyShim.Tests/Net70/StreamTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class StreamTests
public void ReadAtLeast_Array_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[3];

// Act
Expand All @@ -28,7 +28,7 @@ public void ReadAtLeast_Array_Test()
public void ReadAtLeast_Array_Overflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[10];

// Act & assert
Expand All @@ -39,7 +39,7 @@ public void ReadAtLeast_Array_Overflow_Test()
public void ReadAtLeast_Array_SilentOverflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[10];

// Act
Expand All @@ -54,7 +54,7 @@ public void ReadAtLeast_Array_SilentOverflow_Test()
public void ReadExactly_Array_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[3];

// Act
Expand All @@ -68,7 +68,7 @@ public void ReadExactly_Array_Test()
public void ReadExactly_Array_OffsetAndCount_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[3];

// Act
Expand All @@ -82,7 +82,7 @@ public void ReadExactly_Array_OffsetAndCount_Test()
public async Task ReadAtLeastAsync_Array_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[3];

// Act
Expand All @@ -97,7 +97,7 @@ public async Task ReadAtLeastAsync_Array_Test()
public async Task ReadAtLeastAsync_Array_Overflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[10];

// Act & assert
Expand All @@ -110,7 +110,7 @@ await Assert.ThrowsAnyAsync<EndOfStreamException>(
public async Task ReadAtLeastAsync_Array_SilentOverflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[10];

// Act
Expand All @@ -125,7 +125,7 @@ public async Task ReadAtLeastAsync_Array_SilentOverflow_Test()
public async Task ReadExactlyAsync_Array_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[3];

// Act
Expand All @@ -139,7 +139,7 @@ public async Task ReadExactlyAsync_Array_Test()
public async Task ReadExactlyAsync_Array_OffsetAndCount_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[3];

// Act
Expand All @@ -153,7 +153,7 @@ public async Task ReadExactlyAsync_Array_OffsetAndCount_Test()
public void ReadAtLeast_Span_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = ArrayPool<byte>.Shared.Rent(3);

try
Expand All @@ -175,7 +175,7 @@ public void ReadAtLeast_Span_Test()
public void ReadAtLeast_Span_Overflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = ArrayPool<byte>.Shared.Rent(10);

// Act & assert
Expand All @@ -193,7 +193,7 @@ public void ReadAtLeast_Span_Overflow_Test()
public void ReadAtLeast_Span_SilentOverflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = ArrayPool<byte>.Shared.Rent(10);

try
Expand All @@ -215,7 +215,7 @@ public void ReadAtLeast_Span_SilentOverflow_Test()
public void ReadExactly_Span_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = ArrayPool<byte>.Shared.Rent(3);

try
Expand All @@ -236,7 +236,7 @@ public void ReadExactly_Span_Test()
public async Task ReadAtLeastAsync_Memory_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
using var buffer = MemoryPool<byte>.Shared.Rent(3);

// Act
Expand All @@ -251,7 +251,7 @@ public async Task ReadAtLeastAsync_Memory_Test()
public async Task ReadAtLeastAsync_Memory_Overflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
using var buffer = MemoryPool<byte>.Shared.Rent(10);

// Act & assert
Expand All @@ -264,7 +264,7 @@ await Assert.ThrowsAnyAsync<EndOfStreamException>(
public async Task ReadAtLeastAsync_Memory_SilentOverflow_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
using var buffer = MemoryPool<byte>.Shared.Rent(10);

// Act
Expand All @@ -279,7 +279,7 @@ public async Task ReadAtLeastAsync_Memory_SilentOverflow_Test()
public async Task ReadExactlyAsync_Memory_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
using var buffer = MemoryPool<byte>.Shared.Rent(3);

// Act
Expand Down
2 changes: 1 addition & 1 deletion PolyShim.Tests/NetCore10/StreamTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class StreamTests
public void CopyTo_Test()
{
// Arrange
using var source = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var source = new MemoryStream([1, 2, 3, 4, 5]);
using var destination = new MemoryStream();

// Act
Expand Down
10 changes: 5 additions & 5 deletions PolyShim.Tests/NetCore21/StreamTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class StreamTests
public void Read_Array_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[5];

// Act
Expand Down Expand Up @@ -42,7 +42,7 @@ public void Write_Array_Test()
public async Task CopyToAsync_Test()
{
// Arrange
using var source = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var source = new MemoryStream([1, 2, 3, 4, 5]);
using var destination = new MemoryStream();

// Act
Expand All @@ -56,7 +56,7 @@ public async Task CopyToAsync_Test()
public async Task ReadAsync_Array_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = new byte[stream.Length];

// Act
Expand Down Expand Up @@ -85,7 +85,7 @@ public async Task WriteAsync_Array_Test()
public void Read_Span_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
var buffer = ArrayPool<byte>.Shared.Rent((int)stream.Length);

try
Expand Down Expand Up @@ -134,7 +134,7 @@ public void Write_Span_Test()
public async Task ReadAsync_Memory_Test()
{
// Arrange
using var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
using var stream = new MemoryStream([1, 2, 3, 4, 5]);
using var buffer = MemoryPool<byte>.Shared.Rent((int)stream.Length);

// Act
Expand Down
2 changes: 1 addition & 1 deletion PolyShim/Net70/StringSyntaxAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public StringSyntaxAttribute(string syntax, params object?[] arguments)
}

public StringSyntaxAttribute(string syntax)
: this(syntax, new object[0]) { }
: this(syntax, []) { }
}

internal partial class StringSyntaxAttribute
Expand Down
4 changes: 2 additions & 2 deletions PolyShim/NetCore10/AggregateException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public AggregateException(IEnumerable<Exception> innerExceptions)
: this("One or more errors occurred.", innerExceptions) { }

public AggregateException(string? message)
: this(message, new Exception[0]) { }
: this(message, []) { }

public AggregateException()
: this("One or more errors occurred.", new Exception[0]) { }
: this("One or more errors occurred.", []) { }

public AggregateException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
Expand Down

0 comments on commit 5c2a6ae

Please sign in to comment.