Esempio n. 1
0
        public void UnwritableStreamIsOkay()
        {
            var stream = new DisabledMemoryStream(Encoding.ASCII.GetBytes("foo"))
            {
                canWrite = false
            };
            var reader = new ReverseLineReader(() => stream);

            AssertLines(new[] { "foo" }, reader);
        }
Esempio n. 2
0
        public void UnseekableStreamThrowsExceptionEagerly()
        {
            var stream = new DisabledMemoryStream {
                canSeek = false
            };
            var reader = new ReverseLineReader(() => stream);

            try
            {
                reader.GetEnumerator();
                Assert.Fail("Expected exception");
            }
            catch (NotSupportedException)
            {
                // Expected
            }
        }
Esempio n. 3
0
 public void UnwritableStreamIsOkay()
 {
     var stream = new DisabledMemoryStream(Encoding.ASCII.GetBytes("foo")) { canWrite = false };
     var reader = new ReverseLineReader(() => stream);
     AssertLines(new[]{"foo"}, reader);
 }
Esempio n. 4
0
 public void UnseekableStreamThrowsExceptionEagerly()
 {
     var stream = new DisabledMemoryStream { canSeek = false };
     var reader = new ReverseLineReader(() => stream);
     try
     {
         reader.GetEnumerator();
         Assert.Fail("Expected exception");
     }
     catch (NotSupportedException)
     {
         // Expected
     }
 }