예제 #1
0
        private static void DoStraightRoutes(Graph graph, List<IResponse> responses)
        {
            var routeFinder = new RouteFinder(graph);

            responses.Add(routeFinder.FindRoute(new RouteRequest('A', 'B', 'C')));
            responses.Add(routeFinder.FindRoute(new RouteRequest('A', 'D')));
            responses.Add(routeFinder.FindRoute(new RouteRequest('A', 'D', 'C')));
            responses.Add(routeFinder.FindRoute(new RouteRequest('A', 'E', 'B', 'C', 'D')));
            responses.Add(routeFinder.FindRoute(new RouteRequest('A', 'E', 'D')));
        }
        public void WhatIsTheDistance_ForRoute_AtoEtoBtoCtoD(string graphInput, int expectation)
        {
            //arrange
            var graph = new Graph(graphInput);

            //act
            var foundRoute = new RouteFinder(graph).FindRoute(new RouteRequest('A', 'E', 'B', 'C', 'D'));

            //assert
            Assert.That(foundRoute.GetResponse(), Is.EqualTo(expectation.ToString()));
        }