public async Task set_overdraft_limit_command_should_thorw_excption_if_set_negativeAsync() { #region Arrange var accountId = Guid.Parse("1805FB93-2A90-4C9C-B286-EE9A62A94212"); Account account = GetAccount(); var repo = new Mock <Myrepo.IRepository>(); repo.Setup(x => x.GetById <Account>(It.IsAny <Guid>())).Returns(Task.FromResult(account)); CommandHandler commandHandler = new CommandHandler(repo.Object); #endregion SetOverdraftLimitCommand SetOverdraftLimit = new SetOverdraftLimitCommand(accountId, -100); await Assert.ThrowsAsync <InvalidOperationException>(() => commandHandler.Handle(SetOverdraftLimit)); }
public async Task Handle(SetOverdraftLimitCommand cmd) { await Execute(cmd.AccountId, (accout) => accout.SetOverdraftLimit(cmd.Amount)); }