public void ReadDouble_should_throw_when_subject_is_disposed() { var stream = Substitute.For<Stream>(); var subject = new BsonStreamAdapter(stream); subject.Dispose(); Action action = () => subject.ReadDouble(); action.ShouldThrow<ObjectDisposedException>().And.ObjectName.Should().Be("BsonStreamAdapter"); }
public void ReadDouble_should_return_expected_result( [Values(-1.0, 0.0, 1.0, double.Epsilon, double.MaxValue, double.MinValue, double.NaN, double.NegativeInfinity, double.PositiveInfinity)] double value ) { var bytes = BitConverter.GetBytes(value); var stream = new MemoryStream(bytes); var subject = new BsonStreamAdapter(stream); var result = subject.ReadDouble(); result.Should().Be(value); subject.Position.Should().Be(8); }