Example #1
0
        public void GET_CalculateGiftAid_ReturnsCalculatedAmount()
        {
            var expected = 2.5m;

            service.CalculateGiftAidAmount(Arg.Any <decimal>()).Returns(Result.Ok <decimal>(2.5m));

            var result = controller.CalculateGiftAid(10);

            Assert.IsTrue(result is OkObjectResult);

            var okResult = result as OkObjectResult;

            Assert.AreEqual(200, okResult.StatusCode);
            Assert.AreEqual(expected, ((GiftAidResponse)okResult.Value).GiftAidAmount);

            service.Received().CalculateGiftAidAmount(Arg.Any <decimal>());
        }
Example #2
0
        public void CalculateGiftAid_CallsHandlerCalculateGiftAid_WithAmountProvided()
        {
            _controller.CalculateGiftAid(25.0);

            _handler.Verify(c => c.CalculateGiftAid(25.0), Times.Once);
        }