Beispiel #1
0
        //"this code is executed entirely within the web application domain"
        private static void EndConversationTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //Start EndConversationTestBegin
            string content = clnt.GetPage("/EndConversationTestBegin.aspx").Trim();

            Assert.AreEqual("OK", content, "Start EndConversationTestBegin : Request Error!! " + content);
            String uniqIdOrig = (String)AspTestContext.HttpContext.Session["ConversationEvidenceBsn_UniqId"];

            content = clnt.GetPage("/EndConversationTestBegin.aspx").Trim();
            Assert.AreEqual("OK", content, "Start EndConversationTestBegin : Request Error!! " + content);
            Assert.AreEqual(
                uniqIdOrig,
                AspTestContext.HttpContext.Session["ConversationEvidenceBsn_UniqId"]
                );

            //End EndConversationTestEnd
            content = clnt.GetPage("/EndConversationTestEnd.aspx").Trim();
            Assert.AreEqual("OK", content, "EndConversationTestEnd: Request Error!! " + content);

            //ReStart EndConversationTestBegin
            content = clnt.GetPage("/EndConversationTestBegin.aspx").Trim();
            Assert.AreEqual("OK", content, "ReStart EndConversationTestBegin: Request Error!! " + content);
            Assert.AreNotEqual(
                uniqIdOrig,
                AspTestContext.HttpContext.Session["ConversationEvidenceBsn_UniqId"]
                );
        }
Beispiel #2
0
        private static void SerializeConversationTestInHostImpl()
        {
            // use static method to avoid passing a reference to ourselves to the host domain
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //first time (before serialization)
            string content = clnt.GetPage("/SerializeConversationTest.aspx").Trim();

            Assert.IsNotNull(AspTestContext.HttpContext, content);
            Assert.IsNotNull(AspTestContext.HttpContext.Session, content);
            Assert.AreEqual("OK", content, content);

            DateTime beginDt = DateTime.Now;

            //second time (after derialization)
            content = clnt.GetPage("/SerializeConversationTest.aspx").Trim();

            Assert.IsNotNull(AspTestContext.HttpContext, content);
            Assert.IsNotNull(AspTestContext.HttpContext.Session, content);
            Assert.AreEqual("OK", content, content);

            log.Error(DateTime.Now.Subtract(beginDt));
        }
Beispiel #3
0
        private static void PatialEndConvTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();
            String        convPatialEndConv_A_BSts =
                "{Id='convPatialEndConv_A_B'; " +
                "this.ParentConversation.Id=convPatialEndConv_A;" +
                " InnerConversations=[{Id='convPatialEndConv_A_B_A';" +
                " this.ParentConversation.Id=convPatialEndConv_A_B;" +
                " InnerConversations=[]}{Id='convPatialEndConv_A_B_B';" +
                " this.ParentConversation.Id=convPatialEndConv_A_B;" +
                " InnerConversations=[]}]}";

            //Start PatialEndConv_A_Begin
            string content = clnt.GetPage("/PatialEndConv_A_Begin.aspx").Trim();

            Assert.AreEqual("OK", content, "PatialEndConv_A_Begin.aspx : Request Error!! " + content);
            String conversationStr = (String)AspTestContext.HttpContext.Session["ConversationStr"];

            Assert.IsTrue(conversationStr.Contains(convPatialEndConv_A_BSts), String.Format("convPatialEndConv_A_BSts was NOT found in '{0}'", conversationStr));

            //remove PatialEndConv_A_B_End
            content = clnt.GetPage("/PatialEndConv_A_B_End.aspx").Trim();
            Assert.AreEqual("OK", content, "PatialEndConv_A_B_End.aspx : Request Error!! " + content);

            //Start PatialEndConv_A_Begin with 'convPatialEndConv_A_B' ended.
            content = clnt.GetPage("/PatialEndConv_A_Begin.aspx").Trim();
            Assert.AreEqual("OK", content, "PatialEndConv_A_Begin.aspx : Request Error!! " + content);
            conversationStr = (String)AspTestContext.HttpContext.Session["ConversationStr"];
            Assert.IsFalse(conversationStr.Contains(convPatialEndConv_A_BSts), String.Format("convPatialEndConv_A_BSts was FOUND in '{0}'", conversationStr));
        }
        public void MaintainsSession()
        {
            HttpWebClient client = Host.CreateWebClient();
            string        result = client.GetPage("MaintainsSession1.aspx");

            Assert.AreEqual("OK", result);
//            Assert.AreEqual("somevalue", AspTestContext.HttpContext.Session["maintainsSession"]);

            // checks previously set session variable
            result = client.GetPage("MaintainsSession2.aspx");
            Assert.AreEqual("OK", result);
        }
        public void UsesReadonlySession()
        {
            HttpWebClient client = Host.CreateWebClient();
            string        result = client.GetPage("ReadOnlySession.aspx");

            Assert.AreEqual("OK", result);
        }
Beispiel #6
0
        public void ReturnsWithoutResources()
        {
            HttpWebClient client = Host.CreateWebClient();
            string        result = client.GetPage("WithoutResources.aspx");

            Assert.AreEqual("OK", result);
        }
Beispiel #7
0
        //"this code is executed entirely within the web application domain"
        private static void EndPausedTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //begin
            string content = clnt.GetPage("/EndPausedTest.aspx?testPhase=begin").Trim();

            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"]);

            //startConvA
            content = clnt.GetPage("/EndPausedTest.aspx?testPhase=startConvA").Trim();
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"], content);
        }
Beispiel #8
0
        /// <summary>
        /// Helper for Ioe.*Tests
        /// </summary>
        /// <param name="host"></param>
        /// <param name="clnt"></param>
        /// <param name="test"></param>
        private static void IoeTestsHelper(IAspFixtureHost host, HttpWebClient clnt, String test)
        {
            //Test for Raise Invalid OperationException with ""Conversation already has another manager".
            string content = clnt.GetPage("/IoeTests.aspx?test=" + test).Trim();

            Assert.AreEqual("OK", content, "/IoeTests.aspx?test=" + test + ": Request Error!! " + content);
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["testResult"], (String)AspTestContext.HttpContext.Session["testResult"]);
        }
        public void DisablesSessions()
        {
            HttpWebClient client = Host.CreateWebClient();
            // a session-less page - checks, if session is correctly disabled
            string result = client.GetPage("DisablesSession.aspx");

            Assert.AreEqual("OK", result);
        }
Beispiel #10
0
        public void ReturnsWithResources()
        {
            HttpWebClient client = Host.CreateWebClient();
            string        result = client.GetPage("WithResources.aspx");

            Trace.Write(result);
            Assert.AreEqual("<span id=\"Result\">FromResource</span>", result);
        }
        public void ClientExecutesPageFromOutsideOfHost()
        {
            // use static method to avoid passing a reference to ourselves to the host domain
            HttpWebClient clnt    = host.CreateWebClient();
            string        content = clnt.GetPage("/testpage.aspx").Trim();

            Trace.WriteLine(content);
            Assert.AreEqual("Hi, I'm the testpage!", content);
        }
Beispiel #12
0
        //"this code is executed entirely within the web application domain"
        private static void SessionIsClosedInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            string content = clnt.GetPage("/SessionIsClosedA.aspx").Trim();

            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"], content);

            content = clnt.GetPage("/SessionIsClosedB.aspx").Trim();
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"], content);

            content = clnt.GetPage("/SessionIsClosedB.aspx?command=endA_FreeEnded").Trim();
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"], content);
        }
Beispiel #13
0
        //"this code is executed entirely within the web application domain"
        private static void EndPausedSessionIsClosedInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            string content = clnt.GetPage("/EndPausedSessionIsClosedA.aspx").Trim();

            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"]);

            //after redirect on EndPausedSessionIsClosedA.aspx
            content = clnt.GetPage("/EndPausedSessionIsClosedB.aspx").Trim();
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"]);

            content = clnt.GetPage("/EndPausedSessionIsClosedB.aspx").Trim();
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["result"], content);
        }
        // this code is executed entirely within the web application domain
        public static void ClientExecutesPageInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateWebClient();

            string content = clnt.GetPage("/testpage.aspx").Trim();

            Trace.WriteLine(content);
            Assert.AreEqual("Hi, I'm the testpage!", content);
            // session value is set by page
            Assert.AreEqual("testvalue", AspTestContext.HttpContext.Session["testkey"]);

            content = clnt.GetPage("/testpage.aspx?testparam=testvalue").Trim();
            // request parameters are evaluated?
            Assert.AreEqual("testparam=testvalue", content);
            // session is maintained during requests?
            Assert.AreEqual("testvalue", AspTestContext.HttpContext.Session["testkey"]);
        }
Beispiel #15
0
        private static void CircularDependenceTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //Start convCircularDependenceTest_A
            string content = clnt.GetPage("/CircularDependenceTest.aspx").Trim();
            string circularDependenceTestStr = (String)AspTestContext.HttpContext.Session["CircularDependenceTest"];

            Assert.IsTrue(String.IsNullOrEmpty(circularDependenceTestStr), "CircularDependenceTest on the server-side: \n" + circularDependenceTestStr + "\n" + content);
        }
Beispiel #16
0
        private static void TimeOutTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //1st TimeOut_NoTimeOut
            string content = clnt.GetPage("/TimeOut_NoTimeOut.aspx").Trim();

            Assert.AreEqual("OK", content, "1st TimeOut_NoTimeOut.aspx : Request Error!! " + content);
            Assert.AreEqual("this is the orinal value", AspTestContext.HttpContext.Session["keyTimeOut_Old"]);
            Assert.AreEqual("this is the new value", AspTestContext.HttpContext.Session["keyTimeOut_New"]);

            //2nd TimeOut_NoTimeOut
            content = clnt.GetPage("/TimeOut_NoTimeOut.aspx").Trim();
            Assert.AreEqual("OK", content, "2nd TimeOut_NoTimeOut.aspx : Request Error!! " + content);
            Assert.AreEqual("this is the new value", AspTestContext.HttpContext.Session["keyTimeOut_Old"]);
            Assert.AreEqual("this is the new value", AspTestContext.HttpContext.Session["keyTimeOut_New"]);

            //TimeOut_WithTimeOut
            content = clnt.GetPage("/TimeOut_WithTimeOut.aspx").Trim();
            Assert.AreEqual("OK", content, "TimeOut_WithTimeOut.aspx : Request Error!! " + content);

            //1th after time out TimeOut_NoTimeOut
            content = clnt.GetPage("/TimeOut_NoTimeOut.aspx").Trim();
            Assert.AreEqual("OK", content, "1th after time out TimeOut_NoTimeOut.aspx : Request Error!! " + content);
            Assert.AreEqual("this is the orinal value", AspTestContext.HttpContext.Session["keyTimeOut_Old"]);
            Assert.AreEqual("this is the new value", AspTestContext.HttpContext.Session["keyTimeOut_New"]);

            //2th after time out TimeOut_NoTimeOut
            content = clnt.GetPage("/TimeOut_NoTimeOut.aspx").Trim();
            Assert.AreEqual("OK", content, "2th after time out TimeOut_NoTimeOut.aspx : Request Error!! " + content);
            Assert.AreEqual("this is the new value", AspTestContext.HttpContext.Session["keyTimeOut_Old"]);
            Assert.AreEqual("this is the new value", AspTestContext.HttpContext.Session["keyTimeOut_New"]);
        }
Beispiel #17
0
        private static void GetParentObjetFromChildTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //Start PatialEndConv_A_Begin
            string content = clnt.GetPage("/GetParentObjetFromChild.aspx").Trim();

            Assert.AreEqual("OK", content, "GetParentObjetFromChild.aspx : Request Error!! " + content);
            Assert.AreEqual("parentValue", AspTestContext.HttpContext.Session["parentKey"]);
            Assert.AreEqual("childValue", AspTestContext.HttpContext.Session["childKey"]);
            Assert.AreEqual("overwrittenValueChild", AspTestContext.HttpContext.Session["overwrittenKey"]);
        }
Beispiel #18
0
        private static void RedirectErrorNoPauseConversationTesteInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            string content = "";

            //obtain_session_cookie
            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=obtain_session_cookie").Trim();
            Assert.AreEqual("OK", content, "/RedirectErrorNoPauseConversation.aspx?step=obtain_session_cookie\n" + content);

            //step_01
            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=step_01").Trim();
            Regex rx = new Regex(@"(?is).*Object moved to.*RedirectErrorNoPauseConversation\.aspx\.*");

            Assert.IsTrue(rx.IsMatch(content), "/RedirectErrorNoPauseConversation.aspx?step=step_02\nNo redirect found\n" + content);

            //step_02
            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=step_02").Trim();
            Assert.AreEqual("OK", content, "/RedirectErrorNoPauseConversation.aspx?step=step_02\n" + content);

            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=end_conversation").Trim();
            Assert.AreEqual("OK", content, "/RedirectErrorNoPauseConversation.aspx?step=end_conversation\n" + content);

            //obtain_session_cookie
            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=obtain_session_cookie").Trim();
            Assert.AreEqual("OK", content, "/RedirectErrorNoPauseConversation.aspx?step=obtain_session_cookie\n" + content);

            //Some_Exception
            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=Some_Exception").Trim();
            Assert.IsTrue(content.Contains("Some_Exception"), "/RedirectErrorNoPauseConversation.aspx?step=Some_Exception\n" + content);

            //Post_Some_Exception
            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=Post_Some_Exception").Trim();
            Assert.AreEqual("OK", content, "/RedirectErrorNoPauseConversation.aspx?step=Post_Some_Exception\n" + content);

            content = clnt.GetPage("/RedirectErrorNoPauseConversation.aspx?step=end_conversation").Trim();
            Assert.AreEqual("OK", content, "/RedirectErrorNoPauseConversation.aspx?step=end_conversation\n" + content);
        }
Beispiel #19
0
        private static void ConnectionReleaseModeIssueInHostImpl()
        {
            // use static method to avoid passing a reference to ourselves to the host domain
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            string content = clnt.GetPage("/ConnectionReleaseModeIssue.aspx").Trim();

            Assert.IsNotNull(AspTestContext.HttpContext, content);
            Assert.IsNotNull(AspTestContext.HttpContext.Session, content);
            Assert.AreEqual(
                "OK",
                (String)AspTestContext.HttpContext.Session["result"],
                (String)AspTestContext.HttpContext.Session["result"] + "\n" + content);
        }
Beispiel #20
0
        private static void SPCSwitchConversationSameRequestTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //NO Raise Lazy
            //Load without details
            string content = clnt.GetPage("/SPCSwitchConversationSameRequest.aspx").Trim();

            Assert.AreEqual("OK", content, "/SPCSwitchConversationSameRequest.aspx (Load without details): Request Error!! " + content);

            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["testeRaizeLazy_A"], (String)AspTestContext.HttpContext.Session["testeRaizeLazy_A"]);
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["testeRaizeLazy_B"], (String)AspTestContext.HttpContext.Session["testeRaizeLazy_B"]);
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["testeNoRaizeLazy_A"], (String)AspTestContext.HttpContext.Session["testeNoRaizeLazy_A"]);
            Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["testeNoRaizeLazy_B"], (String)AspTestContext.HttpContext.Session["testeNoRaizeLazy_B"]);
        }
Beispiel #21
0
        private static void SPCLazyLoadTestInHostImpl()
        {
            IAspFixtureHost host = AspTestContext.Host;

            Assert.IsNotNull(host);

            HttpWebClient clnt = host.CreateClientWithDefaultPort();

            //NO Raise Lazy
            //Load without details
            string content = clnt.GetPage("/SPCLazyLoadTest_A_Begin.aspx?endConversation=false").Trim();

            Assert.AreEqual("OK", content, "/SPCLazyLoadTest_A_Begin.aspx?endConversation=false (Load without details): Request Error!! " + content);

            //Lazy Load details
            content = clnt.GetPage("/SPCLazyLoadTest_A_Status.aspx").Trim();
            String messageTest = (String)AspTestContext.HttpContext.Session["messageTest"];

            Assert.AreEqual("OK", content, "/SPCLazyLoadTest_A_Status.aspx (Lazy Load details) : Request Error!! " + content);
            Assert.AreEqual("no lazy error", messageTest, "/SPCLazyLoadTest_A_Status.aspx (Lazy Load details) : Request Error!! \n" + messageTest);

            //Raise Lazy
            //End Conversation
            content = clnt.GetPage("/SPCLazyLoadTest_A_Begin.aspx?endConversation=true").Trim();
            Assert.AreEqual("OK", content, "/SPCLazyLoadTest_A_Begin.aspx?endConversation=true (End Conversation) : Request Error!! " + content);

            //Load without details
            content = clnt.GetPage("/SPCLazyLoadTest_A_Begin.aspx?endConversation=false").Trim();
            Assert.AreEqual("OK", content, "/SPCLazyLoadTest_A_Begin.aspx?endConversation=false (Load without details): Request Error!! " + content);

            //ReEnd Conversation
            content = clnt.GetPage("/SPCLazyLoadTest_A_Begin.aspx?endConversation=true").Trim();
            Assert.AreEqual("OK", content, "/SPCLazyLoadTest_A_Begin.aspx?endConversation=true (ReEnd Conversation) : Request Error!! " + content);

            //Raise Lazy Load Error
            content     = clnt.GetPage("/SPCLazyLoadTest_A_Status.aspx").Trim();
            messageTest = (String)AspTestContext.HttpContext.Session["messageTest"];
            Assert.AreEqual("OK", content, "/SPCLazyLoadTest_A_Status.aspx (Raise Lazy Load Error): Request Error!! " + content);
            Assert.IsTrue(messageTest.Contains("LazyInitializationException"), "/SPCLazyLoadTest_A_Begin.aspx?endConversation=true (End Conversation) \n" + messageTest);
        }
 /// <summary>
 /// Helper for Ioe.*Tests
 /// </summary>
 /// <param name="host"></param>
 /// <param name="clnt"></param>
 /// <param name="test"></param>
 private static void IoeTestsHelper(IAspFixtureHost host, HttpWebClient clnt, String test)
 {
     //Test for Raise Invalid OperationException with ""Conversation already has another manager".
     string content = clnt.GetPage("/IoeTests.aspx?test=" + test).Trim();
     Assert.AreEqual("OK", content, "/IoeTests.aspx?test=" + test + ": Request Error!! " + content);
     Assert.AreEqual("OK", (String)AspTestContext.HttpContext.Session["testResult"], (String)AspTestContext.HttpContext.Session["testResult"]);
 }