예제 #1
0
        public void getEnumByNameTest()
        {
            try
            {
                InitTestMethod();
                HtmlPageManager.PagesNames ans = HtmlPageManager.getEnumByName("/wot/main");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.Main, "error finding main enum");
                ans = HtmlPageManager.getEnumByName("/wot/");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.Main, "error finding main enum");
                ans = HtmlPageManager.getEnumByName("/wot");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.Main, "error finding main enum");
                ans = HtmlPageManager.getEnumByName("/wot/index");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.Main, "error finding main enum");

                ans = HtmlPageManager.getEnumByName("fdsfd");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.Error, "error finding ERROR enum");

                ans = HtmlPageManager.getEnumByName("/wot/signin");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.signIn, "error finding main enum");
                ans = HtmlPageManager.getEnumByName("/wot/signIn");
                Assert.IsTrue(ans == HtmlPageManager.PagesNames.signIn, "error finding main enum");
            }
            finally
            {
                CleanupTestMethod();
            }
        }
예제 #2
0
        public string httpNewConnectionHandler(HttpListenerContext context)
        {
            HttpListenerRequest request = context.Request;

            //bool isSecureConnection = request.IsSecureConnection; //get if connection is secured or not
            //get relevant html pgae code
            if (request.HttpMethod == "GET")
            {
                string requestedPage = request.RawUrl;

                return(HtmlPageManager.findPageByName(requestedPage));
            }
            else
            {
                return(handlePostRequest(request));
            }
        }
예제 #3
0
        private string purchaseStress(Dictionary <string, string> parameters)
        {
            var reqInfoBad  = new { cardNumber = "1", month = "1", year = "2020", holder = "1", ccv = "1" };
            var dataObjBad  = new { id = -10, data = reqInfoBad };
            var reqInfoGood = new { cardNumber = "1", month = "1", year = "2020", holder = "1", cvv = "1", id = "1", name = "1", address = "a", city = "c", country = "3", zip = "1" };
            var dataObjGood = new { id = -10, data = reqInfoGood };

            if (parameters["purchaseType"] == "good")
            {
                buyShoppingBasketHandler(JObject.Parse(JsonHandler.SerializeObject(dataObjGood)), "");
            }
            else
            {
                buyShoppingBasketHandler(JObject.Parse(JsonHandler.SerializeObject(dataObjBad)), "");
            }

            return(HtmlPageManager.findPageByName("/wot/shoppingbasket"));
        }