public void ReadInt64_should_return_expected_result( [Values(-1, 0, 1, long.MaxValue, long.MinValue)] long value) { var bytes = BitConverter.GetBytes(value); var stream = new MemoryStream(bytes); var subject = new BsonStreamAdapter(stream); var result = subject.ReadInt64(); result.Should().Be(value); subject.Position.Should().Be(8); }
public void ReadInt64_should_throw_when_subject_is_disposed() { var stream = Substitute.For<Stream>(); var subject = new BsonStreamAdapter(stream); subject.Dispose(); Action action = () => subject.ReadInt64(); action.ShouldThrow<ObjectDisposedException>().And.ObjectName.Should().Be("BsonStreamAdapter"); }
public void ReadInt64_should_be_little_endian() { var bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; var stream = new MemoryStream(bytes); var subject = new BsonStreamAdapter(stream); var result = subject.ReadInt64(); result.Should().Be(0x0807060504030201); }