コード例 #1
0
        public ConfigurationValidationResult ValidateConfiguration(params IMethodInfoRequirement[] methodRequirements)
        {
            var result = new ConfigurationValidationResult();

            if (_container == null)
            {
                result.AddError("Container not set.");
            }

            if (_config.LogOutput == null)
            {
                result.AddError("Writer not set.");
            }

            foreach (MethodInfo method in _config.GetRegisteredMethods())
            {
                foreach (var methodRequirement in methodRequirements)
                {
                    if (!methodRequirement.SatisfiedBy(method))
                    {
                        result.AddError($"Logging invocation of {method} in {method.DeclaringType} is not possible. {methodRequirement.GetFriendlyMessage(method)}");
                    }
                }
            }

            return(result);
        }
コード例 #2
0
 public void CopyErrorsFrom(ConfigurationValidationResult validationResult)
 {
     validationResult._errors.ForEach(AddError);
 }