Пример #1
0
        public void CreateCompiled_ShouldHandleValueTypeCollection()
        {
            var value = new ValueCollection {
                Collection = new List <int>(6)
                {
                    1, 2, 3, 4, 5, 6
                }
            };

            var writer = _binFactory.Get(28);

            value.Serialize(writer);

            var reader          = _binFactory.Get(writer.GetBuffer());
            var compiledStorage = DeserializerStorageProvider.CreateCompiled <ValueCollection>();
            var desValue        = new ValueCollection();

            compiledStorage.Deserialize(_emptyDes, reader, _policy, desValue);

            Assert.Equal(value.Collection, desValue.Collection);
        }
        public void CreateCompiled_ShouldHandleValueTypeCollection()
        {
            var value = new ValueCollection()
            {
                Collection = new List <int>(5)
                {
                    1, 2, 3, 4, 5, 6
                }
            };

            var writer    = _binFactory.Get(28);
            var writerSer = _binFactory.Get(28);

            var compiledStorage = SerializerStorageProvider.CreateCompiled <ValueCollection>();

            value.Serialize(writer);
            compiledStorage.Serialize(_emptySer, writerSer, value);

            Assert.Equal(
                writer.GetBuffer().ToArray(),
                writerSer.GetBuffer().ToArray());
        }