public void RunAggregatorTests() { Console.WriteLine("Available Aggregations:"); foreach (string str in DataAggregators.Aggregations) { Console.WriteLine("\t{0}", str); } Console.WriteLine("\nNoAggregator:"); NoAggregator <IncidentData> noAggTest = new NoAggregator <IncidentData>(); Dictionary <object, List <IncidentData> > noAggTestDictionary = noAggTest.GetData(Incidents); Console.WriteLine(JsonConvert.SerializeObject(noAggTestDictionary)); Console.WriteLine("\nHourOfDayAggregator:"); HourOfDayAggregator <IncidentData> hodAggTest = new HourOfDayAggregator <IncidentData>(); PropertyInfo prop = typeof(IncidentData).GetProperty("Time"); hodAggTest.Member = prop; Dictionary <object, List <IncidentData> > hodAggTestDictionary = hodAggTest.GetData(Incidents); Console.WriteLine(JsonConvert.SerializeObject(hodAggTestDictionary)); Console.WriteLine("\nDayOfWeekAggregator:"); DayOfWeekAggregator <IncidentData> dowAggTest = new DayOfWeekAggregator <IncidentData>(); dowAggTest.Member = prop; Dictionary <object, List <IncidentData> > dowAggTestDictionary = dowAggTest.GetData(Incidents); Console.WriteLine(JsonConvert.SerializeObject(dowAggTestDictionary)); Console.WriteLine("\nMonthOfYearAggregator:"); MonthOfYearAggregator <IncidentData> moyAggTest = new MonthOfYearAggregator <IncidentData>(); moyAggTest.Member = prop; Dictionary <object, List <IncidentData> > moyAggTestDictionary = moyAggTest.GetData(Incidents); Console.WriteLine(JsonConvert.SerializeObject(moyAggTestDictionary)); Console.WriteLine("\nCategoryAggregator:"); CategoryAggregator <IncidentData> catAggTest = new CategoryAggregator <IncidentData>(); catAggTest.Member = typeof(IncidentData).GetProperty("Location"); Dictionary <object, List <IncidentData> > catAggTestDictionary = catAggTest.GetData(Incidents); Console.WriteLine(JsonConvert.SerializeObject(catAggTestDictionary)); catAggTest.Categories.Add("Bethlehem"); Dictionary <object, List <IncidentData> > nerdTestDictionary = catAggTest.GetData(Incidents); Console.WriteLine(JsonConvert.SerializeObject(nerdTestDictionary)); }
public void RunComboAggregatorTest() { PropertyInfo prop = typeof(IncidentData).GetProperty("Time"); MonthOfYearAggregator <IncidentData> moyAggTest = new MonthOfYearAggregator <IncidentData>(); moyAggTest.Member = prop; CategoryAggregator <IncidentData> locAggTest = new CategoryAggregator <IncidentData>(); locAggTest.Member = typeof(IncidentData).GetProperty("Location"); // CategoryAggregator<IncidentData> codeAggTest = new CategoryAggregator<IncidentData>(); // codeAggTest.Member = typeof(IncidentData).GetProperty("Code"); List <DataAggregator <IncidentData> > aggregators = new List <DataAggregator <IncidentData> >(); aggregators.Add(locAggTest); aggregators.Add(moyAggTest); // aggregators.Add(codeAggTest); Dictionary <object, object> dictionary = DataAggregator <IncidentData> .GetData(aggregators, Incidents); Console.WriteLine(JsonConvert.SerializeObject(dictionary)); }