Ejemplo n.º 1
0
        public void GiftAidCalculationService_NegativeAmount()
        {
            double donationAmount = -1;

            var ex = Assert.Throws<InvalidOperationException>(() => calculationService.CalculateGiftAmount(donationAmount));

            Assert.Equal("Amount can't be negative value", ex.Message);

        }
Ejemplo n.º 2
0
        public GiftAidDeclarationResponse PrepareDeclaration(double donationAmount)
        {
            var response = new GiftAidDeclarationResponse();

            response.GiftAidAmount = _aidCalculationService.CalculateGiftAmount(donationAmount);

            response.DeclarationId = Guid.NewGuid();

            return(response);
        }
Ejemplo n.º 3
0
        public IActionResult Get(double number)
        {
            var giftAidResponse = new GiftAidResponse();

            if (number > 0)
            {
                giftAidResponse.DonationAmount = number;
                giftAidResponse.GiftAidAmount  = _aidCalculationService.CalculateGiftAmount(number);
            }
            return(Ok(giftAidResponse));
        }