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); }
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); }
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); }
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(); } }
public CalculateGiftAid(IEventGiftAidSupplementService eventGiftAidSupplementService, IGiftAidService giftAidService, ITaxRateService taxRateService) { _eventGiftAidSupplementService = eventGiftAidSupplementService; _giftAidService = giftAidService; _taxRateService = taxRateService; }