當前位置: 首頁>>代碼示例>>C#>>正文


C# DnaTestURLRequest.RequestNUnitASPPage方法代碼示例

本文整理匯總了C#中Tests.DnaTestURLRequest.RequestNUnitASPPage方法的典型用法代碼示例。如果您正苦於以下問題:C# DnaTestURLRequest.RequestNUnitASPPage方法的具體用法?C# DnaTestURLRequest.RequestNUnitASPPage怎麽用?C# DnaTestURLRequest.RequestNUnitASPPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tests.DnaTestURLRequest的用法示例。


在下文中一共展示了DnaTestURLRequest.RequestNUnitASPPage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Test01RestrictedUsersListPage

        public void Test01RestrictedUsersListPage()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("h2g2");
                Console.WriteLine("Before Test01RestrictedUsersListPage");
                dnaRequest.SetCurrentUserEditor();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/h2g2/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                System.Threading.Thread.Sleep(2000);

                DropDownListTester siteList = new DropDownListTester("SiteList");
                Assert.AreEqual(siteList.Visible, true);
                siteList.Items.FindByText("All").Selected = true;

                DropDownListTester userStatusTypes = new DropDownListTester("UserStatusTypes");
                Assert.AreEqual(userStatusTypes.Visible, true);
                userStatusTypes.Items.FindByText("Premoderated").Selected = true;

                LabelTester error = new LabelTester("lblError");
                string errorText = error.Text;
                bool noError = true;
                if (errorText == "Insufficient permissions - Editor Status Required")
                {
                    noError = false;
                }

                Assert.IsTrue(noError, "Error in Restricted User Page.");

                Console.WriteLine("After Test01RestrictedUsersListPage");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }

        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:40,代碼來源:RestrictedUsersListPageTests.cs

示例2: Test02RestrictedUsersListPageWithNormalUserErrorTest

        public void Test02RestrictedUsersListPageWithNormalUserErrorTest()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("h2g2");
                Console.WriteLine("Before Test02RestrictedUsersListPageWithNormalUserErrorTest");
                dnaRequest.SetCurrentUserNormal();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/h2g2/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                System.Threading.Thread.Sleep(2000);

                LabelTester error = new LabelTester("lblError");
                string errorText = error.Text;
                bool isError = false;
                if (errorText == "Insufficient permissions - Editor Status Required")
                {
                    isError = true;
                }

                Assert.IsTrue(isError, "No Error for Normal user in Restricted User Page.");

                Console.WriteLine("After Test02RestrictedUsersListPageWithNormalUserErrorTest");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }
        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:31,代碼來源:RestrictedUsersListPageTests.cs

示例3: Test05RestrictedUsersListSearchByMostRecentPage

        public void Test05RestrictedUsersListSearchByMostRecentPage()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("haveyoursay");
                Console.WriteLine("Before Test05RestrictedUsersListSearchByMostRecentPage");
                dnaRequest.SetCurrentUserEditor();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/haveyoursay/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                ButtonTester mostRecent = new ButtonTester("btnMostRecent", CurrentWebForm);
                mostRecent.Click();

                HtmlTableTester table = new HtmlTableTester("tblResults");

                bool isdata = true;
                if (table.BodyNoTags != "No data for those details")
                {
                    isdata = false;
                }

                Assert.IsTrue(isdata, "No data for Most Recent accounts is returned when there should be at least one.");

                Console.WriteLine("After Test05RestrictedUsersListSearchByMostRecentPage");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }
        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:32,代碼來源:RestrictedUsersListPageTests.cs

示例4: Test06RestrictedUsersListNonEditorPage

        public void Test06RestrictedUsersListNonEditorPage()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("haveyoursay");
                Console.WriteLine("Before Test06RestrictedUsersListNonEditorPage");
                dnaRequest.SetCurrentUserNormal();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/haveyoursay/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                LabelTester error = new LabelTester("lblError");
                string errorText = error.Text;
                bool isError = false;
                if (errorText == "Insufficient permissions - Editor Status Required")
                {
                    isError = true;
                }

                Assert.IsTrue(isError, "Error in permissions for Restricted User Page.");

                Console.WriteLine("After Test06RestrictedUsersListNonEditorPage");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }
        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:29,代碼來源:RestrictedUsersListPageTests.cs

示例5: Test04RestrictedUserListPageSearchByBeginsWithLetterTest

        public void Test04RestrictedUserListPageSearchByBeginsWithLetterTest()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("h2g2");
                Console.WriteLine("Before Test04RestrictedUserListPageSearchByBeginsWithLetterTest");
                dnaRequest.SetCurrentUserEditor();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/h2g2/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                System.Threading.Thread.Sleep(2000);

                DropDownListTester siteList = new DropDownListTester("SiteList");
                Assert.AreEqual(siteList.Visible, true);
                siteList.Items.FindByText("All").Selected = true;

                DropDownListTester userStatusTypes = new DropDownListTester("UserStatusTypes");
                Assert.AreEqual(userStatusTypes.Visible, true);
                userStatusTypes.Items.FindByText("Both").Selected = true;

                Console.WriteLine("Before Button creation");
                ButtonTester btnD = new ButtonTester("btnD", CurrentWebForm);
                Console.WriteLine("Before Button click");
                btnD.Click();

                System.Threading.Thread.Sleep(2000);

                Console.WriteLine("Before get table");

                HtmlTableTester table = new HtmlTableTester("tblResults");

                bool isdata = true;
                if (table.BodyNoTags != "No data for those details")
                {
                    isdata = false;
                }

                Console.WriteLine("After get table");

                Assert.IsTrue(isdata, "No data for All accounts is returned when there should be at least one.");

                Console.WriteLine("After Test04RestrictedUserListPageSearchByBeginsWithLetterTest");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }
        }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:50,代碼來源:RestrictedUsersListPageTests.cs


注:本文中的Tests.DnaTestURLRequest.RequestNUnitASPPage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。