diff --git a/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs b/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs index f6a9834cf44691..8395a64a98de95 100644 --- a/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs +++ b/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs @@ -55,14 +55,13 @@ public void BufferSize() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] [OuterLoop] - [InlineData(int.MaxValue / 2 + 1)] - public void WriteFromByte_InputSizeLargerThanHalfOfMaxInt_ShouldSuccess(int inputSize) + public void WriteFromByte_InputSizeLargerThanHalfOfMaxInt_ShouldSuccess() { + const int InputSize = int.MaxValue / 2 + 1; byte[] bytes; - try { - bytes = new byte[inputSize]; + bytes = new byte[InputSize]; } catch (OutOfMemoryException) { @@ -72,21 +71,20 @@ public void WriteFromByte_InputSizeLargerThanHalfOfMaxInt_ShouldSuccess(int inpu var writableStream = new WriteOnlyStream(); using (var bs = new BufferedStream(writableStream)) { - bs.Write(bytes, 0, inputSize); - Assert.Equal(inputSize, writableStream.Position); + bs.Write(bytes, 0, InputSize); + Assert.Equal(InputSize, writableStream.Position); } } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] [OuterLoop] - [InlineData(int.MaxValue / 2 + 1)] - public void WriteFromSpan_InputSizeLargerThanHalfOfMaxInt_ShouldSuccess(int inputSize) + public void WriteFromSpan_InputSizeLargerThanHalfOfMaxInt_ShouldSuccess() { + const int InputSize = int.MaxValue / 2 + 1; byte[] bytes; - try { - bytes = new byte[inputSize]; + bytes = new byte[InputSize]; } catch (OutOfMemoryException) { @@ -97,7 +95,7 @@ public void WriteFromSpan_InputSizeLargerThanHalfOfMaxInt_ShouldSuccess(int inpu using (var bs = new BufferedStream(writableStream)) { bs.Write(new ReadOnlySpan(bytes)); - Assert.Equal(inputSize, writableStream.Position); + Assert.Equal(InputSize, writableStream.Position); } }