Beispiel #1
0
        private static ArraySegment <byte> CreateRequestBody([NotNull] StreamCoordinates coordinates)
        {
            var writer = new BinaryBufferWriter(sizeof(int) + coordinates.Positions.Length * (sizeof(int) + sizeof(long)))
            {
                Endianness = Endianness.Big
            };

            StreamCoordinatesWriter.Write(coordinates, writer);

            return(writer.FilledSegment);
        }
Beispiel #2
0
        private static void TestSerialization(StreamCoordinates coordinates)
        {
            var writer = new BinaryBufferWriter(1)
            {
                Endianness = Endianness.Big
            };

            StreamCoordinatesWriter.Write(coordinates, writer);

            var reader = new BinaryBufferReader(writer.Buffer, 0)
            {
                Endianness = Endianness.Big
            };

            StreamCoordinatesReader.Read(reader).Should().BeEquivalentTo(coordinates);
        }