public Deserialize ( ) : |
||
return |
public void SerializeAndDeserializePropertiesWithInternationalCharacters() { var originalConnectionInfo = new ConnectionInfo {Name = "con1", Password = "******" }; var serializedContent = _serializer.Serialize(originalConnectionInfo); _deserializer = new XmlConnectionsDeserializer(serializedContent); var deserializedModel = _deserializer.Deserialize(); var deserializedConnectionInfo = deserializedModel.GetRecursiveChildList().First(node => node.Name == originalConnectionInfo.Name); Assert.That(deserializedConnectionInfo.Password, Is.EqualTo(originalConnectionInfo.Password)); }
public void SerializeThenDeserialize() { var originalModel = SetupConnectionTreeModel(); var serializedContent = _serializer.Serialize(originalModel); _deserializer = new XmlConnectionsDeserializer(serializedContent); var deserializedModel = _deserializer.Deserialize(); var nodeNamesFromDeserializedModel = deserializedModel.GetRecursiveChildList().Select(node => node.Name); var nodeNamesFromOriginalModel = originalModel.GetRecursiveChildList().Select(node => node.Name); Assert.That(nodeNamesFromDeserializedModel, Is.EquivalentTo(nodeNamesFromOriginalModel)); }
public void Import(string fileName, ContainerInfo destinationContainer) { var dataProvider = new FileDataProvider(fileName); var xmlString = dataProvider.Load(); var xmlConnectionsDeserializer = new XmlConnectionsDeserializer(xmlString); var connectionTreeModel = xmlConnectionsDeserializer.Deserialize(true); var rootImportContainer = new ContainerInfo { Name = Path.GetFileNameWithoutExtension(fileName) }; rootImportContainer.Children.AddRange(connectionTreeModel.RootNodes.First().Children); destinationContainer.AddChild(rootImportContainer); }
public void SerializeAndDeserializeWithCustomKdfIterationsValue() { var cryptoProvider = new CryptographyProviderFactory().CreateAeadCryptographyProvider(BlockCipherEngines.AES, BlockCipherModes.GCM); cryptoProvider.KeyDerivationIterations = 5000; _serializer = new XmlConnectionsSerializer(cryptoProvider); var originalModel = SetupConnectionTreeModel(); var serializedContent = _serializer.Serialize(originalModel); _deserializer = new XmlConnectionsDeserializer(serializedContent); var deserializedModel = _deserializer.Deserialize(); var nodeNamesFromDeserializedModel = deserializedModel.GetRecursiveChildList().Select(node => node.Name); var nodeNamesFromOriginalModel = originalModel.GetRecursiveChildList().Select(node => node.Name); Assert.That(nodeNamesFromDeserializedModel, Is.EquivalentTo(nodeNamesFromOriginalModel)); }
public void Setup(string confCons, string password) { _xmlConnectionsDeserializer = new XmlConnectionsDeserializer(confCons, password.ConvertToSecureString); _connectionTreeModel = _xmlConnectionsDeserializer.Deserialize(); }