public void TesTcase1008() { int testID = 1008; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); var doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); Console.WriteLine("Response: " + doairpriceresponse); DoAirPriceResponse doairpriceresponseobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpriceresponseobject.GetType(), doairpriceresponse); doairpriceresponseobject = (DoAirPriceResponse)genericobject; if (doairpriceresponseobject.Trip.DiscountType == 4 && doairpriceresponseobject.Trip.JourneyMarkets.Count >= 1) { log.Info("La prueba " + testID + " ha finalizado exitosamente,Se Eencuentra el descuento residente familiar para la ruta especificada"); } else { log.Error("Se esperaba que el sistema invalidará el codigo promocional falso"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void TesTCase1001() { int testID = 1001; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); var doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); DoAirPriceResponse doairpriceresponseobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpriceresponseobject.GetType(), doairpriceresponse); doairpriceresponseobject = (DoAirPriceResponse)genericobject; if (doairpriceresponseobject.Trip.JourneyMarkets.Count >= 0) { log.Error("Para vuelos internacionales el sistema no deberia devolver un listado de vuelos con descuentos residentes"); } else { log.Info("La prueba " + testID + " ha finalizado exitosamente"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void TesTcase1007() { int testID = 1007; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); var doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); Console.WriteLine("Response: " + doairpriceresponse); DoAirPriceResponse doairpriceresponseobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpriceresponseobject.GetType(), doairpriceresponse); doairpriceresponseobject = (DoAirPriceResponse)genericobject; var outboundDepartureStation = doairpicerequestobject.AirportDateTimeList.FirstOrDefault().DepartureStation; var outboundMarketDeparture = doairpicerequestobject.AirportDateTimeList.FirstOrDefault().MarketDateDeparture; var inboundDepartureStation = doairpicerequestobject.AirportDateTimeList.LastOrDefault().DepartureStation; var inboundMarketDateDeparture = doairpicerequestobject.AirportDateTimeList.LastOrDefault().MarketDateDeparture; var Stationsida = doairpriceresponseobject.Trip.JourneyMarkets[0].Journeys.All(x => x.DepartureStation == outboundDepartureStation && x.ArrivalStation == inboundDepartureStation); var Fechasida = doairpriceresponseobject.Trip.JourneyMarkets[0].Journeys.All(x => x.STA.Date == outboundMarketDeparture.Date && x.STD.Date == outboundMarketDeparture.Date && x.ArriveNextDay == false); var Stationsvuelta = doairpriceresponseobject.Trip.JourneyMarkets[1].Journeys.All(x => x.DepartureStation == outboundDepartureStation && x.ArrivalStation == inboundDepartureStation); var Fechasvuelta = doairpriceresponseobject.Trip.JourneyMarkets[1].Journeys.All(x => x.STA.Date == outboundMarketDeparture.Date && x.STD.Date == outboundMarketDeparture.Date && x.ArriveNextDay == false); if (doairpriceresponseobject.Trip.JourneyMarkets.Count >= 2) { log.Info("La prueba " + testID + " ha finalizado exitosamente, esta devolviendo bien los journey en el DoAirPrice"); } else { log.Error("Se esperaba que el sistema invalidará el codigo promocional falso"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void CreateAccount() { Parse Fileobject = new Parse(); string configfile = Fileobject.FindFiles("*log4net.xml"); XmlConfigurator.Configure(Fileobject.LoadLog4netXmlDocument(configfile, Env, ApplicationID).DocumentElement); var log = LogManager.GetLogger(ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); SendFile envio = new SendFile(); Parse LeerJson = new Parse(); var urlocation = Fileobject.FindFiles("*Urls.json"); DirectoryofURL URlobject = (DirectoryofURL)LeerJson.FileRequest(urlocation, "file"); CreateNewAccount register = new CreateNewAccount(); Contacts contacto = new Contacts(); register = contacto.NewAccount(); string idusuario = null; bool retry = false; int i = 0; while (retry == false) { if (idusuario == null || idusuario.Contains("E_SYSTEM") || idusuario.Contains("E_AVIOS")) { register = null; register = contacto.NewAccount(); idusuario = envio.SendFiles(URlobject.URL[0].CreateAccount, register); if (i == 10) { retry = true; } i++; } else { if (i == 10) { retry = true; } i++; } } log.Info("The User ID created is: " + idusuario); Console.WriteLine("ID es:" + idusuario); log.Debug(string.Format("***** SERVICE FINALIZED: {0} *****", ApplicationID)); }
public void TesTcase1006() { int testID = 1006; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); string doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); Console.WriteLine("Response: " + doairpriceresponse); DoAirPriceResponse doairpriceresponseobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpriceresponseobject.GetType(), doairpriceresponse); doairpriceresponseobject = (DoAirPriceResponse)genericobject; bool respuestaida = doairpriceresponseobject.Trip.JourneyMarkets.FirstOrDefault().Journeys.All(x => x.JourneyFare.All(ij => ij.IsPromoVYAplicable == true && ij.IsFareAvailable == true)); bool respuestavuelta = doairpriceresponseobject.Trip.JourneyMarkets.LastOrDefault().Journeys.All(x => x.JourneyFare.All(ij => ij.IsPromoVYAplicable == true && ij.IsFareAvailable == true)); if (respuestaida == true && respuestavuelta == true) { log.Info("La prueba " + testID + " ha finalizado exitosamente, El sistema esta devolviendo las promociones correctamente"); } else { log.Error("Se esperaba que el sistema invalidará el codigo promocional falso"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void TesTcase1003() { int testID = 1003; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); var doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); Console.WriteLine("Response: " + doairpriceresponse); DoAirPriceResponse doairpriceresponseobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpriceresponseobject.GetType(), doairpriceresponse); doairpriceresponseobject = (DoAirPriceResponse)genericobject; if (doairpriceresponseobject.Error.Code.Contains("E_PRRQ_VAL")) { log.Info("La prueba " + testID + " ha finalizado exitosamente, el sistema no puede asignar fechas de llegada menores a las de salida"); } else { log.Error("Se esperaba un error en fechas de salida"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void TesTcase1005() { int testID = 1005; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); var doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); Console.WriteLine("Response: " + doairpriceresponse); DoAirPriceResponse doairpricerequestobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpricerequestobject.GetType(), doairpriceresponse); doairpricerequestobject = (DoAirPriceResponse)genericobject; if (doairpricerequestobject.Error.Code.Contains("E_PROMOVY_")) { log.Info("La prueba " + testID + " ha finalizado exitosamente, El sistema no acepta codigos invalidos"); } else { log.Error("Se esperaba que el sistema invalidará el codigo promocional falso"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void TesTcase1004() { int testID = 1004; var log = RandomGenerator.log(Env, ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); log.Info(string.Format("TestCase: " + testID)); List <string> EnviromentsURLs = RandomGenerator.EnviromentURL(Env); DataFillerObject DataObject = new DataFillerObject(); DoAirPriceRequest doairpicerequestobject = DataObject.DataDoAirPrice(testID); SendFile SendObject = new SendFile(); var doairpriceresponse = SendObject.SendFiles(EnviromentsURLs[0], doairpicerequestobject); Console.WriteLine("Response: " + doairpriceresponse); DoAirPriceResponse doairpriceresponseobject = new DoAirPriceResponse(); var genericobject = DataObject.deserialize(doairpriceresponseobject.GetType(), doairpriceresponse); doairpriceresponseobject = (DoAirPriceResponse)genericobject; if (doairpriceresponseobject.Trip.JourneyMarkets.Count == 1) { log.Info("La prueba " + testID + " ha finalizado exitosamente, El sistema autocompleta la currency cuando es Euros"); } else { log.Error("Se esperaba un error en fechas de salida"); } log.Debug(string.Format("***** Prueba " + testID + "Finalizada *****")); }
public void Insurance() { //Variables string Env = "PRE"; var Date = DateTime.Now.AddDays(7); var DateRe = DateTime.Now.AddDays(10); string doairpriceresponsestring = null, Doairpricefeeresponsestring = null, dobookingresponsestring = null, baseAddressDoAirPrice = null, baseAddressDoAirPriceAndFee = null, baseAddressDoBooking = null; //Objetos usados en codigo DoAirPriceRequest doairpricerequest; DoAirPriceResponse doAirPriceResponse; DoAirPriceFeeResponse DoAirPriceAndFeeResponseObjecto; DoAirPriceFeeRequest Doairpricefeerequest; DoBookingRequest BookingrequestObject; DobookingResponse BookingresponseObject; DirectoryofURL fileURL; Contacts Contact = new Contacts(); List <Journey> currentJourney = new List <Journey>(); SearchFlight flightsearch = new SearchFlight(); object Empty; FillSSR ssrcode = new FillSSR(); Parse LeerJson = new Parse(); //Buscar archivos para la prueba string configfile = LeerJson.FindFiles("*log4net.xml"); var whatever = LeerJson.LoadLog4netXmlDocument(configfile, Env, ApplicationID).DocumentElement; Console.WriteLine(whatever); XmlConfigurator.Configure(whatever); var log = LogManager.GetLogger(ApplicationID); //Initcializar los logs log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); //DoAirPrice string filelocationDoAirPrice = LeerJson.FindFiles("*DoAirPrice.json"); //DoPriceFee string filelocationDoAirPriceFee = LeerJson.FindFiles("*DoPriceAndFee.json"); //DoBooking string filelocationDoBooking = LeerJson.FindFiles("*DoBooking.json"); //Objeto de envio y recepcción SendFile envio = new SendFile(); //Busqueda de endpoints string filelocationURL = LeerJson.FindFiles("*Urls.json"); Empty = LeerJson.FileRequest(filelocationURL, "file"); fileURL = (DirectoryofURL)Empty; Empty = null; //URls switch (Env) { case "PRE": baseAddressDoAirPrice = fileURL.URL[0].DoAirPrice; baseAddressDoAirPriceAndFee = fileURL.URL[0].DoAirPriceFee; baseAddressDoBooking = fileURL.URL[0].DoBooking; break; case "INT": baseAddressDoAirPrice = fileURL.URL[1].DoAirPrice; baseAddressDoAirPriceAndFee = fileURL.URL[1].DoAirPriceFee; baseAddressDoBooking = fileURL.URL[1].DoBooking; break; case "PRO": baseAddressDoAirPrice = fileURL.URL[3].DoAirPrice; baseAddressDoAirPriceAndFee = fileURL.URL[3].DoAirPriceFee; baseAddressDoBooking = fileURL.URL[3].DoBooking; break; } //Creación del objeto de request doairprice Empty = LeerJson.FileRequest(filelocationDoAirPrice, "DoAirPrice"); doairpricerequest = (DoAirPriceRequest)Empty; doairpricerequest.AirportDateTimeList[0].MarketDateDeparture = Date; if (doairpricerequest.AirportDateTimeList.Count >= 2) { doairpricerequest.AirportDateTimeList[1].MarketDateDeparture = DateRe; } Empty = null; //Recepcción del request de do air price response bool retry3 = false; while (retry3 == false) { if (doairpriceresponsestring == null) { doairpriceresponsestring = envio.SendFiles(baseAddressDoAirPrice, doairpricerequest); } else { retry3 = true; } } doAirPriceResponse = JsonConvert.DeserializeObject <DoAirPriceResponse>(doairpriceresponsestring); //Selección del vuelo que usaremos para la pruebas currentJourney = flightsearch.FinddirFlight(doAirPriceResponse, "OP"); log.Info("The journey picked is: " + currentJourney[0].JourneySellKey); log.Info("The fare picked is:" + currentJourney[0].JourneyFare[0].JourneyFareKey); if (currentJourney.Count >= 2) { log.Info("The journey picked is: " + currentJourney[1].JourneySellKey); log.Info("The fare picked is:" + currentJourney[1].JourneyFare[0].JourneyFareKey); } //DoPriceFee manipulación del objecto y envio de request Empty = LeerJson.FileRequest(filelocationDoAirPriceFee, "DoAirPriceFee"); Doairpricefeerequest = (DoAirPriceFeeRequest)Empty; Empty = null; Doairpricefeerequest.SellKeyList[0].FareKey = currentJourney[0].JourneyFare[0].JourneyFareKey; Doairpricefeerequest.SellKeyList[0].JourneyKey = currentJourney[0].JourneySellKey; if (currentJourney.Count >= 2) { Doairpricefeerequest.SellKeyList.Add(new SellKeyList()); Doairpricefeerequest.SellKeyList[1].FareKey = currentJourney[1].JourneyFare[0].JourneyFareKey; Doairpricefeerequest.SellKeyList[1].JourneyKey = currentJourney[1].JourneySellKey; } Doairpricefeerequest.PaxInfoList = doairpricerequest.Paxs; bool retry2 = false; while (retry2 == false) { if (Doairpricefeeresponsestring == null) { Doairpricefeeresponsestring = envio.SendFiles(baseAddressDoAirPriceAndFee, Doairpricefeerequest); } else { retry2 = true; } } //Llenado de objecto de respuesta del DoAirPRice DoAirPriceAndFeeResponseObjecto = JsonConvert.DeserializeObject <DoAirPriceFeeResponse>(Doairpricefeeresponsestring); Console.WriteLine("Resultado JourneySellKey del price and fee: " + DoAirPriceAndFeeResponseObjecto.Price.JourneysPrice[0].JourneySellKey); //Booking creación y manipulación del objeto Empty = LeerJson.FileRequest(filelocationDoBooking, "DoBooking"); BookingrequestObject = (DoBookingRequest)Empty; Empty = null; //Llenar los campos necesarios para crear el request de booking BookingrequestObject.SellKeyList = Doairpricefeerequest.SellKeyList; BookingrequestObject.SellKeyList[0].PaxSSRList = ssrcode.FillingSSr(doairpricerequest).PaxSSRList; BookingrequestObject.JourneyList = currentJourney; //BookingrequestObject.segmentInfo.Add(currentJourney[0].Segments); //Paxinfolist var BookingrequestObjectaux = Contact.FillPaxInfo(doairpricerequest); BookingrequestObject.PaxInfoList = BookingrequestObjectaux.PaxInfoList; //BookingInfoList FillAncillaries AncillariesObject = new FillAncillaries(); BookingrequestObject.BookingContact = Contact.FillContact(BookingrequestObject); BookingrequestObject.Insurance = AncillariesObject.FillInsurance(currentJourney, 4, DoAirPriceAndFeeResponseObjecto, 4); //Choosing payment method PaymentMethod PaymentInfoObject = new PaymentMethod(); BookingrequestObject.PaymentData = PaymentInfoObject.Payment("AE", Env); //DoBookin dobookingresponsestring = envio.SendFiles(baseAddressDoBooking, BookingrequestObject); //string json = JsonConvert.SerializeObject(BookingrequestObject, Formatting.Indented); BookingresponseObject = JsonConvert.DeserializeObject <DobookingResponse>(dobookingresponsestring); //Console.WriteLine("Response de Booking RecordLocator: " + BookingresponseObject.Success.RecordLocator); Console.WriteLine("Response de Booking RecordLocator: " + dobookingresponsestring); log.Info("The record Locator is: " + BookingresponseObject.Success.RecordLocator); log.Debug(string.Format("***** SERVICE FINALIZED: {0} *****", ApplicationID)); }
public void LoginExisting() { string Env = "PRE"; Parse Fileobject = new Parse(); string configfile = Fileobject.FindFiles("*log4net.xml"); XmlConfigurator.Configure(Fileobject.LoadLog4netXmlDocument(configfile, Env, ApplicationID).DocumentElement); var log = LogManager.GetLogger(ApplicationID); log.Debug(string.Format("***** SERVICE INITIALIZED: {0} *****", ApplicationID)); LoginRequest loginReqObj = new LoginRequest() { Username = "******", Password = "******", IP = "235.231.34." + RandomGenerator.RandomString(3, 3), DeviceType = "WEB", Language = "es-ES", TokenID = RandomGenerator.RandomString(6, 3), Udid = "\"6979-5271-f146-5b16-421f-d63c\"" }; Parse LeerJson = new Parse(); DirectoryofURL fileURL; Object Empty; SendFile envio = new SendFile(); string filelocationURL = Fileobject.FindFiles("*Urls.json"); Empty = LeerJson.FileRequest(filelocationURL, "file"); fileURL = (DirectoryofURL)Empty; var urlocation = Fileobject.FindFiles("*Urls.json"); DirectoryofURL URlobject = (DirectoryofURL)LeerJson.FileRequest(urlocation, "file"); bool retry = false; string login = null; int i = 0; while (retry == false) { if (login == null || login.Contains("E_AVIOS") || login.Contains("E_SYSTEM")) { login = envio.SendFiles(fileURL.URL[0].Login, loginReqObj); if (i == 10) { retry = true; } i++; } else { retry = true; } } var loginObject = JsonConvert.DeserializeObject <LoginResponse>(login); log.Info("El mail del usuario es:" + loginObject.MemberData.Email); Console.WriteLine("El login esperado es:" + loginObject.MemberData.Email); log.Info("El nombre del usuario es:" + loginObject.MemberData.FirstName); Console.WriteLine("El login esperado es:" + loginObject.MemberData.FirstName); }