public void CalculateGiftAidReturnCorrectGiftAid(decimal donationAmount, decimal expectedValue) { // Act var result = _giftAidService.Calculate(donationAmount); // Assert Assert.Equal(result, expectedValue); }
public ActionResult GetGiftAid([FromQuery] GiftAidRequest giftAidRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (giftAidRequest is null) { return(BadRequest("Invalid donation")); } var calculatedGiftAidAmount = _giftAidService.Calculate(giftAidRequest.Amount); var giftAidResponse = new GiftAidResponse { DonationAmount = giftAidRequest.Amount, GiftAidAmount = calculatedGiftAidAmount }; return(Ok(giftAidResponse)); }