public ActionResult Index(RouteViewModel model)
        {
            ViewBag.Message = "Ticket To Ride Route Analyzer.";
            model.StartCities = Enum.GetValues(typeof(City)).Cast<City>().ToList();
            model.EndCities = Enum.GetValues(typeof(City)).Cast<City>().ToList();
            model.RouteCities = new List<Segment>();

            model.MapHtml = Maps.GetBingHtml(key: "AjK_c-a0hYILuxmGiLjmJkossrnxKovOyzS6Q1tRu6R-T-ikma9tvJmkL5Vn5OJD", location: "North America", width: "600px", height: "800px")
                    .ToString()
                    .Replace("<text>", "")
                    .Replace("</text>", "")
                    .Replace("if (useAdaptiveOverlay) {", "")
                    .Replace("callback: function () {", "callback: function () { if (typeof(useAdaptiveOverlay) != '') { ")
                    .Replace("load(function() {", "load(function() { {");

            if (!string.IsNullOrWhiteSpace(model.StartCity) && !string.IsNullOrWhiteSpace(model.EndCity))
            {
                var pathManager = new PathManager();
                var startCity = (City)Enum.Parse(typeof(City), model.StartCity);
                var endCity = (City)Enum.Parse(typeof(City), model.EndCity);
                var route = pathManager.GetRoute(startCity, endCity);

                if (route.Any())
                {
                    foreach (var r in route)
                    {
                        model.RouteCities.Add(r);
                    }

                    model.routeCost = pathManager.BestCost;
                }
            }

            return View(model);
        }
        public void FindRouteCostCalgaryToLosAngeles()
        {
            var pathManager = new PathManager();

            var startCity = City.Calgary;
            var endCity = City.LosAngeles;
            var expected = 12;

            var route = pathManager.GetRoute(startCity, endCity);
            var actual = pathManager.BestCost;

            Console.WriteLine("Cost of Route from {0} to {1} is {2}", startCity, endCity, actual);

            Assert.AreEqual(expected, actual);
        }
        public void FindRouteCalgaryToLosAngeles()
        {
            var pathManager = new PathManager();

            var startCity = City.Calgary;
            var endCity = City.LosAngeles;

            var route = pathManager.GetRoute(startCity, endCity);

            Console.WriteLine("Route from {0} to {1} is as follows:", startCity, endCity);

            if (route != null && route.Any())
            {
                foreach (var segment in route)
                {
                    Console.WriteLine("{0} - {1} ({2} Trains)", segment.StartCity, segment.EndCity, segment.NumberOfTrains);
                }
            }
            else
            {
                Console.WriteLine("Route not found");
            }
        }
        public void VerifyRouteManagerRoutesPopulated()
        {
            var pathManager = new PathManager();

            Assert.IsNotNull(pathManager.Path);
        }
        public void VerifyPathManagerIsNotNull()
        {
            var pathManager = new PathManager();

            Assert.IsNotNull(pathManager);
        }