public void TestThatEncryptTagGetsEncrypted()
        {
            var crypto = new JsonConfigCrypto(_cryptoKey);
            var encryptedJson = crypto.Encrypt(_encryptJson);

            var decryptedJson = crypto.Decrypt(encryptedJson);

            var serializer = new JsonSerializer<ConDepEnvConfig>(crypto);
            serializer.DeSerialize(decryptedJson);
        }
 public void TestThatUnencryptedJsonIsNotIdentifiedAsEncrypted()
 {
     var crypto = new JsonConfigCrypto(_cryptoKey);
     Assert.That(crypto.IsEncrypted(_json), Is.False);
     Assert.That(crypto.IsEncrypted(_tiersJson), Is.False);
 }
        public void TestThatEncryptedJsonCanBeDecryptedIntoTypedConfig()
        {
            //var parser = new EnvConfigParser(new ConfigJsonSerializer(new JsonConfigCrypto()), new JsonConfigCrypto());
            var cryptoHandler = new JsonConfigCrypto(_cryptoKey);
            var serializer = new JsonSerializer<ConDepEnvConfig>(cryptoHandler);

            //parser.Encrypted(_json, out config);
            var config = serializer.DeSerialize(_json);

            string deploymentPassword = config.DeploymentUser.Password;
            string lbPassword = config.LoadBalancer.Password;

            var encryptedJson = cryptoHandler.Encrypt(_json);

            //parser.EncryptJsonConfig(config, crypto);

            //var encryptedJson = parser.ConvertToJsonText(config);
            Assert.That(cryptoHandler.IsEncrypted(encryptedJson), Is.True);

            var decryptedConfig = serializer.DeSerialize(encryptedJson);

            Assert.That(decryptedConfig.DeploymentUser.Password, Is.EqualTo(deploymentPassword));
            Assert.That(decryptedConfig.LoadBalancer.Password, Is.EqualTo(lbPassword));
        }