public IActionResult PostAccountEvent([FromBody] AccountOperator account) { try { return(Created(nameof(PostAccountEvent), endpointHandler.EventsHandler(account))); } catch (Exception) { return(NotFound(0)); } }
public void EventsHandlerWithdraw_ShouldFailed() { //Arrange var accountOperator = new AccountOperator() { Origin = "1", Type = "withdraw", Amount = 100 }; const int initialBalance = 50; var account = new Account(1, initialBalance); _dao.Setup(_ => _.Search(int.Parse(accountOperator.Origin))).Returns(account); //Act var obj = _endpointHandler.EventsHandler(accountOperator); //Assert var origin = obj.GetType().GetProperty("origin").GetValue(obj); var balance = (double)origin.GetType().GetProperty("balance").GetValue(origin); Assert.IsFalse(account.Balance == (initialBalance - accountOperator.Amount)); }