public void GetPracticeCountByRegion_ValidRegionGiven_CorrectCountReturned() { PracticesService = new PracticesService(PracticesReader.Object, PostcodesReader.Object); int result = PracticesService.GetPracticeCountByRegion(Region.London); Assert.AreEqual(result, 1); }
public void GetPracticeCountByRegion_RegionHasNoPractices_ZeroReturned() { PracticesService = new PracticesService(PracticesReader.Object, PostcodesReader.Object); int result = PracticesService.GetPracticeCountByRegion(Region.SouthEast); Assert.AreEqual(result, 0); }
private static void Process(PracticesService practicesService, PrescriptionsService prescriptionService) { // Find out how many practices there are in London Console.WriteLine("How many practices are in London?"); int practicesInLondon = practicesService.GetPracticeCountByRegion(Region.London); Console.WriteLine(practicesInLondon); // Find out the average national cost of a peppermint oil prescription Console.WriteLine("What was the average actual cost of all peppermint oil prescriptions?"); decimal averagePepermintOilCost = prescriptionService.GetAverageActCost("0102000T0"); Console.WriteLine(averagePepermintOilCost.ToString("£0.00")); // Find the 5 highest spending postcodes Console.WriteLine("Which 5 post codes have the highest actual spend, and how much did each spend in total?"); // Get postcode spends var totalPostcodeSpends = prescriptionService.GetTotalSpendPerPostcode(); // Get top 5 var topFive = totalPostcodeSpends.OrderByDescending(p => p.Value).Take(5).ToList(); // Write to console topFive.ForEach(p => Console.WriteLine(p.Key + " " + p.Value.ToString("£0.00"))); // Find average price of Flucloxacillin Console.WriteLine( "For each region, what was the average price per prescription of Flucloxacillin," + " and how did this vary from the national mean?"); // Get average cost per region var averageFlucloxacillinRegions = prescriptionService.GetAverageActCostPerRegion("0501012G0"); // Get average cost for country decimal averageFlucloxacillinNational = prescriptionService.GetAverageActCost("0501012G0"); // Write to console Console.WriteLine("National: " + averageFlucloxacillinNational.ToString("£0.00")); averageFlucloxacillinRegions.ForEach( r => Console.WriteLine( r.Key + " " + r.Value.ToString("£0.00") + "; " + (r.Value - averageFlucloxacillinNational).ToString("£0.00"))); // Find by region the percentage difference between the NIC and Act Cost for Console.WriteLine( "For each region for Simeticone, what was the average Actual Cost " + "as a percentage of the average Net Ingredient Cost?"); var actPercentageOfNic = prescriptionService.GetFractionActCostOfNicByRegion("0103050E0"); actPercentageOfNic.ForEach(r => Console.WriteLine(r.Key + " " + r.Value.ToString("0.00%"))); Console.ReadLine(); }