Ejemplo n.º 1
0
        public async Task CardsService_DeleteByIdAsync_DeletesCard(int cardId)
        {
            var mockUnitOfWork = new Mock <IUnitOfWork>();

            mockUnitOfWork.Setup(m => m.CardRepository.DeleteByIdAsync(It.IsAny <int>()));
            ICardService cardService = new CardService(mockUnitOfWork.Object, UnitTestHelper.CreateMapperProfile());

            await cardService.DeleteByIdAsync(cardId);

            mockUnitOfWork.Verify(x => x.CardRepository.DeleteByIdAsync(cardId), Times.Once);
            mockUnitOfWork.Verify(x => x.SaveAsync(), Times.Once);
        }