public void FailedRequestsTime() { 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).AddSeconds(2), Status = "Other" }, new ResponseLog { ResponseId = 3, RequestGuid = guid, DateTimeUtc = today.AddHours(2).AddSeconds(7), Status = "Other" } ); db1.SaveChanges(); } int count = repo.FailedRequestsTime(0); Assert.AreEqual(4500, 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); }