public void CountFailedRequests() { using (var db1 = new LogDbContext(dbOptions)) { db1.RequestLogs.AddRange( new RequestLog { RequestId = 1, RequestGuid = guid, DateTimeUtc = today, RequestType = "GET" }, new RequestLog { RequestId = 2, RequestGuid = guid, DateTimeUtc = today.AddHours(1), RequestType = "GET" }, new RequestLog { RequestId = 3, RequestGuid = guid, DateTimeUtc = today.AddHours(2), RequestType = "GET" } ); db1.ResponseLogs.AddRange( new ResponseLog { ResponseId = 1, RequestGuid = guid, DateTimeUtc = today, Status = "HTTP 200 : OK" }, new ResponseLog { ResponseId = 2, RequestGuid = guid, DateTimeUtc = today.AddHours(1), Status = "HTTP 302 : Found" }, new ResponseLog { ResponseId = 3, RequestGuid = guid, DateTimeUtc = today.AddHours(2), Status = "Other" } ); db1.SaveChanges(); } int count = repo.FailedRequests(0); Assert.AreEqual(1, count); }
private void GetCounts(int addDays) { ViewBag["TotalCount"] = _repo.TotalRequests(addDays); ViewBag["SuccessfulCount"] = _repo.SuccessFullRequests(addDays); ViewBag["FailCount"] = _repo.FailedRequests(addDays); ViewBag["UnauthorizedCount"] = _repo.UnauthorizedRequest(addDays); ViewBag["TotalTime"] = _repo.TotalRequestsTime(addDays); ViewBag["SuccessfulTime"] = _repo.SuccessFullRequestsTime(addDays); ViewBag["FailCountTime"] = _repo.FailedRequestsTime(addDays); ViewBag["UnauthorizedTime"] = _repo.UnauthorizedRequestTime(addDays); }