File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
tests/ImageSharp.Tests/IO Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ public override long Position
8787 set
8888 {
8989 Guard . MustBeGreaterThanOrEqualTo ( value , 0 , nameof ( this . Position ) ) ;
90- Guard . MustBeLessThan ( value , this . Length , nameof ( this . Position ) ) ;
90+ Guard . MustBeLessThanOrEqualTo ( value , this . Length , nameof ( this . Position ) ) ;
9191
9292 // Only reset readBufferIndex if we are out of bounds of our working buffer
9393 // otherwise we should simply move the value by the diff.
Original file line number Diff line number Diff line change @@ -322,7 +322,21 @@ public void BufferedStreamThrowsOnBadPosition(int bufferSize)
322322 using ( var reader = new BufferedReadStream ( this . configuration , stream ) )
323323 {
324324 Assert . Throws < ArgumentOutOfRangeException > ( ( ) => reader . Position = - stream . Length ) ;
325- Assert . Throws < ArgumentOutOfRangeException > ( ( ) => reader . Position = stream . Length ) ;
325+ Assert . Throws < ArgumentOutOfRangeException > ( ( ) => reader . Position = stream . Length + 1 ) ;
326+ }
327+ }
328+ }
329+
330+ [ Fact ]
331+ public void BufferedStreamCanSetPositionToEnd ( )
332+ {
333+ var bufferSize = 8 ;
334+ this . configuration . StreamProcessingBufferSize = bufferSize ;
335+ using ( MemoryStream stream = this . CreateTestStream ( bufferSize * 2 ) )
336+ {
337+ using ( var reader = new BufferedReadStream ( this . configuration , stream ) )
338+ {
339+ reader . Position = reader . Length ;
326340 }
327341 }
328342 }
You can’t perform that action at this time.
0 commit comments