예제 #1
0
        public void WeatherComparator()
        {
            try
            {
                //webpage to fetch temperature
                Dictionary <string, string> prop = Utility.readProperties();

                Temperature tempUI = new Temperature();
                tempUI.setCity(prop["CityName"]);

                UIFunctions uifunc = new UIFunctions(driver);
                uifunc.Launch(prop);
                uifunc.navigateToWeatherPage();
                uifunc.explicitWait();
                uifunc.searchCity(prop);
                float uiTemp = uifunc.readCityWeatherDetails(prop);
                tempUI.setTemp(uiTemp);
                uifunc.closeDriver();

                //REST API to fetch temperature
                Temperature tempAPI = new Temperature();
                tempAPI.setCity(prop["CityName"]);
                //Create Client URL connection
                RestAPIFunctions apifunc = new RestAPIFunctions();
                apifunc.passClient(prop);
                //Create REST API Request
                apifunc.createRequest(prop);
                //Fetch response

                float apiTemp = apifunc.fetchResponse(prop);
                tempAPI.setTemp(apiTemp);

                Utility utilCompare = new Utility();
                Dictionary <string, string> prop2 = Utility.variance();
                utilCompare.Comparator(tempAPI.getTemp(), tempUI.getTemp(), prop2);
            }
            catch (Exception ex)
            {
            }
        }
예제 #2
0
 public void ThenTheResponseFromTheAPIGetsUsTheTemperatureOfTheIndianCity(RestAPIFunctions apifunc, Dictionary <string, string> prop)
 {
     apifunc.fetchResponse(prop);
 }