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); }
private void redeemPointsToolStripMenuItem_Click(object sender, EventArgs e) { RedeemPoints rp = new RedeemPoints(); rp.Show(); }
public async Task <IActionResult> Redeem([FromBody] RedeemPoints command) { var commandResult = await _mediator.Send(command); return(commandResult ? Ok() : (IActionResult)BadRequest()); }