private ValidationResult CheckForPotentiallyMisconfiguredComponents(IWindsorContainer container)
        {
            var host = (IDiagnosticsHost)container.Kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
            var diagnostics = host.GetDiagnostic<IPotentiallyMisconfiguredComponentsDiagnostic>();

            var handlers = diagnostics.Inspect();

            ValidationResult result = new ValidationResult();

            if (handlers.Any())
            {
                var message = new StringBuilder();
                var inspector = new DependencyInspector(message);

                foreach (IExposeDependencyInfo handler in handlers)
                {
                    handler.ObtainDependencyDetails(inspector);
                }

                result.AddMessage(Severity.Error, message.ToString());
                Console.Write(message.ToString());
            }

            return result;
        }
        public ValidationResult Second(Guid seconderId)
        {
            ValidationResult result = new ValidationResult();

            if(seconderId == IssuerId)
            {
                result.AddMessage(Severity.Error, "You may not second a fine you awarded!");
            }

            if(result.HasErrors) return result;

            this.SeconderId = seconderId;

            return result;
        }
        private ValidationResult ValidateFine(Fine fine)
        {
            ValidationResult validationResult = new ValidationResult();

            if (fine.Reason.IsNullOrEmpty())
            {
                validationResult.AddMessage(Severity.Error, "A fine requires a reason");
            }

            if (!this.userApi.IsValidFineIssuer(fine.IssuerId))
            {
                validationResult.AddMessage(Severity.Error, string.Format("Only {0} fines per user per day can be awarded", int.Parse(ConfigurationManager.AppSettings["MaxFinesPerUserPerDay"])));
            }

            return validationResult;
        }
 protected virtual BotMessage GetErrorResponse(ValidationResult result, SlackMessage message)
 {
     reactionApi.AddReaction(ConfigurationManager.AppSettings["BotKey"], "raised_hand", message.GetChannelId(), message.GetTimeStamp());
     chatApi.PostMessage(ConfigurationManager.AppSettings["BotKey"], message.User.ID, result.FullTrace);
     return new BotMessage { Text = "" };
 }
 public PayFineResult(ValidationResult validation)
 {
     this.Append(validation);
 }
 public IssueFineResult(ValidationResult validation)
 {
     this.Append(validation);
 }
        public void Append(ValidationResult result)
        {
            if(this.ValidationMessages == null) this.ValidationMessages = new List<ValidationMessage>();

            this.ValidationMessages.AddRange(result.ValidationMessages);
        }
 public FineSecondedResult(ValidationResult result)
 {
     this.Append(result);
 }