Esempio n. 1
0
            public void ShouldThrowExceptionIfMarkerByteNotDouble()
            {
                var mockInput = IOExtensions.CreateMockStream(PackStream.Bytes16);
                var reader    = new PackStreamReader(mockInput.Object, BoltReader.StructHandlers);

                var ex = Xunit.Record.Exception(() => reader.ReadDouble());

                ex.Should().BeOfType <ProtocolException>();
            }
Esempio n. 2
0
            public void ShouldReadDoubleCorrectly()
            {
                const double expected  = 1.12;
                var          mockInput = IOExtensions.CreateMockStream(PackStream.Float64, PackStreamBitConverter.GetBytes(expected));
                var          reader    = new PackStreamReader(mockInput.Object, BoltReader.StructHandlers);

                var real = reader.ReadDouble();

                real.Should().Be(expected);
                mockInput.Verify(x => x.Read(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>()), Times.Exactly(2));
            }