public void SetExecuted() { var isHealthy = Checks.All(x => x.IsHealthy); EndAtUtc = DateTime.UtcNow; Code = isHealthy ? StatusCodes.Status200OK : StatusCodes.Status503ServiceUnavailable; Reason = isHealthy ? string.Empty : BeatPulseKeys.BEATPULSE_SERVICEUNAVAILABLE_REASON; }
/// <summary> /// ctor /// </summary> /// <param name="statuses">List of checks executed</param> /// <param name="timeStamp">Time of the test execution.</param> public SystemStatusModel(IEnumerable <Status> statuses, DateTime?timeStamp = null) { Checks = statuses.Select(s => new Check(s)).ToArray(); TimeStamp = timeStamp.GetValueOrDefault(DateTime.UtcNow); NoFailures = Checks.All(c => c.Passed.GetValueOrDefault(true)); }
public bool FilterResult(AvailablePart part, int depth = 0) { return(Invert ^ Checks.All(c => c.CheckResult(part, depth))); }