public void GetHearingById_ReturnsBadRequest() { // Arrange var hearingRepo = new Mock <IHearingsRepository>(); var hearingManipulation = new HearingsManipulation(hearingRepo.Object); var controller = new HearingsController(hearingManipulation); // Act var result = controller.Get(-1); // Assert Assert.IsType <BadRequestObjectResult>(result); }
public void GetHearingById_ReturnsOK() { // Arrange int id = 123; DateTime hearingDate = DateTime.Now; int createdByUserId = 1; int caseId = 3; var usersOnHearing = new List <UserHearingDto>() { new UserHearingDto() { UserId = 1 } }; var notes = new List <NoteDto>() { new NoteDto { Text = "test test", CreatedByUserId = 1, HearingId = 123 } }; var hearing = new HearingDto() { HearingId = id, HearingDate = hearingDate, CreatedByUserId = createdByUserId, CaseId = caseId, UserHearing = usersOnHearing, Note = notes }; var hearingRepo = new Mock <IHearingsRepository>(); hearingRepo.Setup(x => x.InsertHearing(hearing)); var hearingManipulation = new HearingsManipulation(hearingRepo.Object); var controller = new HearingsController(hearingManipulation); // Act var result = controller.Get(123); // Assert Assert.IsType <OkObjectResult>(result); }