protected void SaveCredentialsToSettings(SerializeableCloudStorageCredentials credentials) { SettingsModel settings = _settingsService.LoadSettingsOrDefault(); if (!credentials.AreEqualOrNull(settings.Credentials)) { settings.Credentials = credentials; _settingsService.TrySaveSettingsToLocalDevice(settings); } }
public void SerializedDatacontractCanBeReadBack() { SerializeableCloudStorageCredentials credentials = CreateExampleCredentials(); credentials.EncryptBeforeSerialization(PseudoEncrypt); string xml = SerializeWithDatacontract(credentials); var credentials2 = DeserializeWithDatacontract <SerializeableCloudStorageCredentials>(xml); credentials2.DecryptAfterDeserialization(PseudoDecrypt); Assert.IsTrue(credentials.AreEqualOrNull(credentials2)); }