/// <summary> /// Check handler that throws <see cref="Exception"/> on Failures but otherwise returns true /// </summary> /// <param name="args"></param> /// <returns></returns> public virtual bool OnCheckPerformed(CheckEventArgs args) { //if there is a proposed fix then accept it regardless of whether it was a Fail. if (!string.IsNullOrWhiteSpace(args.ProposedFix)) { return(true); } if (args.Result == CheckResult.Fail) { throw new Exception("Failed check with message: " + args.Message, args.Ex); } return(true); }
virtual public bool OnCheckPerformed(CheckEventArgs args) { if (WriteToConsole) { Console.WriteLine(args.Message); } if (args.Result == CheckResult.Fail) { throw new Exception(args.Message, args.Ex); } if (args.Result == CheckResult.Warning && ThrowOnWarning) { throw new Exception(args.Message, args.Ex); } //do not apply fixes to warnings/success return(false); }
public bool OnCheckPerformed(CheckEventArgs args) { lock (lockList) { Messages.Add(args); } if (_childToPassEventsTo != null) { bool fix = _childToPassEventsTo.OnCheckPerformed(args); //if child accepted the fix if (fix && !string.IsNullOrWhiteSpace(args.ProposedFix) && args.Result == CheckResult.Fail) { args.Result = CheckResult.Warning; } return(fix); } return(false); }