Example #1
0
        public void GetGiftAidReturnsOkResult()
        {
            // Arrange
            var request = new GiftAidRequest {
                Amount = 300
            };

            // Act
            var createdResponse = _giftAidController.GetGiftAid(request);

            // Assert
            Assert.IsType <OkObjectResult>(createdResponse);
        }
Example #2
0
        public async Task GivenDonation_ThenCalculatesGiftAid(string eventType, Decimal giftAidValue)
        {
            _mockGiftAidService.Setup(x => x.CalculateGiftAid(100, "UK", eventType))
            .Returns(Task.FromResult(giftAidValue));

            _mockRequestValidator.Setup(x => x.Validate(100, "UK", eventType))
            .Returns(Task.FromResult(new List <ErrorResponse>()));

            var giftAid = (NegotiatedContentResult <GiftAidResponse>) await _giftAidController.GetGiftAid(100, "UK", eventType);

            giftAid.Content.GiftAidAmount.ShouldBe(giftAidValue);
        }
        public async Task GET_Should_return_OK()
        {
            const decimal donationAmount = 100M;

            var actual = await _sut.GetGiftAid(MakeGiftAidRequest(donationAmount), CancellationToken.None);

            Assert.That(actual?.Result, Is.InstanceOf <OkObjectResult>());
        }
        public async Task WhenIMakeTheDonation()
        {
            SetupGiftAidController();

            _result = (NegotiatedContentResult <GiftAidResponse>) await _giftAidController.GetGiftAid(_donation, _country, _event);
        }