public void ReturnViewResult_WhenIdIsCorrect() { // Arrange var mapService = new Mock <IMapService>(); var employeeService = new Mock <IEmployeeService>(); var paycheckService = new Mock <IEmployeePaycheckService>(); var payrollCalculations = new Mock <Payroll>(); var id = 5; EmployeePaycheck laborContractModel = new FakeEmployeePaycheck() { Id = id, GrossSalary = 1000, GrossFixedBonus = 100, GrossNonFixedBonus = 10, SocialSecurityIncome = 1110, PersonalInsurance = 50, }; paycheckService.Setup(x => x.GetById(id)).Returns(laborContractModel).Verifiable(); // Act var laborController = new LaborContractController(mapService.Object, employeeService.Object, paycheckService.Object, payrollCalculations.Object); // Assert Assert.IsInstanceOf <ViewResult>(laborController.Delete(id, laborContractModel)); }
public void ReturnHttpNotFoundResult_WhenEmployeeIsNull() { // Arrange var mapService = new Mock <IMapService>(); var employeeService = new Mock <IEmployeeService>(); var paycheckService = new Mock <IEmployeePaycheckService>(); var payrollCalculations = new Mock <Payroll>(); var id = 5; EmployeePaycheck laborContractModel = null; paycheckService.Setup(x => x.GetById(id)).Returns(laborContractModel).Verifiable(); // Act var laborController = new LaborContractController(mapService.Object, employeeService.Object, paycheckService.Object, payrollCalculations.Object); // Assert Assert.IsInstanceOf <HttpNotFoundResult>(laborController.Delete(id, laborContractModel)); }