diff --git a/PolyShim.Tests/Net70/StreamTests.cs b/PolyShim.Tests/Net70/StreamTests.cs index b005906..516aa47 100644 --- a/PolyShim.Tests/Net70/StreamTests.cs +++ b/PolyShim.Tests/Net70/StreamTests.cs @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -110,7 +110,7 @@ await Assert.ThrowsAnyAsync( 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 @@ -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 @@ -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 @@ -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.Shared.Rent(3); try @@ -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.Shared.Rent(10); // Act & assert @@ -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.Shared.Rent(10); try @@ -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.Shared.Rent(3); try @@ -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.Shared.Rent(3); // Act @@ -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.Shared.Rent(10); // Act & assert @@ -264,7 +264,7 @@ await Assert.ThrowsAnyAsync( 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.Shared.Rent(10); // Act @@ -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.Shared.Rent(3); // Act diff --git a/PolyShim.Tests/NetCore10/StreamTests.cs b/PolyShim.Tests/NetCore10/StreamTests.cs index e6f849a..d2b48ff 100644 --- a/PolyShim.Tests/NetCore10/StreamTests.cs +++ b/PolyShim.Tests/NetCore10/StreamTests.cs @@ -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 diff --git a/PolyShim.Tests/NetCore21/StreamTests.cs b/PolyShim.Tests/NetCore21/StreamTests.cs index d0ee922..746ca5e 100644 --- a/PolyShim.Tests/NetCore21/StreamTests.cs +++ b/PolyShim.Tests/NetCore21/StreamTests.cs @@ -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 @@ -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 @@ -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 @@ -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.Shared.Rent((int)stream.Length); try @@ -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.Shared.Rent((int)stream.Length); // Act diff --git a/PolyShim/Net70/StringSyntaxAttribute.cs b/PolyShim/Net70/StringSyntaxAttribute.cs index bcb94bc..39230cc 100644 --- a/PolyShim/Net70/StringSyntaxAttribute.cs +++ b/PolyShim/Net70/StringSyntaxAttribute.cs @@ -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 diff --git a/PolyShim/NetCore10/AggregateException.cs b/PolyShim/NetCore10/AggregateException.cs index d75a691..809ef40 100644 --- a/PolyShim/NetCore10/AggregateException.cs +++ b/PolyShim/NetCore10/AggregateException.cs @@ -39,10 +39,10 @@ public AggregateException(IEnumerable 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) { }