Ejemplo n.º 1
0
        public void Return_zero_when_donation_amount_is_0()
        {
            const decimal donationAmount = 0.0M;

            var result = _sut.Calculate(donationAmount);

            Assert.That(result, Is.EqualTo(0));
        }
        public Task <ActionResult <GiftAidResponse> > GetGiftAid([FromQuery] GiftAidRequest model, CancellationToken cancellation)
        {
            if (!ModelState.IsValid)
            {
                var error = BuildErrorMessage();
                return(Task.FromResult <ActionResult <GiftAidResponse> >(BadRequest(error)));
            }

            cancellation.ThrowIfCancellationRequested();

            var giftAid = _calculator.Calculate(model.Amount);

            var result = new GiftAidResponse(model.Amount, giftAid);

            return(Task.FromResult <ActionResult <GiftAidResponse> >(Ok(result)));
        }