public void GetTheParametersOfXmlDllTestOk()
        {
            ReflectionLogic  reflectionLogic         = new ReflectionLogic();
            List <Parameter> parametersOfImporterXml = reflectionLogic.GetTheParametersRequired("\\Importers\\ImporterXml.dll");
            XmlImporter      importerXml             = new XmlImporter();

            CollectionAssert.AreEqual(importerXml.GetParameter(), parametersOfImporterXml);
        }
        public void GetTheParametersOfJSONDllTestOk()
        {
            ReflectionLogic  reflectionLogic          = new ReflectionLogic();
            List <Parameter> parametersOfImporterJson = reflectionLogic.GetTheParametersRequired("\\Importers\\ImporterJson.dll");
            JsonImporter     importerJson             = new JsonImporter();

            CollectionAssert.AreEqual(importerJson.GetParameter(), parametersOfImporterJson);
        }
        public void FailInImportLodgingWithMoreParametersInJsonDllTest()
        {
            ReflectionLogic  reflectionLogic  = new ReflectionLogic();
            List <Parameter> listOfParameters = reflectionLogic.GetTheParametersRequired("\\Importers\\ImporterJson.dll");

            listOfParameters[0].Value = Directory.GetCurrentDirectory() + "\\FilesToImport\\Lodgings.json";
            listOfParameters.Add(new Parameter());
            reflectionLogic.ImportLodgings("\\Importers\\ImporterJson.dll", listOfParameters);
        }
        public void FailInImportLodgingWithMoreParametersInXmlDllTest()
        {
            ReflectionLogic  reflectionLogic  = new ReflectionLogic();
            string           pathOfXmlDll     = "\\Importers\\ImporterXml.dll";
            List <Parameter> listOfParameters = reflectionLogic.GetTheParametersRequired(pathOfXmlDll);

            listOfParameters[0].Value = Directory.GetCurrentDirectory() + "\\FilesToImport\\Lodgings.xml";
            listOfParameters.Add(new Parameter());
            reflectionLogic.ImportLodgings(pathOfXmlDll, listOfParameters);
        }
Beispiel #5
0
 public IActionResult GetParameters([FromQuery] string pathOfDll)
 {
     try
     {
         List <Parameter> listOfParametersRequired = reflectionLogic.GetTheParametersRequired(pathOfDll);
         return(Ok(listOfParametersRequired));
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
        public void ImportingLodgingsTestOfXmlDllOk()
        {
            ReflectionLogic  reflectionLogic  = new ReflectionLogic();
            string           pathOfXmlDll     = "\\Importers\\ImporterXml.dll";
            List <Parameter> listOfParameters = reflectionLogic.GetTheParametersRequired(pathOfXmlDll);

            listOfParameters[0].Value = Directory.GetCurrentDirectory() + "\\FilesToImport\\Lodgings.xml";
            List <LodgingModelForImport> lodgingsImported = reflectionLogic.ImportLodgings(pathOfXmlDll, listOfParameters);

            TouristSpotModelForImport touristSpotModel = new TouristSpotModelForImport()
            {
                Id                 = new Guid("7cb8a7ab-8511-473f-803f-6b39118e79c1"),
                Name               = "Punta del Este",
                Description        = "La naturaleza abunda",
                RegionId           = new Guid("fc775bb9-8cc8-4fdc-bca6-16e06bcd322b"),
                ImagePath          = "Desktop\\pde.jpg",
                ListOfCategoriesId = new List <Guid>()
                {
                    new Guid("baa98b33-eafe-4d62-bb62-859a8e36d3a9")
                }
            };

            LodgingModelForImport lodgingModelForImport = new LodgingModelForImport()
            {
                Name            = "Hotel Enjoy Conrad",
                Description     = "Un lugar magico donde podes vivir.",
                QuantityOfStars = 5,
                Address         = "Playa Mansa parada 21",
                Images          = new List <string>()
                {
                    "Desktop\\conrad.jpg"
                },
                PricePerNight = 200.0,
                IsAvailable   = true,
                TouristSpot   = touristSpotModel
            };

            Assert.AreEqual(lodgingModelForImport, lodgingsImported[0]);
        }
 public void FailInGetParametersOfJsonDllWithoutConstructorTest()
 {
     ReflectionLogic  reflectionLogic          = new ReflectionLogic();
     List <Parameter> parametersOfImporterJson = reflectionLogic.GetTheParametersRequired("\\ImporterWithoutConstructor\\ImporterJsonWithoutConstructor.dll");
 }