/// <summary> /// Plans different journeys and returns result of each in a dictionary /// </summary> /// <returns>Dictionary where key is Operation number and value is result of the operation</returns> public async Task <Dictionary <int, string> > Plan() { var townA = Map.GetTown("A"); var townB = Map.GetTown("B"); var townC = Map.GetTown("C"); var result = await Task.Run(() => { return(new Dictionary <int, string> { { 1, CalculationDistanceInPath("ABC") }, { 2, CalculationDistanceInPath("AD") }, { 3, CalculationDistanceInPath("ADC") }, { 4, CalculationDistanceInPath("AEBCD") }, { 5, CalculationDistanceInPath("AED") }, { 6, RouteFinder.FindAllRoutesBetween(townC, townC, new StopsGreaterThanRule(3)).Count().ToString() }, { 7, RouteFinder.FindAllRoutesBetween(townA, townC, new StopsGreaterThanRule(4), new StopsEqualToRule(4)).Count().ToString() }, { 8, ShortestPathFinder.FindShortestPathBetween(townA, townC).ToString() }, { 9, ShortestPathFinder.FindShortestPathBetween(townB, townB).ToString() }, { 10, RouteFinder.FindAllRoutesBetween(townC, townC, new DistanceGreaterThanRule(29)).Count().ToString() } }); }); return(result); }