Пример #1
0
        public void SerializeWithPoolRecursiveStructComposeTypeTest()
        {
            var binarySerializer = new BinarySerializer(new ArrayPoolBinarySerializer(), new StandartBinaryDeserializer(), BinarySerializerStuffTest.Converters);

            var mock = RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > > > .Create(
                RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > > .Create(
                    RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > .Create(
                        RecursiveMockStruct <MockOnlyMetaData> .Create(
                            new MockOnlyMetaData()
                            )
                        )
                    )
                );

            var result = binarySerializer.Serialize(mock);

            result.Dispose();
        }
Пример #2
0
        public void SerializeRecursiveStructComposeTypeTest()
        {
            var pool = ArrayPool <byte> .Create();

            var serializer = new TcpSerializer <RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > > > >(_bitConverterHelper, i => pool.Rent(i));
            var mock       = RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > > > .Create(
                RecursiveMockStruct <RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > > .Create(
                    RecursiveMockStruct <RecursiveMockStruct <MockOnlyMetaData> > .Create(
                        RecursiveMockStruct <MockOnlyMetaData> .Create(
                            new MockOnlyMetaData()
                            )
                        )
                    )
                );

            var serializedRequest = serializer.Serialize(mock);

            serializedRequest.ReturnRentedArrays(pool, false);
        }