Ejemplo n.º 1
0
        public void Should_use_the_wireencrypted_string()
        {
            var message = new Customer
                {
                    Secret = MySecretMessage,
                    SecretField = MySecretMessage,
                    CreditCard = new CreditCardDetails {CreditCardNumber = MySecretMessage},
                    ListOfCreditCards =
                        new List<CreditCardDetails>
                            {
                                new CreditCardDetails {CreditCardNumber = MySecretMessage},
                                new CreditCardDetails {CreditCardNumber = MySecretMessage}
                            }
                };
            message.ListOfSecrets = new ArrayList(message.ListOfCreditCards);

            mutator.MutateOutgoing(message);

            Assert.AreEqual(message.Secret.EncryptedValue.EncryptedBase64Value, EncryptedBase64Value);
            Assert.AreEqual(message.SecretField.EncryptedValue.EncryptedBase64Value, EncryptedBase64Value);
            Assert.AreEqual(message.CreditCard.CreditCardNumber.EncryptedValue.EncryptedBase64Value,
                            EncryptedBase64Value);
            Assert.AreEqual(message.ListOfCreditCards[0].CreditCardNumber.EncryptedBase64Value, EncryptedBase64Value);
            Assert.AreEqual(message.ListOfCreditCards[1].CreditCardNumber.EncryptedBase64Value, EncryptedBase64Value);

            Assert.AreEqual(((CreditCardDetails) message.ListOfSecrets[0]).CreditCardNumber.EncryptedBase64Value,
                            EncryptedBase64Value);
            Assert.AreEqual(((CreditCardDetails) message.ListOfSecrets[1]).CreditCardNumber.EncryptedBase64Value,
                            EncryptedBase64Value);
        }
Ejemplo n.º 2
0
        public void Should_clear_the_compatibility_properties()
        {
            ConfigureEncryption.DisableCompatibilityWithNSB2(null);

            var message = new Customer
                {
                    Secret = MySecretMessage
                };
            mutator.MutateOutgoing(message);

            Assert.AreEqual(message.Secret.EncryptedValue.EncryptedBase64Value, EncryptedBase64Value);
            Assert.AreEqual(message.Secret.EncryptedBase64Value, null);
            Assert.AreEqual(message.Secret.Base64Iv, null);
        }
Ejemplo n.º 3
0
        public void Should_use_the_wireencrypted_string()
        {
            var message = new Customer
                {
                    Secret = Create(),
                    SecretField = Create(),
                    CreditCard = new CreditCardDetails {CreditCardNumber = Create()}

                };
            mutator.MutateIncoming(message);

            Assert.AreEqual(MySecretMessage, message.Secret.Value);
            Assert.AreEqual(MySecretMessage, message.SecretField.Value);
            Assert.AreEqual(MySecretMessage, message.CreditCard.CreditCardNumber.Value);
        }