示例#1
0
        protected void SaveCredentialsToSettings(SerializeableCloudStorageCredentials credentials)
        {
            SettingsModel settings = _settingsService.LoadSettingsOrDefault();

            if (!credentials.AreEqualOrNull(settings.Credentials))
            {
                settings.Credentials = credentials;
                _settingsService.TrySaveSettingsToLocalDevice(settings);
            }
        }
示例#2
0
        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));
        }