public void SingleSetValueThread()
 {
     try
     {
         CookieContainer cookieContainer = new CookieContainer();
         string          textToSet       = "valueSettedInSession" + (nBlock * nCall);
         HttpWebRequest  request1        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_ACTION + textToSet),
                         request2        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);
         TestHelpers_v1_0.DoRequest(request1, cookieContainer);
         string result = TestHelpers_v1_0.DoRequest(request2, cookieContainer);
         lock (_lockObj)
         {
             if ((_testOk) &&
                 (!result.Contains(string.Format("<sessionVal>{0}</sessionVal>", textToSet))))
             {
                 _testOk       = false;
                 _errorMessage = "Failed. Bad content" + Environment.NewLine + result;
             }
         }
     }
     catch (Exception e)
     {
         lock (_lockObj)
         {
             _testOk       = false;
             _errorMessage = "Http Exception" + e.Message;
         }
     }
 }
Esempio n. 2
0
        public void JSonObectWithList()
        {
            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest  request1        =
                (HttpWebRequest)WebRequest.Create(
                    TestHelpers_v1_0.BASE_URL +
                    TestHelpers_v1_0.SET_SESSION_VAL_JSON_SERIALIZELIST),
                            request2 = (HttpWebRequest)WebRequest.Create(
                TestHelpers_v1_0.BASE_URL +
                TestHelpers_v1_0.PRINT_SESSION_VAL_JSON_SERIALIZELIST);

            TestHelpers_v1_0.DoRequest(request1, cookieContainer);
            string result             = TestHelpers_v1_0.DoRequest(request2, cookieContainer);
            string expectedResultPart = @"<fieldset>
        <legend>PersonPetsList</legend>

        <div class=""display-label"">
            Name
        </div>
        <div class=""display-field"">
            Marc
        </div>

        <div class=""display-label"">
            Surname
        </div>
        <div class=""display-field"">
            Cortada
        </div>

        <div class=""display-label"">
            City
        </div>
        <div class=""display-field"">
            Barcelona
        </div>
        <div class=""display-field"">
            Barcelona
        </div>        
        
        <div class=""display-field"">
            Dog
        </div>
        
        <div class=""display-field"">
            Cat
        </div>
        
        <div class=""display-field"">
            Shark
        </div>
        
    </fieldset>
";

            StringAssert.Contains(RemoveSpace(result), RemoveSpace(expectedResultPart));
        }
Esempio n. 3
0
        public void InitBlankValue()
        {
            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest  request         =
                (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);
            string result = TestHelpers_v1_0.DoRequest(request, cookieContainer);

            // Blank value is expected
            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", ""));
        }
Esempio n. 4
0
        public void SingleSetValueDecimal()
        {
            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest  request1        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_VAL_DECIMAL),
                            request2        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);

            TestHelpers_v1_0.DoRequest(request1, cookieContainer);
            string result = TestHelpers_v1_0.DoRequest(request2, cookieContainer);

            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", "3.1416"));
        }
Esempio n. 5
0
        public void SingleSetValueInt()
        {
            CookieContainer cookieContainer = new CookieContainer();
            int             intToSet        = 1;
            HttpWebRequest  request1        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_VAL_INT + intToSet),
                            request2        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);

            TestHelpers_v1_0.DoRequest(request1, cookieContainer);
            string result = TestHelpers_v1_0.DoRequest(request2, cookieContainer);

            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", intToSet));
        }
Esempio n. 6
0
        public void SetValueStringTwice()
        {
            CookieContainer cookieContainer = new CookieContainer();
            string          textToSet1 = "valueSettedInSession", textToSet2 = "valueSettedInSession2";
            HttpWebRequest  request1 = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_ACTION + textToSet1),
                            request2 = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_ACTION + textToSet2),
                            request3 = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);

            TestHelpers_v1_0.DoRequest(request1, cookieContainer);
            TestHelpers_v1_0.DoRequest(request2, cookieContainer);
            string result = TestHelpers_v1_0.DoRequest(request3, cookieContainer);

            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", textToSet2));
        }
Esempio n. 7
0
        public void SessionAbandon()
        {
            CookieContainer cookieContainer = new CookieContainer();
            string          textToSet1      = "valueSettedInSession";
            HttpWebRequest  request1        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_ACTION + textToSet1),
                            request2        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION),
                            request3        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SESSION_ABANDON_ACTION),
                            request4        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);

            TestHelpers_v1_0.DoRequest(request1, cookieContainer);
            string result = TestHelpers_v1_0.DoRequest(request2, cookieContainer);

            Assert.IsTrue(result.Contains(string.Format("<sessionVal>{0}</sessionVal>", textToSet1)));
            TestHelpers_v1_0.DoRequest(request3, cookieContainer);
            result = TestHelpers_v1_0.DoRequest(request4, cookieContainer);
            // The expected text after abandon is an empty string
            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", ""));
        }
Esempio n. 8
0
        public void SingleSetValueBool()
        {
            CookieContainer cookieContainer = new CookieContainer();
            HttpWebRequest  request1        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_VAL_BOOL + true),
                            request2        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION),
                            request3        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.SET_SESSION_VAL_BOOL + false),
                            request4        = (HttpWebRequest)WebRequest.Create(TestHelpers_v1_0.BASE_URL + TestHelpers_v1_0.PRINT_SESION_ACTION);

            //Trying setting with true
            TestHelpers_v1_0.DoRequest(request1, cookieContainer);
            string result = TestHelpers_v1_0.DoRequest(request2, cookieContainer);

            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", "True"));

            //Trying setting with false
            TestHelpers_v1_0.DoRequest(request3, cookieContainer);
            result = TestHelpers_v1_0.DoRequest(request4, cookieContainer);
            StringAssert.Contains(result, string.Format("<sessionVal>{0}</sessionVal>", "False"));
        }