public static Passenger Searching(Routing path, Car myCar, List <Passenger> passengers, Passenger nearestPassenger) { Console.WriteLine("-------Utas keresése--------"); int nearestPassangerDistance = path.FindRoute(myCar.Position.PosX, myCar.Position.PosY, passengers[0].Position.PosX, passengers[0].Position.PosY, myCar).ToPositions().Count; nearestPassenger = passengers[0]; for (int i = 1; i < passengers.Count; i++) { int passangerDistance = path.FindRoute(myCar.Position.PosX, myCar.Position.PosY, passengers[i].Position.PosX, passengers[i].Position.PosY, myCar).ToPositions().Count; if (nearestPassangerDistance > passangerDistance && nearestPassangerDistance != 2) { nearestPassenger = passengers[i]; } } return(nearestPassenger); }
public void FindRoute_ThrowsAnExcpetionWhenNotRoutesMatched() { var routing = new Routing(); routing.RegisterRoute(_simpleRoute); var matchedRoute = routing.FindRoute("ls", new Dictionary<string, string>() { { "path", @"c:\temp\" } }); }
public void FindRoute_CanFindASimpleRoute() { var routing = new Routing(); routing.RegisterRoute(_simpleRoute); var matchedRoute = routing.FindRoute("ls", new Dictionary<string, string>()); Assert.AreEqual(_simpleRoute, matchedRoute); }
public void FindRoute_CanFindASimpleRoute() { var routing = new Routing(); routing.RegisterRoute(_simpleRoute); var matchedRoute = routing.FindRoute("ls", new Dictionary <string, string>()); Assert.AreEqual(_simpleRoute, matchedRoute); }
public void FindRoute_CanFindARouteWithDashInName() { var routing = new Routing(); routing.RegisterRoute("import-keys", new Dictionary<string, ParameterType>() { { "path", ParameterType.Required } }, (p, c, s) => { }, ""); var matchedRoute = routing.FindRoute("import-keys", new Dictionary<string, string>() { { "path", @"c:\temp\" } }); Assert.AreEqual("import-keys", matchedRoute.Name); }
public void FindRoute_ThrowsAnExcpetionWhenNotRoutesMatched() { var routing = new Routing(); routing.RegisterRoute(_simpleRoute); var matchedRoute = routing.FindRoute("ls", new Dictionary <string, string>() { { "path", @"c:\temp\" } }); }
public void FindRoute_CanFindARouteWithARequiredParam() { var routing = new Routing(); routing.RegisterRoute(_simpleRoute); routing.RegisterRoute(_singleParamRoute); var matchedRoute = routing.FindRoute("ls", new Dictionary<string, string>() { { "path", @"c:\temp\" } }); Assert.AreEqual(_singleParamRoute, matchedRoute); }
public void FindRoute_CanFindARouteWithARequiredParam() { var routing = new Routing(); routing.RegisterRoute(_simpleRoute); routing.RegisterRoute(_singleParamRoute); var matchedRoute = routing.FindRoute("ls", new Dictionary <string, string>() { { "path", @"c:\temp\" } }); Assert.AreEqual(_singleParamRoute, matchedRoute); }
public void FindRoute_CanFindARouteWithDashInName() { var routing = new Routing(); routing.RegisterRoute("import-keys", new Dictionary <string, ParameterType>() { { "path", ParameterType.Required } }, (p, c, s) => { }, ""); var matchedRoute = routing.FindRoute("import-keys", new Dictionary <string, string>() { { "path", @"c:\temp\" } }); Assert.AreEqual("import-keys", matchedRoute.Name); }