Esempio n. 1
0
        /// <inheritdoc/>
        public IEnumerable <ValidationResult> Validate()
        {
            if (this.encryptionKey == null && this.keyResolver == null)
            {
                yield return(ValidationResultExtensions.Failure(this, "No encryption key or key resolver factory set!"));
            }

            if (this.encryptionKey != null)
            {
                yield return(ValidationResultExtensions.Success(this, "Encryption key factory set."));

                if (this.keyResolver == null)
                {
                    yield return(ValidationResultExtensions.Warning(this, "Key resolver factory is not set. Only encryption will be supported."));
                }
            }

            if (this.keyResolver != null)
            {
                yield return(ValidationResultExtensions.Success(this, "Key resolver factory set."));

                if (this.encryptionKey == null)
                {
                    yield return(ValidationResultExtensions.Warning(this, "Encryption key factory is not set. Only decryption will be supported."));
                }
            }
        }
Esempio n. 2
0
        public static IEnumerable <ValidationResult> Validate <TConsumer>(this IConsumerFactory <TConsumer> consumerFactory)
            where TConsumer : class
        {
            if (consumerFactory == null)
            {
                yield return(ValidationResultExtensions.Failure(null, "UseConsumerFactory", "must not be null"));
            }

            foreach (ValidationResult result in ValidateConsumer <TConsumer>(null))
            {
                yield return(result);
            }
        }