コード例 #1
0
        public void ThenTheAndReturnedShouldBeAsExpected(string exp_lat, string exp_lng)
        {
            var    root         = JsonConvert.DeserializeObject <GoogleAPI.RootObject>(response);
            var    location     = root.results[0].geometry.location;
            var    latitude     = location.lat;
            var    longitude    = location.lng;
            string featureName  = FeatureContext.Current.FeatureInfo.Title;
            string scenarioname = ScenarioContext.Current.ScenarioInfo.Title;

            bugsummary = "Google api test does not give correct result";
            string featureFilePath = featurePath.GetFeatureFileAPIPath(featureName);

            timestamp = GetTimestamp(DateTime.Now);
            List <string> Text  = File.ReadAllLines(featureFilePath).ToList();
            int           index = Text.FindIndex(x => x.Contains(scenarioname));

            index = index - 1;
            string latestexecuttext = "";

            try
            {
                Console.WriteLine("inside try");
                Assert.AreEqual(location.lat.ToString(), exp_lat);
                Assert.AreEqual(location.lng.ToString(), exp_lng);

                latestexecuttext = "#Last Execution Passed on: " + timestamp;
            }
            catch (Exception ex)
            {
                bugcreateflag    = true;
                latestexecuttext = "#Last Execution Failed on: " + timestamp;
                exceptiontext    = ex.ToString();
                throw ex;
            }
            finally
            {
                if (bugcreateflag)
                {
                    bugstate.nobugcreated  = false;
                    bugstate.bugcreateflag = true;
                    bugstate = bug.create(bugsummary, exceptiontext, bugstate);
                    key.getJiraTicketId(featureFilePath, bugsummary, scenarioname, bugstate);
                }
                else
                {
                    Console.WriteLine("Bug Closed and Test case passed Upali");
                    bugstate = bugstatus.check(featureFilePath, bugsummary, scenarioname, bugstate);
                }

                comment.addComment(bugsummary, latestexecuttext);
                ts.update(featureFilePath, bugsummary, scenarioname, latestexecuttext, bugcreateflag, bugstate);
            }
        }