public void TestLoadAndRunDynamicClassicImpl() { var cities = new Cities(); cities.ReadCities(CitiesTestFile); ILinks links = LinksFactory.Create(cities, "Fhnw.Ecnf.RoutePlanner.RoutePlannerLib.Links"); links.ReadLinks(LinksTestFile); Assert.AreEqual(28, cities.Count); // test available cities List <Link> resultLinks = links.FindShortestRouteBetween("Zürich", "Basel", TransportMode.Rail); var expectedLinks = new List <Link>(); expectedLinks.Add(new Link(new City("Zürich", "Switzerland", 7000, 1, 2), new City("Aarau", "Switzerland", 7000, 1, 2), 0)); expectedLinks.Add(new Link(new City("Aarau", "Switzerland", 7000, 1, 2), new City("Liestal", "Switzerland", 7000, 1, 2), 0)); expectedLinks.Add(new Link(new City("Liestal", "Switzerland", 7000, 1, 2), new City("Basel", "Switzerland", 7000, 1, 2), 0)); Assert.IsNotNull(resultLinks); Assert.AreEqual(expectedLinks.Count, resultLinks.Count); for (int i = 0; i < resultLinks.Count; i++) { Assert.IsTrue( (expectedLinks[i].FromCity.Name == resultLinks[i].FromCity.Name && expectedLinks[i].ToCity.Name == resultLinks[i].ToCity.Name) || (expectedLinks[i].FromCity.Name == resultLinks[i].ToCity.Name && expectedLinks[i].ToCity.Name == resultLinks[i].FromCity.Name)); } try { resultLinks = links.FindShortestRouteBetween("doesNotExist", "either", TransportMode.Rail); Assert.Fail("Should throw a KeyNotFoundException"); } catch (KeyNotFoundException) { } }