public void AfterConstructorVersionSerializerPropertyIsDefined() { var admSerializer = new AdmSerializer(_versionSerializerMock.Object, _propriataryValuesSerializerMock.Object, _catalogSearializerMock.Object, _documentsSerializerMock.Object, _referenceLayersSerializerMock.Object, SerializationVersionEnum.V2); var result = admSerializer.VersionSerializer; Assert.AreSame(_versionSerializerMock.Object, result); }
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)); }
public void GivenCardPathWhenSerializeWithV2AsDefaultThenV2SerializationHappens() { var dataPath = Path.Combine(_tempPath, DatacardConstants.DataFolder); var admSerializer = new AdmSerializer(_versionSerializerMock.Object, _propriataryValuesSerializerMock.Object, _catalogSearializerMock.Object, _documentsSerializerMock.Object, _referenceLayersSerializerMock.Object, SerializationVersionEnum.V2); admSerializer.Serialize(_dataModel, _tempPath); _propriataryValuesSerializerMock.Verify(x => x.Serialize(BaseProtobufSerializer.InstanceV2, _dataModel.ProprietaryValues, dataPath)); _catalogSearializerMock.Verify(x => x.Serialize(BaseProtobufSerializer.InstanceV2, _dataModel.Catalog, dataPath)); _documentsSerializerMock.Verify(x => x.Serialize(BaseProtobufSerializer.InstanceV2, _dataModel.Documents, dataPath)); _referenceLayersSerializerMock.Verify(x => x.Serialize(BaseProtobufSerializer.InstanceV2, _dataModel.ReferenceLayers, dataPath)); _versionSerializerMock.Verify(x => x.Serialize(SerializationVersionEnum.V2, dataPath)); }
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)); }
public void SimpleConstructorWorks() { var admSerializer = new AdmSerializer(SerializationVersionEnum.V2); Assert.IsTrue(true); }
public void EmptyConstructorWorks() { var admSerializer = new AdmSerializer(); Assert.IsTrue(true); }