public void WriteDouble_should_throw_when_subject_is_disposed() { var stream = Substitute.For<Stream>(); var subject = new BsonStreamAdapter(stream); subject.Dispose(); Action action = () => subject.WriteDouble(1.0); action.ShouldThrow<ObjectDisposedException>().And.ObjectName.Should().Be("BsonStreamAdapter"); }
public void WriteDouble_should_write_expected_bytes( [Values(-1.0, 0.0, 1.0, double.Epsilon, double.MaxValue, double.MinValue, double.NaN, double.NegativeInfinity, double.PositiveInfinity)] double value) { var stream = new MemoryStream(); var subject = new BsonStreamAdapter(stream); var expectedBytes = BitConverter.GetBytes(value); subject.WriteDouble(value); stream.ToArray().Should().Equal(expectedBytes); }