コード例 #1
0
        public void GivenCardPathWithNoVersionInfoWhenDeserializeThenV1DeserializationHappens()
        {
            var dataPath = Path.Combine(_tempPath, DatacardConstants.DataFolder);

            var admSerializer = new AdmSerializer(_versionSerializerMock.Object, _propriataryValuesSerializerMock.Object, _catalogSearializerMock.Object, _documentsSerializerMock.Object, _referenceLayersSerializerMock.Object, SerializationVersionEnum.V1);

            admSerializer.Deserialize(_tempPath);

            _propriataryValuesSerializerMock.Verify(x => x.Deserialize(BaseJsonSerializer.Instance, dataPath));
            _catalogSearializerMock.Verify(x => x.Deserialize(BaseJsonSerializer.Instance, dataPath));
            _documentsSerializerMock.Verify(x => x.Deserialize(BaseProtobufSerializer.InstanceV1, dataPath));
            _referenceLayersSerializerMock.Verify(x => x.Deserialize(BaseProtobufSerializer.InstanceV1, dataPath));
        }
コード例 #2
0
        public void GivenCardPathWithV2VersionInfoWhenDeserializeThenV2DeserializationHappens()
        {
            var dataPath    = Path.Combine(_tempPath, DatacardConstants.DataFolder);
            var versionInfo = new AdmVersionInfo {
                SerializationVersion = SerializationVersionEnum.V2
            };

            _versionSerializerMock.Setup(x => x.Deserialize(dataPath)).Returns(versionInfo);

            var admSerializer = new AdmSerializer(_versionSerializerMock.Object, _propriataryValuesSerializerMock.Object, _catalogSearializerMock.Object, _documentsSerializerMock.Object, _referenceLayersSerializerMock.Object, SerializationVersionEnum.V2);

            admSerializer.Deserialize(_tempPath);

            _propriataryValuesSerializerMock.Verify(x => x.Deserialize(BaseProtobufSerializer.InstanceV2, dataPath));
            _catalogSearializerMock.Verify(x => x.Deserialize(BaseProtobufSerializer.InstanceV2, dataPath));
            _documentsSerializerMock.Verify(x => x.Deserialize(BaseProtobufSerializer.InstanceV2, dataPath));
            _referenceLayersSerializerMock.Verify(x => x.Deserialize(BaseProtobufSerializer.InstanceV2, dataPath));
        }