Пример #1
0
        public void Setup()
        {
            if (Complexity == "Simple")
            {
                _ev = TestData.SimpleEventInstance();
            }
            else
            {
                _ev = TestData.ComplexEventInstance();
            }

            // BTDB Setup
            _eventSerializer   = new EventSerializer();
            _eventDeserializer = new EventDeserializer();
            bool hasMedataData;
            var  meta = _eventSerializer.Serialize(out hasMedataData, _ev).ToAsyncSafe();

            _eventSerializer.ProcessMetadataLog(meta);
            _eventDeserializer.ProcessMetadataLog(meta);
            _btdbSerializedData = _eventSerializer.Serialize(out hasMedataData, _ev).ToAsyncSafe();
            BtdbByteSize        = _btdbSerializedData.Length;
            object obj;

            _eventDeserializer.Deserialize(out obj, _btdbSerializedData);
            obj.Should().BeEquivalentTo(_ev);

            // ProtoBuf Setup
            Serializer = ModelFactory.CreateModel();
            _eventType = typeof(Event);
            _memStream = new MemoryStream();
            Serializer.Serialize(_memStream, _ev);
            ProtoBufByteSize    = (int)_memStream.Length;
            _memStream.Position = 0;
            Serializer.Deserialize(_memStream, null, _eventType).Should().BeEquivalentTo(_ev);

            BtdbSerialization();
            BtdbDeserialization();
            ProtoBufSerialization();
            ProtoBufDeserialization();
        }