public ConnectedRoute FindShortestRoute(string origin, string destination)
        {
            Validator.Validate(origin, destination);

            Airport originAirport      = _repository.List <Airport>().FirstOrDefault(a => a.Iata == origin);
            Airport destinationAirport = _repository.List <Airport>().FirstOrDefault(a => a.Iata == destination);

            Validator.Validate(originAirport, destinationAirport);

            List <Route>        routes        = _repository.List <Route>(r => r.Airline, r => r.Origin, r => r.Destination);
            ShortestRouteFinder routeFinder   = new ShortestRouteFinder(originAirport, destinationAirport, routes);
            ConnectedRoute      shortestRoute = routeFinder.FindShortestRoute();

            return(shortestRoute);
        }
        public void Should_Return_Shortest_Route_From_All_Given_Paths()
        {
            // Arrange
            var routeOne = new Route()
            {
                Paths = new List <Path>
                {
                    new Path {
                        Id = 1, PointOne = this.pointA, PointTwo = this.pointD, Distance = 20
                    }
                }
            };

            var routeTwo = new Route()
            {
                Paths = new List <Path>
                {
                    new Path {
                        Id = 2, PointOne = this.pointA, PointTwo = this.pointB, Distance = 4
                    },
                    new Path {
                        Id = 3, PointOne = this.pointB, PointTwo = this.pointD, Distance = 5
                    },
                }
            };

            var possibleRoutes = new List <Route>
            {
                routeOne,
                routeTwo
            };

            var sut = new ShortestRouteFinder();

            // Act
            var result = sut.GetShortestRoute(possibleRoutes);

            // Assert

            result.TotalDistance.Should().Be(9);
            result.Should().BeEquivalentTo(routeTwo);
        }