public async Task Should_calculate_income_for_account() { var command = new CalculateIncomeCommand { ForDate = new DateTime(2021, 01, 01), InterestRate = 2.3 }; var content = new StringContent(command.AsJson(), Encoding.UTF8, "application/json"); var response = await _httpClient.PutAsync("/api/account/calculateIncome", content); response.StatusCode.Should().Be(HttpStatusCode.Accepted); var getResponse = await _httpClient.GetAsync("/api/account/1001/statement"); var account = await getResponse.Content.ReadFromJsonAsync <AccountDto>(); account.Statements.Should().HaveCount(1); }
public IActionResult CalculateIncome([FromBody] CalculateIncomeCommand command) { _mediator.Send(command); return(Accepted()); }