예제 #1
0
        public void ReturnViewResult_WhenIdIsCorrect()
        {
            // Arrange
            var mapService          = new Mock <IMapService>();
            var employeeService     = new Mock <IEmployeeService>();
            var billService         = new Mock <IRemunerationBillService>();
            var payrollCalculations = new Mock <Payroll>();

            var id = 5;
            RemunerationBill nonLaborContractModel = new FakeRemunerationBill()
            {
                Id                   = id,
                GrossSalary          = 1000,
                SocialSecurityIncome = 1110,
                PersonalInsurance    = 50,
            };

            billService.Setup(x => x.GetById(id)).Returns(nonLaborContractModel).Verifiable();

            // Act
            var nonLaborController = new NonLaborContractController(mapService.Object, employeeService.Object, billService.Object, payrollCalculations.Object);

            // Assert
            Assert.IsInstanceOf <ViewResult>(nonLaborController.Delete(id, nonLaborContractModel));
        }
예제 #2
0
        public void ReturnHttpNotFoundResult_WhenEmployeeIsNull()
        {
            // Arrange
            var mapService          = new Mock <IMapService>();
            var employeeService     = new Mock <IEmployeeService>();
            var billService         = new Mock <IRemunerationBillService>();
            var payrollCalculations = new Mock <Payroll>();

            var id = 5;
            RemunerationBill nonLaborContractModel = null;

            billService.Setup(x => x.GetById(id)).Returns(nonLaborContractModel).Verifiable();

            // Act
            var nonLaborController = new NonLaborContractController(mapService.Object, employeeService.Object, billService.Object, payrollCalculations.Object);

            // Assert
            Assert.IsInstanceOf <HttpNotFoundResult>(nonLaborController.Delete(id, nonLaborContractModel));
        }