public async Task LotService_DeleteByIdAsync_DeletesLot() { var mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork.Setup(m => m.LotRepository.DeleteByIdAsync(It.IsAny <int>())); mockUnitOfWork.Setup(m => m.CarRepository.DeleteByIdAsync(It.IsAny <int>())); var lotService = new LotService(mockUnitOfWork.Object, UnitTestHelper.CreateMapperProfile()); var id = 1; var result = await lotService.DeleteByIdAsync(id); Assert.IsTrue(result.Succedeed); mockUnitOfWork.Verify( m => m.LotRepository.DeleteByIdAsync(id), Times.Once); mockUnitOfWork.Verify( m => m.CarRepository.DeleteByIdAsync(id), Times.Once); mockUnitOfWork.Verify( m => m.SaveAsync(), Times.Once); }