Esempio n. 1
0
        public void AddSalary()
        {
            //Arrange
            var salary = new Salary()
            {
                Basic      = 5000_00,
                Bonus      = 0,
                Incentives = 2000_00
            };

            _repositoryFactoryMock = new Mock <IRepositoryFactory>();
            _actionFactoryMock     = new Mock <IActionFactory>();
            HelperSer = new Mock <HelperSer>();

            _repositoryFactoryMock.Setup(repo => repo.GetRepository <Salary>().Create(It.IsAny <Salary>()))
            .Returns(salary);

            //Act
            SalaryService = new SalaryService(_actionFactoryMock.Object, _repositoryFactoryMock.Object, HelperSer.Object);
            SalaryService.AddSalary(salary);

            //Assert
            _repositoryFactoryMock.Verify(repo => repo.GetRepository <Salary>().Create(salary), Times.Once);
        }