public async Task FindAllByOwner__If_Model_is_invalid__Return_BadRequest() { // Arrange IConfirmationReportWorker worker = Substitute.For <IConfirmationReportWorker>(); worker.FindAllByOwner(null, null).Returns(new List <ConfirmationReportViewModel>()); var controller = new ConfirmationReportController(worker); controller.ModelState.AddModelError("fakeError", "fakeError"); // Act var actual = await controller.FindAllByOwner(null, null); // Assert Assert.IsAssignableFrom <InvalidModelStateResult>(actual); }
public async Task FindAllByOwner__If_Owner_has_report__Return_Ok_Status() { var fakeList = new List <ConfirmationReportViewModel>() { new ConfirmationReportViewModel { OwnerName = "wilver" } }; // Arrange IConfirmationReportWorker worker = Substitute.For <IConfirmationReportWorker>(); worker.FindAllByOwner("wilver", null).Returns(fakeList); var controller = new ConfirmationReportController(worker); // Act var actual = await controller.FindAllByOwner("wilver", null); // Assert Assert.IsAssignableFrom <OkNegotiatedContentResult <List <ConfirmationReportViewModel> > >(actual); }