コード例 #1
0
        public void ThenIVerifyTheResult()
        {
            hk.addtexttoextentreport("Then", "I Verify the Result");
            var    jObject  = JObject.Parse(restResponse.Content);
            string per_page = jObject.GetValue("per_page").ToString();

            if (per_page != null)
            {
                hk.pasststausreport("per_page received is :" + per_page);
                hk.logger("per_page Recived from Get Request is " + per_page);
            }
            else
            {
                hk.failstatusreport("per_page received is :" + per_page);
                Log.Error("No per_page received from sent request" + URI);
            }
            string total_pages = jObject.GetValue("total_pages").ToString();

            if (total_pages != null)
            {
                hk.pasststausreport("total_pages received is :" + total_pages);
                hk.logger("total_pages Recived from Get Request is " + total_pages);
            }
            else
            {
                hk.failstatusreport("total_pages received is :" + total_pages);
                Log.Error("No total_pages received from sent request" + URI);
            }

            int StatusCode = (int)restResponse.StatusCode;

            try
            {
                Assert.AreEqual(200, StatusCode, "Status code is 200");
                hk.pasststausreport("Scenario Passed");
                hk.pasststausreport("StatusCode received is :" + StatusCode);
                hk.logger("StatusCode Recived from Get Request is " + StatusCode);
            }
            catch (Exception ex)
            {
                //hk.failstatusreport("Sceanrios failed as Status recieved is :" + ex);

                hk.logger("Sceanrios failed as Status recieved is" + ex);
            }
            finally
            {
                hk.closelogger();
                hk.email();
                hk.ExtentClose();
                hk.email();
            }
        }