Пример #1
0
        public async void DeleteEmployeeAsync_ShouldCallDeleteEmployee()
        {
            // Arrange
            var employee = new Employee
            {
                Id        = 23,
                FirstName = "John",
                LastName  = "Dou",
                MediaInteractivaEmployee = true,
                Pet = new Pet {
                    Id = 73, Name = "Dick", Type = "duck", OwnerId = 23
                }
            };

            var employeesRepoMock = new Mock <IBaseRepository <Employee> >();

            employeesRepoMock.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(employee);

            var employeesService = new EmployeesService(employeesRepoMock.Object);

            // Act
            await employeesService.DeleteEmployeeAsync(employee.Id);

            // Assert
            employeesRepoMock.Verify(x => x.DeleteAsync(employee.Id), Times.Once);
        }