Exemplo n.º 1
0
 public void NegativeOffset(long offset)
 {
     // Given that there is a text source
     //  and the text length is 3
     // When Seek is called with a negative offset
     // Then an ArgumentOutOfRangeException is thrown
     using (var sut = new StringTextSource("abc"))
     {
         Assert.Throws <ArgumentOutOfRangeException>(() => sut.Seek(offset));
     }
 }
Exemplo n.º 2
0
 public void SeekWithoutRecording()
 {
     // Given that there is a text source
     //  and the text length is 10
     // When reading 1 character
     //  and seeking to offset 0
     // Then an exception is thrown
     using (var sut = new StringTextSource("1234567890"))
     {
         sut.Read(new char[2], 0, 2);
         Assert.Throws <ArgumentOutOfRangeException>(() => sut.Seek(0));
     }
 }
Exemplo n.º 3
0
 public void SimpleForwardSeek()
 {
     // Given that there is a text source
     //  and the text length is 3
     // When Seek is called
     //  and the seek offset is 2
     // Then the current offset becomes 2
     using (var sut = new StringTextSource("abc"))
     {
         sut.Seek(2);
         Assert.Equal(2, sut.Offset);
     }
 }