public async Task Handle_returns_false_if_wallet_does_not_exist() { var redeemPointsCommand = new RedeemPoints(It.IsAny <int>(), It.IsAny <int>()); _walletRepositoryMock.Setup(walletRepo => walletRepo.GetAsync(It.IsAny <int>())) .ReturnsAsync(default(Wallet)); var handler = new RedeemPointsHandler(_walletRepositoryMock.Object); var cancellationToken = new CancellationToken(); var result = await handler.Handle(redeemPointsCommand, cancellationToken); Assert.False(result); }
public async Task Handle_returns_true_if_wallet_is_persisted() { var redeemPointsCommand = new RedeemPoints(It.IsAny <int>(), It.IsAny <int>()); _walletRepositoryMock.Setup(walletRepo => walletRepo.GetAsync(It.IsAny <int>())) .ReturnsAsync(FakeWallet()); _walletRepositoryMock.Setup(walletRepo => walletRepo.UnitOfWork.SaveEntitiesAsync(default(CancellationToken))) .Returns(Task.FromResult(true)); var handler = new RedeemPointsHandler(_walletRepositoryMock.Object); var cancellationToken = new CancellationToken(); var result = await handler.Handle(redeemPointsCommand, cancellationToken); Assert.True(result); }