File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
UnitTests/UnitTests.HighPerformance.Shared/Buffers Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,16 @@ public void Test_ArrayPoolBufferWriterOfT_AllocateAndGetMemoryAndSpan()
5454 Assert . ThrowsException < ObjectDisposedException > ( ( ) => writer . Advance ( 1 ) ) ;
5555 }
5656
57+ [ TestCategory ( "ArrayPoolBufferWriterOfT" ) ]
58+ [ TestMethod ]
59+ [ ExpectedException ( typeof ( ArgumentOutOfRangeException ) ) ]
60+ public void Test_ArrayPoolBufferWriterOfT_InvalidRequestedSize ( )
61+ {
62+ var writer = new ArrayPoolBufferWriter < byte > ( - 1 ) ;
63+
64+ Assert . Fail ( "You shouldn't be here" ) ;
65+ }
66+
5767 [ TestCategory ( "ArrayPoolBufferWriterOfT" ) ]
5868 [ TestMethod ]
5969 public void Test_ArrayPoolBufferWriterOfT_Clear ( )
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ public void Test_MemoryOwnerOfT_AllocateAndGetMemoryAndSpan()
3030 Assert . IsTrue ( buffer . Span . ToArray ( ) . All ( i => i == 42 ) ) ;
3131 }
3232
33+ [ TestCategory ( "MemoryOwnerOfT" ) ]
34+ [ TestMethod ]
35+ [ ExpectedException ( typeof ( ArgumentOutOfRangeException ) ) ]
36+ public void Test_MemoryOwnerOfT_InvalidRequestedSize ( )
37+ {
38+ using var buffer = MemoryOwner < int > . Allocate ( - 1 ) ;
39+
40+ Assert . Fail ( "You shouldn't be here" ) ;
41+ }
42+
3343 [ TestCategory ( "MemoryOwnerOfT" ) ]
3444 [ TestMethod ]
3545 [ ExpectedException ( typeof ( ObjectDisposedException ) ) ]
Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for more information.
44
5+ using System ;
56using System . Diagnostics . CodeAnalysis ;
67using System . Linq ;
78using Microsoft . Toolkit . HighPerformance . Buffers ;
@@ -27,6 +28,16 @@ public void Test_SpanOwnerOfT_AllocateAndGetMemoryAndSpan()
2728 Assert . IsTrue ( buffer . Span . ToArray ( ) . All ( i => i == 42 ) ) ;
2829 }
2930
31+ [ TestCategory ( "SpanOwnerOfT" ) ]
32+ [ TestMethod ]
33+ [ ExpectedException ( typeof ( ArgumentOutOfRangeException ) ) ]
34+ public void Test_SpanOwnerOfT_InvalidRequestedSize ( )
35+ {
36+ using var buffer = SpanOwner < int > . Allocate ( - 1 ) ;
37+
38+ Assert . Fail ( "You shouldn't be here" ) ;
39+ }
40+
3041 [ TestCategory ( "HashCodeOfT" ) ]
3142 [ TestMethod ]
3243 public void Test_SpanOwnerOfT_PooledBuffersAndClear ( )
You can’t perform that action at this time.
0 commit comments