public void CreateCompiled_ShouldHandleTypeValueCollection()
        {
            var value = new TypeValueCollection()
            {
                Collection = new List <Value>(2)
                {
                    new Value {
                        B = 8, S = 16, I = 32, L = 64
                    },
                    new Value {
                        B = 8, S = 16, I = 32, L = 64
                    }
                }
            };

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

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

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

            Assert.Equal(
                writer.GetBuffer().ToArray(),
                writerSer.GetBuffer().ToArray());
        }
예제 #2
0
        public void CreateCompiled_ShouldHandleTypeValueCollection()
        {
            var value = new TypeValueCollection
            {
                Collection = new List <Value>(6)
                {
                    new Value {
                        B = 8, S = 16, I = 32, L = 64
                    },
                    new Value {
                        B = 8, S = 16, I = 32, L = 64
                    }
                }
            };

            var writer = _binFactory.Get(34);

            value.Serialize(writer);

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

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

            for (var i = 0; i < 2; i++)
            {
                Assert.True(_valueComparer.Equals(value.Collection[i], desValue.Collection[i]));
            }
        }