Пример #1
0
        public async Task CreateWalletShouldCallCreateInDalOnce()
        {
            //Arrange
            WalletDTO walletDTO = new WalletDTO
            {
                Description = "Description",
                Balance     = 100
            };
            var            mockMapper     = new Mock <IMapper>();
            var            mockRepository = new Mock <IWalletRepository>();
            IWalletService service        = new WalletService(mockRepository.Object, mockMapper.Object);

            mockRepository.Setup(x => x.CreateAsync(It.IsAny <Wallet>())).ReturnsAsync(It.IsAny <Wallet>());

            //Act
            await service.CreateAsync(walletDTO);

            //Assert
            mockRepository.Verify(x => x.CreateAsync(It.IsAny <Wallet>()), Times.Once);
        }