public void ReadByte_should_call_wrapped_stream() { var stream = Substitute.For<Stream>(); var subject = new BsonStreamAdapter(stream); stream.ReadByte().Returns(1); var result = subject.ReadByte(); result.Should().Be(1); stream.Received(1).ReadByte(); }
public void ReadByte_should_throw_when_subject_is_disposed() { var stream = Substitute.For<Stream>(); var subject = new BsonStreamAdapter(stream); subject.Dispose(); Action action = () => subject.ReadByte(); action.ShouldThrow<ObjectDisposedException>().And.ObjectName.Should().Be("BsonStreamAdapter"); }
public void ReadByte_should_call_wrapped_stream() { var mockStream = new Mock<Stream>(); var subject = new BsonStreamAdapter(mockStream.Object); mockStream.Setup(s => s.ReadByte()).Returns(1); var result = subject.ReadByte(); result.Should().Be(1); mockStream.Verify(s => s.ReadByte(), Times.Once); }