File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public void RaisingExceptionsOfAllKindsTests()
4242 _ = span [ span . Length ] ;
4343 } ) ;
4444
45- Assert . ThrowsException ( typeof ( IndexOutOfRangeException ) , ( ) =>
45+ Assert . ThrowsException ( typeof ( ArgumentOutOfRangeException ) , ( ) =>
4646 {
4747 Span < byte > span = new Span < byte > ( array ) ;
4848 _ = span [ - 1 ] ;
@@ -197,9 +197,14 @@ public void CopyToTests()
197197 toCopy = new Span < byte > ( new byte [ span . Length + 1 ] ) ;
198198 span . CopyTo ( toCopy ) ;
199199
200- CollectionAssert . AreEqual ( array , toCopy . ToArray ( ) , "Original array and SpanByte.CopyTo should be the same with larger destination" ) ;
200+ Assert . AreEqual ( toCopy . Length , span . Length + 1 ) ;
201+
202+ byte [ ] tempArray = new byte [ span . Length + 1 ] ;
203+ Array . Copy ( array , tempArray , array . Length ) ;
204+
205+ CollectionAssert . AreEqual ( tempArray , toCopy . ToArray ( ) , "Original array and SpanByte.CopyTo should be the same with larger destination" ) ;
201206
202- Assert . AreEqual ( toCopy [ span . Length ] , ( byte ) 0 , "Copied span and original array have different lenghts. " ) ;
207+ Assert . AreEqual ( toCopy [ toCopy . Length - 1 ] , ( byte ) 0 , "Last byte should be 0 (byte default) " ) ;
203208 }
204209
205210 [ TestMethod ]
You can’t perform that action at this time.
0 commit comments