public void ReturnHttpNotFoundResult_WhenEmployeeIsNull() { // Arrange var mockedMapService = new Mock <IMapService>(); var employeePaycheckService = new Mock <IEmployeePaycheckService>(); var mockedPagerFactory = new Mock <IPagerFactory>(); PaychecksController paycheckController = new PaychecksController(mockedMapService.Object, mockedPagerFactory.Object, employeePaycheckService.Object); var id = 10; EmployeePaycheck paycheck = null; employeePaycheckService.Setup(x => x.GetById(id)).Returns(paycheck); // Act & Assert Assert.IsInstanceOf <HttpNotFoundResult>(paycheckController.Delete(id, paycheck)); }
public void ReturnViewResult_WhenIdIsCorrect() { // Arrange var mockedMapService = new Mock <IMapService>(); var employeePaycheckService = new Mock <IEmployeePaycheckService>(); var mockedPagerFactory = new Mock <IPagerFactory>(); PaychecksController paycheckController = new PaychecksController(mockedMapService.Object, mockedPagerFactory.Object, employeePaycheckService.Object); var id = 15; employeePaycheckService.Setup(x => x.GetById(id)).Returns(new EmployeePaycheck() { Id = id }); // Act & Assert Assert.IsInstanceOf <ViewResult>(paycheckController.Delete(id, new EmployeePaycheck() { Id = id })); }