public HttpMonitorCheck(
     HttpMonitorCheckId id,
     HttpMonitorId httpMonitorId,
     HttpRequest request,
     HttpRequestTiming requestTiming,
     HttpResponse response = null,
     string errorMessage   = null)
 {
     Id            = id ?? throw new ArgumentNullException(nameof(id));
     HttpMonitorId = httpMonitorId ?? throw new ArgumentNullException(nameof(httpMonitorId));
     Request       = request ?? throw new ArgumentNullException(nameof(request));
     RequestTiming = requestTiming ?? throw new ArgumentNullException(nameof(requestTiming));
     Response      = response;
     ErrorMessage  = errorMessage;
 }
Пример #2
0
        public HttpMonitor(
            HttpMonitorId id,
            HttpRequest request,
            MonitorStatus status = MonitorStatus.Unknown,
            IEnumerable <HttpMonitorCheck> recentHttpMonitorChecks = null)
        {
            if (!Enum.IsDefined(typeof(MonitorStatus), status))
            {
                throw new InvalidEnumArgumentException(nameof(status), (int)status, typeof(MonitorStatus));
            }

            Id              = id ?? throw new ArgumentNullException(nameof(id));
            Request         = request ?? throw new ArgumentNullException(nameof(request));
            Status          = status;
            AlertContactIds = new HashSet <AlertContactId>();

            RecentHttpMonitorChecks = recentHttpMonitorChecks != null?
                                      recentHttpMonitorChecks.ToList().AsReadOnly() :
                                          new List <HttpMonitorCheck>().AsReadOnly();
        }