Skip to content

Commit

Permalink
Add SetBuffer test to further validate null buffer behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub committed Jun 14, 2017
1 parent 5fda93d commit 4826ce0
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ public void SetBuffer_InvalidArgs_Throws()
}
}

[Fact]
public void SetBuffer_NoBuffer_ResetsCountOffset()
{
using (var saea = new SocketAsyncEventArgs())
{
saea.SetBuffer(42, 84);
Assert.Equal(0, saea.Offset);
Assert.Equal(0, saea.Count);

saea.SetBuffer(new byte[3], 1, 2);
Assert.Equal(1, saea.Offset);
Assert.Equal(2, saea.Count);

saea.SetBuffer(null, 1, 2);
Assert.Equal(0, saea.Offset);
Assert.Equal(0, saea.Count);
}
}

[Fact]
public void SetBufferListWhenBufferSet_Throws()
{
Expand Down

0 comments on commit 4826ce0

Please sign in to comment.