Ejemplo n.º 1
0
        public async Task Given_Progressive_Bracket_Expect_Sum_Of_Tax(decimal annualIncome, string code, decimal totalTax)
        {
            // ARRANGE
            var command = new CalculationsCreateCommand {
                AnnualIncome = annualIncome, PostalCode = code
            };

            // ACT
            var response = await _client.PostAsJsonAsync(PathBuilder("calculations"), command);

            var result = response.Content.Deserialize <CalculationsCreateResponse>().Result;

            // ASSERT
            StringAssert.AreEqualIgnoringCase(code, result.PostalCode);
            Assert.That(result.AnnualIncome, Is.EqualTo(annualIncome));
            Assert.That(result.TotalTax, Is.EqualTo(totalTax));
        }
Ejemplo n.º 2
0
        public async Task Given_FlatRate_Expect_Seventeen_Point_Five_Percent_Tax()
        {
            // ARRANGE
            const string code         = "7000";
            decimal      annualIncome = 10000;
            var          command      = new CalculationsCreateCommand {
                AnnualIncome = annualIncome, PostalCode = code
            };

            // ACT
            var response = await _client.PostAsJsonAsync(PathBuilder("calculations"), command);

            var result = response.Content.Deserialize <CalculationsCreateResponse>().Result;

            // ASSERT
            StringAssert.AreEqualIgnoringCase(code, result.PostalCode);
            Assert.That(result.AnnualIncome, Is.EqualTo(annualIncome));
            Assert.That(result.TotalTax, Is.EqualTo(1750));
        }
        public async Task <IActionResult> CreateCalculation([FromBody] CalculationsCreateCommand command)
        {
            var result = await _mediator.Send(command);

            return(Ok(result));
        }