Пример #1
0
        public void DecryptAfterDesrializationRespectsNullProperties()
        {
            var credentials = new SerializeableCloudStorageCredentials();

            credentials.DecryptAfterDeserialization(PseudoDecrypt);

            // The Serialization* are set and are not plaintext
            Assert.IsNull(credentials.Token);
            Assert.IsNull(credentials.Username);
            Assert.IsNull(credentials.Password);
            Assert.IsNull(credentials.Url);
            Assert.IsFalse(credentials.Secure);
        }
Пример #2
0
        public void DecryptAfterDesrializationCanReadAllPropertiesBack()
        {
            SerializeableCloudStorageCredentials credentials = CreateExampleCredentials();

            credentials.EncryptBeforeSerialization(PseudoEncrypt);

            credentials.Token    = null;
            credentials.Username = null;
            credentials.Password = null;
            credentials.Url      = null;
            credentials.Secure   = false;

            credentials.DecryptAfterDeserialization(PseudoDecrypt);

            Assert.AreEqual("atk", credentials.Token.AccessToken);
            Assert.AreEqual(new DateTime(1999, 12, 24, 0, 0, 0, DateTimeKind.Utc), credentials.Token.ExpiryDate);
            Assert.AreEqual("rtk", credentials.Token.RefreshToken);
            Assert.AreEqual("usr", credentials.Username);
            Assert.AreEqual("pwd", credentials.UnprotectedPassword);
            Assert.IsTrue(credentials.Secure);
        }