Пример #1
0
        public void Should_Add_Correct_Supplement_When_Event_Type_Is_Swimming()
        {
            _eventSupplementService = new SwimmingEventGiftAidSupplementService();
            decimal giftAid      = 25m;
            decimal totalGiftAid = _eventSupplementService.AddSupplement(giftAid);

            Assert.AreEqual(25.75m, totalGiftAid);
        }
Пример #2
0
        public void Should_Add_Correct_Supplement_When_Event_Type_Is_Running()
        {
            _eventSupplementService = new RunningEventGiftAidSupplementService();
            decimal giftAid = 50m;

            decimal totalGiftAid = _eventSupplementService.AddSupplement(giftAid);

            Assert.AreEqual(52.5m, totalGiftAid);
        }
Пример #3
0
        public void Should_Add_Correct_Supplement_When_Event_Type_Is_Other()
        {
            _eventSupplementService = new OtherEventGiftAidSupplementService();
            decimal giftAid = 100m;

            decimal totalGiftAid = _eventSupplementService.AddSupplement(giftAid);

            Assert.AreEqual(100m, totalGiftAid);
        }
Пример #4
0
        static void Main(string[] args)
        {
            IGiftAidService giftAidService = Factory.CreateGiftAidService();
            ITaxRateService taxRateService = Factory.CreateTaxRateService();

            string entry = "";

            while (entry.ToLower() != "q")
            {
                Console.WriteLine("who are you?");
                Console.WriteLine(string.Join("     ", 1, "Donor"));
                Console.WriteLine(string.Join("     ", 2, "Administrator"));
                int personId = int.Parse(Console.ReadLine());
                int eventTypeId;
                switch (personId)
                {
                case 1:
                    Console.WriteLine("Please Enter donation amount:");
                    decimal donationAmount = decimal.Parse(Console.ReadLine());
                    Console.WriteLine("which event do you want to donate to? :");
                    Console.WriteLine(string.Join("     ", 1, "Running"));
                    Console.WriteLine(string.Join("     ", 2, "Swimming"));
                    Console.WriteLine(string.Join("     ", 3, "Other"));

                    eventTypeId = int.Parse(Console.ReadLine());
                    IEventGiftAidSupplementService eventGiftAidSupplement = Factory.CreateEventGiftAidSupplementService((EventType)eventTypeId);

                    ICalculateGiftAid calculateGiftAid = new CalculateGiftAid.CalculateGiftAid(eventGiftAidSupplement, giftAidService, taxRateService);
                    decimal           totalGiftAid     = calculateGiftAid.GetTotalGiftAid(donationAmount);

                    Console.WriteLine($"Your gift aid for this event is {totalGiftAid}");
                    break;

                case 2:
                    Console.WriteLine("Please New Tax Rate:");
                    decimal newTaxRate = decimal.Parse(Console.ReadLine());
                    taxRateService.SaveTaxRate(newTaxRate);
                    Console.WriteLine($"Tax Rate of {newTaxRate} has been saved:");
                    break;

                default:
                    break;
                }
                Console.WriteLine("Enter q to quit or tap space to continue: \n");
                entry = Console.ReadLine();
            }
        }
Пример #5
0
 public CalculateGiftAid(IEventGiftAidSupplementService eventGiftAidSupplementService, IGiftAidService giftAidService, ITaxRateService taxRateService)
 {
     _eventGiftAidSupplementService = eventGiftAidSupplementService;
     _giftAidService = giftAidService;
     _taxRateService = taxRateService;
 }