Exemplo n.º 1
0
        public void GetEmployees_ShouldPaginateCorrectly(int page, int pageSize, int employeeCount)
        {
            //Arrange
            _employeeRepositoryMock.Setup(e => e.GetEmployees(It.IsAny <string>())).Returns(Task.FromResult(EmployeesBuilder.GenerateEmployees(employeeCount)));

            //Act
            var paginatedEmployees = _employeeService.GetEmployees(page, pageSize, "").Result;

            //Assert
            Assert.Equal(page, paginatedEmployees.Page);
            Assert.Equal(employeeCount, paginatedEmployees.TotalCount);
            Assert.Equal(pageSize, paginatedEmployees.Employees.Count());
        }
Exemplo n.º 2
0
        public void GetEmployees_ShouldCalculateCorrectly(int employeeCount)
        {
            //Arrange
            _employeeRepositoryMock.Setup(e => e.GetEmployees(It.IsAny <string>())).Returns(Task.FromResult(EmployeesBuilder.GenerateEmployees(employeeCount)));

            //Act
            var paginatedEmployees = _employeeService.GetEmployees(1, employeeCount, "").Result;

            //Assert
            Assert.All(paginatedEmployees.Employees, e => Assert.Equal(e.AnnualSalary, CalculateAnnualSalary(e)));
        }