コード例 #1
0
 public void ReadTooLargeCount()
 {
     using var st = new Base32768Stream(new StringReader("foo"));
     st.Invoking(st => st.Read(new byte[1], 0, 2))
     .Should().Throw <ArgumentOutOfRangeException>()
     .Which.ParamName.Should().Be("count");
     st.Invoking(st => st.Read(new byte[2], 0, 3))
     .Should().Throw <ArgumentOutOfRangeException>()
     .Which.ParamName.Should().Be("count");
     st.Invoking(st => st.Read(new byte[2], 1, 2))
     .Should().Throw <ArgumentOutOfRangeException>()
     .Which.ParamName.Should().Be("count");
 }
コード例 #2
0
 public void ReadNegativeOffset()
 {
     using var st = new Base32768Stream(new StringReader("foo"));
     st.Invoking(st => st.Read(new byte[0], -1, 0))
     .Should().Throw <ArgumentOutOfRangeException>()
     .Which.ParamName.Should().Be("offset");
 }
コード例 #3
0
 public void ReadNullBuffer()
 {
     using var st = new Base32768Stream(new StringReader("foo"));
     st.Invoking(st => st.Read(null, 0, 0))
     .Should().Throw <ArgumentNullException>()
     .Which.ParamName.Should().Be("buffer");
 }
コード例 #4
0
        public void ReadDisposedStream()
        {
            var st = new Base32768Stream(new StringWriter());

            st.Dispose();
            st.Invoking(st => st.Read(null, 0, 0))
            .Should().Throw <ObjectDisposedException>()
            .Which.ObjectName.Should().Be("Base32768Stream");
        }
コード例 #5
0
 public void ReadSizeZero()
 {
     using var st = new Base32768Stream(new StringReader("foo"));
     st.Read(new byte[0], 0, 0).Should().Be(0);
 }
コード例 #6
0
 public void ReadWriteStream()
 {
     using var st = new Base32768Stream(new StringWriter());
     st.Invoking(st => st.Read(null, 0, 0))
     .Should().Throw <InvalidOperationException>().WithMessage("The stream is not readable.");
 }