public GiftAidCalculatorUnitTests(Setup setup) { _serviceProvider = setup.ServiceProvider; _giftAidOptions = _serviceProvider.GetRequiredService <IOptions <GiftAidSetup> >(); _giftAidService = new GiftAidCalculatorService(); _giftAidService.ConfigureGiftAidService(_giftAidOptions.Value); }
public GiftAidControllerUnitTests(Setup setup) { _serviceProvider = setup.ServiceProvider; _giftAidService = new GiftAidCalculatorService(); _donationService = new DonationServiceFake(); _giftAidOptions = _serviceProvider.GetRequiredService <IOptions <GiftAidSetup> >(); _giftAidController = new GiftAidController(_giftAidOptions, _giftAidService, _donationService); }
public StoryThreeTests() { var mock = new Mock <ITaxRateDataStore>(); mock.Setup(framework => framework.GetGiftAidRate()).Returns(19); _giftAidService = new GiftAidService(mock.Object); }
public GiftAidController(IOptions <GiftAidSetup> giftAidOptions, IGiftAidService giftAidService, IDonationService donationService) { _giftAidOptions = giftAidOptions.Value; _giftAidService = giftAidService; _donationService = donationService; //Setup GiftAid object based on the saved configuration values GiftAidSetup(); }
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 GiftAidRateController(IGiftAidService giftAidService) { _giftAidService = giftAidService; }
public StoryTwoTests() { _giftAidService = new GiftAidService(new TaxRateDataStoreStub()); }
public GiftAidControllerMust() { _giftAidService = new GiftAidService(TAX_RATE); _giftAidController = new GiftAidController(_giftAidService); }
public CalculateGiftAid(IEventGiftAidSupplementService eventGiftAidSupplementService, IGiftAidService giftAidService, ITaxRateService taxRateService) { _eventGiftAidSupplementService = eventGiftAidSupplementService; _giftAidService = giftAidService; _taxRateService = taxRateService; }
public GiftAidMust() { _giftAidService = new GiftAidService(TAX_RATE); }