Ejemplo n.º 1
0
        private static void Main()
        {
            // create a test list of tunnel locations
            var tunnelList = new List <Tunnel>
            {
                new Tunnel
                {
                    Location = new Location
                    {
                        Latitude  = 1,
                        Longitude = 6,
                    },
                    Length = 2,
                },
                new Tunnel
                {
                    Location = new Location
                    {
                        Latitude  = 7,
                        Longitude = 3,
                    },
                    Length = 8,
                },
                new Tunnel
                {
                    Location = new Location
                    {
                        Latitude  = 4,
                        Longitude = 1,
                    },
                    Length = 3,
                },
            };

            var startLocation = new Location {
                Latitude = 7, Longitude = 2
            };
            var endLocation = new Location {
                Latitude = 1, Longitude = 8
            };

            var minimumDistance = DistanceHelpers.CalculateShortestPathTotal(startLocation, endLocation, tunnelList);
        }
Ejemplo n.º 2
0
        public void CanGetShortestPath(Location startLocation, Location endLocation, List <Tunnel> tunnelList, int expected)
        {
            var result = DistanceHelpers.CalculateShortestPathTotal(startLocation, endLocation, tunnelList);

            Assert.Equal(expected, result);
        }