Beispiel #1
0
 public void ShrinkPositionStaysAtEnd()
 {
     using (StreamBuffer buffer = new StreamBuffer(0))
     {
         buffer.Write(new byte[] { 0xA, 0xB, 0xC }, 0, 3);
         buffer.Position.Should().Be(3);
         buffer.Length.Should().Be(3);
         buffer.SetLength(2);
         buffer.Position.Should().Be(2);
         buffer.Length.Should().Be(2);
     }
 }
Beispiel #2
0
 public void SetLengthOnEmptyStream()
 {
     using (StreamBuffer buffer = new StreamBuffer())
     {
         buffer.Length.Should().Be(0);
         buffer.SetLength(7);
         buffer.Length.Should().Be(7);
     }
 }
Beispiel #3
0
 public void SetLengthToZero()
 {
     using (StreamBuffer buffer = new StreamBuffer(7))
     {
         buffer.Length.Should().Be(7);
         buffer.SetLength(0);
         buffer.Length.Should().Be(0);
     }
 }
Beispiel #4
0
 public void SetNegativeLengthThrows()
 {
     using (StreamBuffer buffer = new StreamBuffer(0))
     {
         Action action = () => buffer.SetLength(-1);
         action.ShouldThrow<ArgumentOutOfRangeException>();
     }
 }