public async Task GetCaseDetails_Valid() { // Arrange int caseId = 1; CaseDetailsModel expected = GetSampleData_CaseDetails(caseId); _mockCourtCasesService.RetrieveAsync(caseId).Returns(expected); // Act ActionResult <CaseDetailsModel> response = await _sut.GetCaseDetails(caseId); // Assert await _mockCourtCasesService.Received(1).RetrieveAsync(caseId); var createdAtActionResult = Assert.IsType <OkObjectResult>(response.Result); CaseDetailsModel actual = (CaseDetailsModel)createdAtActionResult.Value; Assert.True(actual is not null); Assert.Equal(expected.CaseId, actual.CaseId); Assert.Equal(expected.CaseId, actual.CaseId); Assert.Equal(expected.CaseNumber, actual.CaseNumber); Assert.Equal(expected.AppealNumber, actual.AppealNumber); Assert.Equal(expected.CaseStatus, actual.CaseStatus); Assert.Equal(expected.CaseTypeId, actual.CaseTypeId); Assert.Equal(expected.CourtId, actual.CourtId); Assert.Equal(expected.LawyerId, actual.LawyerId); Assert.Equal(expected.LocationId, actual.LocationId); }
public ActionResult CaseDetail(String id) { //ViewBag.caseid = (String)this.ControllerContext.RouteData.Values["id"]; ViewBag.caseid = id; ViewBag.breadCrumb = "<li class='breadcrumb-item'><a href='/CaseDetails'>Case List</a></li><li class='breadcrumb-item active'>Case Details</li>"; ViewBag.currentPage = "caseDetail"; return(View(CaseDetailsModel.GetCase(id))); }
public ActionResult Create(CaseDetailsModel casedetail) { CaseDetailsModel.CreateCase(casedetail); ViewBag.currentPage = "caseCreate"; ViewBag.submitted = true; ViewBag.Message = "Case Created Successfully "; return(View()); }
public String UpdateCategory(List <CaseDetailsModel> model) { CaseDetailsModel.UpdateCase(model); /*var ClientFile = CaseDetailsModel.CaseFile; * System.IO.File.WriteAllText(ClientFile, string.Empty);*/ Dictionary <String, String> resp = new Dictionary <string, string>(); /* System.IO.File.WriteAllText(ClientFile, JsonConvert.SerializeObject(model));*/ resp.Add("message", "success"); return(JsonConvert.SerializeObject(resp)); }
private static Dictionary <String, String> getListJson(CaseDetailsModel c) { Dictionary <String, String> dict = new Dictionary <string, string>(); dict["casename"] = c.casename; dict["caseid"] = c.caseid; dict["casereceiveddate"] = c.casereceiveddate; dict["classification"] = c.casetype; dict["category"] = c.category; dict["summary"] = c.summary; dict["subject"] = c.subject; return(dict); }
public async Task <ActionResult <CaseDetailsModel> > GetCaseDetails(int caseId) { if (caseId < 1) { return(UnprocessableEntity($"Invalid CaseId: {caseId}")); } CaseDetailsModel caseDetails = await _courtCasesService.RetrieveAsync(caseId); if (caseDetails is null) { return(NotFound()); } return(Ok(caseDetails)); }
public ActionResult About() { ViewBag.currentPage = "caseList"; var cases = CaseDetailsModel.GetCases(); if (cases != null) { ViewBag.calendardates = getCalendarDates(cases); } else { ViewBag.calendardates = new Dictionary <String, List <Dictionary <String, String> > >(); } return(View(cases)); }
public async Task GetCaseDetails_NotFound() { // Arrange int caseId = 1; CaseDetailsModel expected = null; _mockCourtCasesService.RetrieveAsync(caseId).Returns(expected); // Act ActionResult <CaseDetailsModel> response = await _sut.GetCaseDetails(caseId); // Assert await _mockCourtCasesService.Received(1).RetrieveAsync(caseId); Assert.IsType <NotFoundResult>(response.Result); }
private static CaseDetailsModel GetSampleData_CaseDetails(int caseId) { var result = new CaseDetailsModel { CaseId = caseId, CaseNumber = "Cn1", AppealNumber = 0, CaseTypeId = 1, CourtId = 1, LawyerId = 1, LocationId = 1, CaseStatus = 1 }; return(result); }