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