public void Should_be_true_when_key_has_whitespace()
        {
            var section = new EncryptionServiceConfig
            {
                ExpiredKeys =
                {
                    new ExpiredKey {
                        Key = " "
                    }
                }
            };

            Assert.IsTrue(EncryptionServiceConfigValidations.ExpiredKeysHaveWhiteSpace(section));
        }
        public void Should_be_true_when_key_identifier_not_in_expired_keys()
        {
            var section = new EncryptionServiceConfig
            {
                ExpiredKeys =
                {
                    new ExpiredKey {
                        Key = "Key"
                    }
                }
            };

            Assert.IsTrue(EncryptionServiceConfigValidations.OneOrMoreExpiredKeysHaveNoKeyIdentifier(section));
        }
        public void Should_be_true_when_encryption_key_in_expirede_keys()
        {
            var section = new EncryptionServiceConfig
            {
                Key         = "Key",
                ExpiredKeys = new ExpiredKeyCollection
                {
                    new ExpiredKey {
                        Key = "Key"
                    },
                }
            };

            Assert.IsTrue(EncryptionServiceConfigValidations.EncryptionKeyListedInExpiredKeys(section));
        }
        public void Should_be_false_when_encryption_key_not_in_expired_keys()
        {
            var section = new EncryptionServiceConfig()
            {
                Key         = "Key",
                ExpiredKeys = new ExpiredKeyCollection
                {
                    new ExpiredKey {
                        Key = "AnotherKey"
                    },
                }
            };

            Assert.IsFalse(EncryptionServiceConfigValidations.EncryptionKeyListedInExpiredKeys(section));
        }
        public void Should_be_true_when_duplicate_key_identifier_in_concat_expired_keys()
        {
            var section = new EncryptionServiceConfig
            {
                KeyIdentifier = "2",
                ExpiredKeys   =
                {
                    new ExpiredKey {
                        Key = "A", KeyIdentifier = "1;4"
                    },
                    new ExpiredKey {
                        Key = "B", KeyIdentifier = "3;4"
                    }
                }
            };

            Assert.IsTrue(EncryptionServiceConfigValidations.ConfigurationHasDuplicateKeyIdentifiers(section));
        }