Пример #1
0
        public void AddChiefEmployee_ShouldReturnFalse(string login, decimal salary, decimal bonus)
        {
            //arrange
            ChiefEmployee employee = new ChiefEmployee(login, salary, bonus);

            var employeeRepositoryMock = new Mock <IEmployeeRepository>();

            employeeRepositoryMock.Setup(x
                                         => x.AddChief(It.Is <ChiefEmployee>(y
                                                                             => y == employee)));

            var service = new EmployeeService(employeeRepositoryMock.Object);
            //act
            var result = service.AddChiefEmployee(employee);

            //assert
            employeeRepositoryMock.Verify(x
                                          => x.AddChief(employee), Times.Never);
            Assert.IsFalse(result);
        }