Exemple #1
0
        public void ValidateRoute_EqualSourceAndDestination_ThrowsException()
        {
            var graph      = new Graph <char>();
            var routeModel = new RouteModel {
                Source = 'A', Destination = 'A', Distance = 5
            };
            var routeValidator = new RouteValidator();

            routeValidator.ValidateRoute(routeModel, graph);
        }
Exemple #2
0
        public void ValidateRoute_InvalidDistanceInputRange_ThrowsException(int distance)
        {
            var graph      = new Graph <char>();
            var routeModel = new RouteModel {
                Source = 'A', Destination = 'B', Distance = distance
            };
            var routeValidator = new RouteValidator();

            routeValidator.ValidateRoute(routeModel, graph);
        }
Exemple #3
0
        public void ValidateRoute_InvalidSourceInput_ThrowsException()
        {
            var graph      = new Graph <char>();
            var routeModel = new RouteModel {
                Source = '7', Destination = 'B', Distance = 5
            };
            var routeValidator = new RouteValidator();

            routeValidator.ValidateRoute(routeModel, graph);
        }
Exemple #4
0
        public void ValidateRoute_RepeatedRoute_ThrowsException()
        {
            var graphBuilder = new DirectedGraphBuilder <char>();
            var routeModel   = new RouteModel {
                Source = 'A', Destination = 'B', Distance = 5
            };

            graphBuilder.AddEdge(routeModel.Source, routeModel.Destination, routeModel.Distance);

            var routeValidator = new RouteValidator();

            routeValidator.ValidateRoute(routeModel, graphBuilder.GetGraph());
        }