public async Task Handle_returns_true_if_wallet_is_persisted() { var createWalletCommand = new CreateWallet(It.IsAny <string>()); _walletRepositoryMock.Setup(walletRepo => walletRepo.UnitOfWork.SaveEntitiesAsync(default(CancellationToken))) .Returns(Task.FromResult(true)); var handler = new CreateWalletHandler(_mediator.Object, _walletRepositoryMock.Object); var cancellationToken = new CancellationToken(); var result = await handler.Handle(createWalletCommand, cancellationToken); Assert.True(result); }
public async Task Create_Wallet_Handler() { var request = new CreateWallet { Name = "Name", Moneys = new[] { new MoneyModel { Amount = 120M, CurrencyCode = "USD" } }, OwnerId = Guid.NewGuid().ToString() }; var handler = new CreateWalletHandler(_context); var response = await handler.Handle(request, CancellationToken.None); Assert.True(Guid.TryParse(response.ToString(), out _)); }