Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ServiceProvider serviceProvider = Setup();

            if (args.Length != 1)
            {
                throw new Exception("A solução deve receber somente um parametro, com o caminho para o arquivo de input");
            }

            String pathFile = args[0];

            IValidationBusiness  validationBusiness = serviceProvider.GetService <IValidationBusiness>();
            ITravelPathBusiness  travelPathBusiness = serviceProvider.GetService <ITravelPathBusiness>();
            IAirportBusiness     airportBusiness    = serviceProvider.GetService <IAirportBusiness>();
            IReadDestinationFile fileReader         = serviceProvider.GetService <IReadDestinationFile>();

            airportBusiness.Initialize(pathFile, fileReader);

            while (true)
            {
                Console.WriteLine("Por favor, entre a rota no formato AAA-BBB:");
                String strLine = Console.ReadLine();
                validationBusiness.ValidateInput(strLine, airportBusiness.GetAirportList());
                TravelPath path = travelPathBusiness.FindBestPath(strLine, airportBusiness.GetAirportList());
                Console.WriteLine(travelPathBusiness.GenerateOutput(path));
            }
        }
Ejemplo n.º 2
0
 public BexsTestController(IWriteDestinationFile writer, ITravelPathBusiness travelPathBusiness, IAirportBusiness airportBusiness, IReadDestinationFile fileReader, IConfiguration configuration)
 {
     this.airportBusiness    = airportBusiness;
     this.fileReader         = fileReader;
     this.configuration      = configuration;
     this.travelPathBusiness = travelPathBusiness;
     this.fileWriter         = writer;
 }
Ejemplo n.º 3
0
        public void TestOutput()
        {
            ServiceProvider serviceProvider = Setup();

            ITravelPathBusiness  travelPathBusiness = serviceProvider.GetService <ITravelPathBusiness>();
            IAirportBusiness     airportBusiness    = serviceProvider.GetService <IAirportBusiness>();
            IReadDestinationFile fileReader         = serviceProvider.GetService <IReadDestinationFile>();

            airportBusiness.Initialize("", fileReader);

            TravelPath test1 = travelPathBusiness.FindBestPath("A-B", airportBusiness.GetAirportList());

            Assert.AreEqual("Caminho A -> 0 B -> 10 Custo Total - 10", travelPathBusiness.GenerateOutput(test1));
        }
Ejemplo n.º 4
0
        public void TestPaths()
        {
            ServiceProvider serviceProvider = Setup();


            ITravelPathBusiness  travelPathBusiness = serviceProvider.GetService <ITravelPathBusiness>();
            IAirportBusiness     airportBusiness    = serviceProvider.GetService <IAirportBusiness>();
            IReadDestinationFile fileReader         = serviceProvider.GetService <IReadDestinationFile>();

            airportBusiness.Initialize("", fileReader);

            TravelPath test1 = travelPathBusiness.FindBestPath("A-B", airportBusiness.GetAirportList());
            TravelPath test2 = travelPathBusiness.FindBestPath("A-C", airportBusiness.GetAirportList());
            TravelPath test3 = travelPathBusiness.FindBestPath("A-E", airportBusiness.GetAirportList());

            Assert.AreEqual("Caminho A -> 0 B -> 10 Custo Total - 10", test1.ToString());
            Assert.AreEqual("Caminho A -> 0 B -> 10 C -> 10 Custo Total - 20", test2.ToString());
            Assert.AreEqual("Caminho A -> 0 B -> 10 C -> 10 E -> 10 Custo Total - 30", test3.ToString());
        }
Ejemplo n.º 5
0
 public FlightBusiness(IAirportBusiness airportBusiness, IFlightService flightService, ITUIAssessmentDAL tUIAssessmentDAL)
 {
     _airportBusiness  = airportBusiness;
     _flightService    = flightService;
     _TUIAssessmentDAL = tUIAssessmentDAL;
 }
Ejemplo n.º 6
0
 public async Task <ActionResult> Index(string ccode, string pno = "1")
 {
     return(View(await IAirportBusiness.GetAirportGlobalModel(ccode, pno)));
 }
Ejemplo n.º 7
0
 public ActionResult Index(string iata)
 {
     return(View(IAirportBusiness.GetCompareModel(iata)));
 }