当前位置: 首页>>代码示例>>C#>>正文


C# DnaTestURLRequest.SetCurrentUserNotLoggedInUser方法代码示例

本文整理汇总了C#中Tests.DnaTestURLRequest.SetCurrentUserNotLoggedInUser方法的典型用法代码示例。如果您正苦于以下问题:C# DnaTestURLRequest.SetCurrentUserNotLoggedInUser方法的具体用法?C# DnaTestURLRequest.SetCurrentUserNotLoggedInUser怎么用?C# DnaTestURLRequest.SetCurrentUserNotLoggedInUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tests.DnaTestURLRequest的用法示例。


在下文中一共展示了DnaTestURLRequest.SetCurrentUserNotLoggedInUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestComplaintBannedEmailIsCaughtUserNotLoggedIn

        public void TestComplaintBannedEmailIsCaughtUserNotLoggedIn()
        {
            // First make sure that the test user can make a complint before we put the email in the banned emails list
            DnaTestURLRequest request = new DnaTestURLRequest("h2g2");
            request.SetCurrentUserNotLoggedInUser();
            request.RequestPage("UserComplaintPage?postid=1&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();

            // Check to make sure that no errors came back
            Assert.IsTrue(xml.SelectSingleNode("//USER-COMPLAINT-FORM/ERROR") == null, "There should not be any errors present in the XML!");

            // Now put the users email into the banned emails list for complaints if it's not already there
            IInputContext context = DnaMockery.CreateDatabaseInputContext();
            using (IDnaDataReader reader = context.CreateDnaDataReader("AddEMailToBannedList"))
            {
                reader.AddParameter("Email", "[email protected]");
                reader.AddParameter("SigninBanned", 0);
                reader.AddParameter("ComplaintBanned", 1);
                reader.AddParameter("EditorID", 6);
                reader.Execute();

                Assert.IsTrue(reader.HasRows, "No rows came back from the AddEMailToBannedList storedprocedure");
                Assert.IsTrue(reader.Read(), "Failed to read the first set of results from the AddEMailToBannedList storedprocedure");
                Assert.IsTrue(reader.Exists("Duplicate"), "The Duplicate result field is not in the AddEMailToBannedList dataset");
            }

            // Now try to complain again
            request.RequestPage("UserComplaintPage?postid=1&Submit=1&email=damnyoureyes72%[email protected]&skin=purexml");
            xml = request.GetLastResponseAsXML();

            // Check to make sure that no errors came back
            Assert.IsTrue(xml.SelectSingleNode("//ERROR") != null, "There should be an error present in the XML!");
            Assert.IsTrue(xml.SelectSingleNode("//ERROR[@TYPE='EMAILNOTALLOWED']") != null, "There should be an EMAILNOTALLOWED error present in the XML!");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:34,代码来源:BannedEMailsFunctionalTests.cs

示例2: NotLoggedInUser

        public void NotLoggedInUser()
        {
            Console.WriteLine("Before userTypes - NotLoggedInUser");

            DnaTestURLRequest request = new DnaTestURLRequest(testUtils_ratingsAPI.sitename);
            request.SetCurrentUserNotLoggedInUser();

            doIt_xml(request, HttpStatusCode.Unauthorized);

            Console.WriteLine("After userTypes - NotLoggedInUser");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:11,代码来源:userTypeTest_v1.cs

示例3: CallAPIRequest

        protected static string CallAPIRequest(DnaTestURLRequest request, string requestURL, string postData, DnaTestURLRequest.usertype userType, string requestMethod)
        {
            if (userType == DnaTestURLRequest.usertype.SUPERUSER)
            {
                request.SetCurrentUserSuperUser();
            } 
            else if (userType == DnaTestURLRequest.usertype.EDITOR)
            {
                request.SetCurrentUserEditor();
            }
            else if (userType == DnaTestURLRequest.usertype.NORMALUSER)
            {
                request.SetCurrentUserNormal();
            }
            else
            {
                request.SetCurrentUserNotLoggedInUser();
            }

            request.AssertWebRequestFailure = false;
            request.RequestPageWithFullURL(requestURL, postData, "application/json", requestMethod);
            return requestURL;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:23,代码来源:APIRequester.cs

示例4: GetMonthlySummaryArticles_FailsWithMonthSummaryNotFound

        public void GetMonthlySummaryArticles_FailsWithMonthSummaryNotFound()
        {
            Console.WriteLine("Before GetMonthlySummaryArticles_FailsWithMonthSummaryNotFound");
            ClearArticlesForTheLastMonthForMonthSummaryFail();

            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNotLoggedInUser();
            request.AssertWebRequestFailure = false;

            string url = String.Format("http://" + _server + "/dna/api/articles/ArticleService.svc/V1/site/{0}/articles/month?format=xml", _sitename);

            try
            {
                // now get the response
                request.RequestPageWithFullURL(url, null, "text/xml");
            }
            catch (WebException)
            {

            }
            Assert.AreEqual(HttpStatusCode.NotFound, request.CurrentWebResponse.StatusCode);
            ErrorData errorData = (ErrorData)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(ErrorData));
            Assert.AreEqual(ErrorType.MonthSummaryNotFound.ToString(), errorData.Code);

            Console.WriteLine("After GetMonthlySummaryArticles_FailsWithMonthSummaryNotFound");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:26,代码来源:articles.cs

示例5: CreateUsersLinksListTestWithUnknownIdentityUserName

        public void CreateUsersLinksListTestWithUnknownIdentityUserName()
        {
            Console.WriteLine("Before CreateUsersLinksListTestWithUnknownIdentityUserName");

            string identityusername = "Idontexistshahahahaha";
            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNotLoggedInUser();
            request.AssertWebRequestFailure = false;
            try
            {
                string url = String.Format("http://" + _server + "/dna/api/users/UsersService.svc/V1/site/{0}/users/{1}/links?format=xml", _sitename, identityusername);
                // now get the response
                request.RequestPageWithFullURL(url, null, "text/xml");
            }
            catch (WebException)
            {

            }
            Assert.AreEqual(HttpStatusCode.NotFound, request.CurrentWebResponse.StatusCode);
            ErrorData errorData = (ErrorData)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(ErrorData));
            Assert.AreEqual(ErrorType.UserNotFound.ToString(), errorData.Code);

            Console.WriteLine("After CreateUsersLinksListTestWithUnknownIdentityUserName");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:24,代码来源:users.cs

示例6: GetCallingUserInfo_AsNotLoggedInUser_Returns401

        public void GetCallingUserInfo_AsNotLoggedInUser_Returns401()
        {
            Console.WriteLine("Before GetCallingUserInfo_AsNotLoggedInUser_Returns401");

            DnaTestURLRequest request = new DnaTestURLRequest("h2g2"); 
            request.SetCurrentUserNotLoggedInUser();
            request.AssertWebRequestFailure = false;
            try
            {
                request.RequestPageWithFullURL(callinguserfull_secure_url);               
            }
            catch (WebException)
            {
            }
            Assert.AreEqual(HttpStatusCode.Unauthorized, request.CurrentWebResponse.StatusCode);
            ErrorData errorData = (ErrorData)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(ErrorData));
            Assert.AreEqual(ErrorType.MissingUserCredentials.ToString(), errorData.Code);

            Console.WriteLine("After GetCallingUserInfo_AsNotLoggedInUser_Returns401");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:20,代码来源:users.cs

示例7: RemoveAs_notLoggedIn

        public void RemoveAs_notLoggedIn()
        {
            DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_ratingsAPI.sitename);
            BBC.Dna.Api.RatingForum returnedForum = null;

            string forumId = testUtils_ratingsAPI.makeTestForum();
            string ratingId = testUtils_ratingsAPI.makeTestItem(forumId);

            string url = makeCreatePickUrl(ratingId);

            // mark this comment as an editor's pick (this will crash if it fails)
            markComment(ratingId);

            returnedForum = readForum(forumId);
            // assume complete succes, don't keep cheking it
            // Now try to unmark it - can't use helper because it is designed to succeed

            string postData = testUtils_ratingsAPI.makeTimeStamp(); // needs some sort of post data otherwise it uses GET

            myRequest = new DnaTestURLRequest(testUtils_ratingsAPI.sitename);

            myRequest.SetCurrentUserNotLoggedInUser();

            try
            {
                myRequest.RequestPageWithFullURL(url, String.Empty, String.Empty, "DELETE");
            }
            catch { }

            Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.Unauthorized,
                "Failed to clear an editor's pick. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:32,代码来源:editorsPicksTests_v1.cs

示例8: ReadAs_notLoggedIn_someInMany

        public void ReadAs_notLoggedIn_someInMany()
        {
            // chose some random numbers. Severly constrained by the smallnes of testUtils_ratingsAPI.maxNumDiffUsers
            Random randomGen = new Random();
            int index1 = randomGen.Next(0, 1);
            int index2 = randomGen.Next(2, 3);
            int index3 = randomGen.Next(4, 5);

            string[] commentArray;
            List<string> ratingList = new List<string>();

            // create the data
            // first the forum
            string forumId = testUtils_ratingsAPI.makeTestForum();

            // then a list of ratings
            for (int i = 0; i < testUtils_ratingsAPI.maxNumDiffUsers; i++)
            {
                ratingList.Add(testUtils_ratingsAPI.makeTestItem(forumId, i));
            }

            // convert it to an array so it is easier to deal with
            commentArray = ratingList.ToArray();

            // mark some
            markComment(commentArray[index1]);
            markComment(commentArray[index2]);
            markComment(commentArray[index3]);

            // read the list of editor's picks
            string url = makeReadPickUrl(forumId);
            DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_ratingsAPI.sitename);

            myRequest.SetCurrentUserNotLoggedInUser();

            try
            {
                myRequest.RequestPageWithFullURL(url);
            }
            catch { }

            Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.OK,
                "Failed listing editor's picks. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription
                );

            XmlDocument xml = myRequest.GetLastResponseAsXML();
            DnaXmlValidator myValidator = new DnaXmlValidator(xml.InnerXml, testUtils_ratingsAPI._schemaRatingForum);
            myValidator.Validate();

            BBC.Dna.Api.RatingForum returnedForum =
                (BBC.Dna.Api.RatingForum)StringUtils.DeserializeObject(myRequest.GetLastResponseAsString(), typeof(BBC.Dna.Api.RatingForum));

            Assert.IsTrue(returnedForum.ratingsList.TotalCount == 3);

            // the default sort is by creation date and the marking should be in order down this list
            Assert.IsTrue(returnedForum.ratingsList.ratings[0].ID.ToString() == commentArray[index1], "First item does not match");
            Assert.IsTrue(returnedForum.ratingsList.ratings[1].ID.ToString() == commentArray[index2], "Second item does not match");
            Assert.IsTrue(returnedForum.ratingsList.ratings[2].ID.ToString() == commentArray[index3], "Third item does not match");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:59,代码来源:editorsPicksTests_v1.cs

示例9: TestHtmlCachingOnNotLoggedIn

        public void TestHtmlCachingOnNotLoggedIn()
        {
            Console.WriteLine("TestHtmlCachingOnNotLoggedIn");
            int expiryTime = 30;

            SetHtmlCaching(true);
            SetHtmlCachingExpiryTime(expiryTime);
            RefreshSiteOptions();

            CreateXSLTFile("HTML caching is ON");

            DateTime start = DateTime.Now;

            DnaTestURLRequest request = new DnaTestURLRequest(_siteUrlName);
            request.SetCurrentUserNotLoggedInUser();
            string s = RequestPage(request);
            Assert.IsTrue(s.Contains("HTML caching is ON"),"Initial request doesn't contain correct string");

            CreateXSLTFile("HTML caching is STILL ON");

            s = RequestPage(request);
            Assert.IsTrue(s.Contains("HTML caching is ON"),"Second request doesn't contain initial string");
            Assert.IsFalse(s.Contains("HTML caching is STILL ON"),"Second request contains new string when it should still be the old one");

            TimeSpan ts = DateTime.Now.Subtract(start);
            Assert.IsTrue(ts.Seconds < expiryTime,"Test didn't run fast enough");

            // Sleep until the HTML caching has expired
            System.Threading.Thread.Sleep((expiryTime+1) * 1000 - ts.Milliseconds);

            s = RequestPage(request);
            Assert.IsFalse(s.Contains("HTML caching is ON"),"Request still has initial string - it should be the new on now");
            Assert.IsTrue(s.Contains("HTML caching is STILL ON"),"The new string is not there yet");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:34,代码来源:HtmlCachingTests.cs

示例10: TestHtmlCachingOffNotLoggedIn

        public void TestHtmlCachingOffNotLoggedIn()
        {
            Console.WriteLine("TestHtmlCachingOffNotLoggedIn");
            int expiryTime = 30;

            SetHtmlCaching(false);
            SetHtmlCachingExpiryTime(expiryTime);
            RefreshSiteOptions();

            CreateXSLTFile("HTML caching is OFF");

            DateTime start = DateTime.Now;

            DnaTestURLRequest request = new DnaTestURLRequest(_siteUrlName);
            request.SetCurrentUserNotLoggedInUser();
            string s = RequestPage(request);
            Assert.IsTrue(s.Contains("HTML caching is OFF"),"Initial request doesn't contain correct string");

            CreateXSLTFile("HTML caching is STILL OFF");

            s = RequestPage(request);
            Assert.IsTrue(s.Contains("HTML caching is STILL OFF"), "Second request doesn't contain new string");

            DateTime end = DateTime.Now;

            // This test has to complete within a time limit
            TimeSpan ts = end.Subtract(start);
            Assert.IsTrue(ts.Seconds < expiryTime,"Test didn't complete in time");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:29,代码来源:HtmlCachingTests.cs

示例11: Test3BannedUser

        public void Test3BannedUser()
        {
            // First make sure that the test user can make a complaint before we put the email in the banned emails list
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNotLoggedInUser();
            request.RequestPage("UserComplaintPage?postid=" + Convert.ToString(_postId) + "&action=submit&complaintreason=libellous&complainttext=Complaint&[email protected]&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();

            // Check to make sure complaint was processed
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/USERCOMPLAINT/@REQUIRESVERIFICATION") != null, "Complaint did not succeed");

             // Now put the users email into the banned emails list for complaints
            IInputContext context = DnaMockery.CreateDatabaseInputContext();
            using (IDnaDataReader reader = context.CreateDnaDataReader("AddEMailToBannedList"))
            {
                reader.AddParameter("Email", "[email protected]");
                reader.AddParameter("SigninBanned", 0);
                reader.AddParameter("ComplaintBanned", 1);
                reader.AddParameter("EditorID", 6);
                reader.AddIntReturnValue();
                reader.Execute();

                var duplicate = reader.GetIntReturnValue();

                Assert.AreEqual(0,duplicate, "The Duplicate result should be false (0)");
            }

             // Now try to complain again
            request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNotLoggedInUser();
            request.RequestPage("UserComplaintPage?postid=" + Convert.ToString(_postId) + "&action=submit&complaintreason=libellous&complainttext=Complaint&[email protected]&skin=purexml");
            xml = request.GetLastResponseAsXML();

            // Check to make sure that complaint was not made.
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/USERCOMPLAINT/@MODID") == null, "User is banned from complaining.");
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/ERROR") != null, "User is banned from complaining.");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:37,代码来源:UserComplaintPageTests.cs

示例12: RemoveAs_notLoggedIn

        public void RemoveAs_notLoggedIn()
        {
            DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_CommentsAPI.sitename);
            BBC.Dna.Api.CommentForum returnedForum = null;

            string forumId = testUtils_CommentsAPI.makeTestCommentForum();
            string commentID = testUtils_CommentsAPI.makeTestComment(forumId);
            string url = "";

            // mark this comment as an editor's pick (this will crash if it fails)
            markComment(commentID);

            returnedForum = readForum(forumId);

            // assume complete succes, don't keep cheking it
            // Now try to unmark it - can't use helper becuse it is designed to succeed

            url = String.Format(
                "http://{0}/dna/api/comments/CommentsService.svc/V1/site/{1}/comments/{2}/editorpicks/",
                testUtils_CommentsAPI.server, testUtils_CommentsAPI.sitename, commentID
                );
            string postData = testUtils_CommentsAPI.makeTimeStamp(); // needs some sort of post data otherwise it uses GET

            myRequest = new DnaTestURLRequest(testUtils_CommentsAPI.sitename);

            myRequest.SetCurrentUserNotLoggedInUser();

            try
            {
                myRequest.RequestPageWithFullURL(url, String.Empty, String.Empty, "DELETE");
            }
            catch { }

            Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.Unauthorized,
                "Failed to clear an editor's pick. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:36,代码来源:editorsPicksTests_v1.cs

示例13: ReadAs_notLoggedIn_someInMany

        public void ReadAs_notLoggedIn_someInMany()
        {
            XmlDocument xml;
            DnaXmlValidator myValidator;
            DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_CommentsAPI.sitename);

            Random randomGen = new Random();
            int listLen = randomGen.Next(10, 20);
            int index1 = randomGen.Next(0, 3);
            int index2 = randomGen.Next(4, 6);
            int index3 = randomGen.Next(7, listLen);

            string[] commentArray;
            List<string> commentList = new List<string>();

            string forumId = testUtils_CommentsAPI.makeTestCommentForum();

            for( int i = 0; i < listLen; i++){
                commentList.Add(testUtils_CommentsAPI.makeTestComment(forumId));
            }

            commentArray = commentList.ToArray();

            markComment(commentArray[index1]);
            markComment(commentArray[index2]);
            markComment(commentArray[index3]);

            // now read the list of editor's picks
            myRequest.SetCurrentUserNotLoggedInUser();

            string url = String.Format(
                "http://{0}/dna/api/comments/CommentsService.svc/V1/site/{1}/commentsforums/{2}/?filterBy=EditorPicks",
                testUtils_CommentsAPI.server, testUtils_CommentsAPI.sitename, forumId
                );
            try
            {
                myRequest.RequestPageWithFullURL(url);
            }
            catch { }

            Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.OK,
                "Failed listing editor's picks. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription
                );

            xml = myRequest.GetLastResponseAsXML();
            myValidator = new DnaXmlValidator(xml.InnerXml, testUtils_CommentsAPI._schemaCommentForum);
            myValidator.Validate();

            BBC.Dna.Api.CommentForum returnedForum =
                (BBC.Dna.Api.CommentForum)StringUtils.DeserializeObject(myRequest.GetLastResponseAsString(), typeof(BBC.Dna.Api.CommentForum));

            Assert.IsTrue(returnedForum.commentList.TotalCount == 3);

            // the default sort is by creation date and the marking should be in order down this list
            Assert.IsTrue(returnedForum.commentList.comments[0].ID.ToString() == commentArray[index1], "First item does not match");
            Assert.IsTrue(returnedForum.commentList.comments[1].ID.ToString() == commentArray[index2], "Second item does not match");
            Assert.IsTrue(returnedForum.commentList.comments[2].ID.ToString() == commentArray[index3], "Third item does not match");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:58,代码来源:editorsPicksTests_v1.cs

示例14: GetUserInfoWithUnknownDNAUserId

        public void GetUserInfoWithUnknownDNAUserId()
        {
            Console.WriteLine("Before GetUserInfoWithUnknownDNAUserId");

            int dnaUserId = 9999999;
            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNotLoggedInUser();
            request.AssertWebRequestFailure = false;
            try
            {
                string url = String.Format("http://" + _server + "/dna/api/users/UsersService.svc/V1/site/{0}/users/{1}?idtype=DNAUserId&format=xml", _sitename, dnaUserId);
                // now get the response
                request.RequestPageWithFullURL(url, null, "text/xml");
            }
            catch (WebException)
            {

            }
            Assert.AreEqual(HttpStatusCode.NotFound, request.CurrentWebResponse.StatusCode);
            ErrorData errorData = (ErrorData)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(ErrorData));
            Assert.AreEqual(ErrorType.UserNotFound.ToString(), errorData.Code);

            Console.WriteLine("After GetUserInfoWithUnknownDNAUserId");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:24,代码来源:users.cs

示例15: Test3BannedUser

        public void Test3BannedUser()
        {
            // First make sure that the test user can make a complaint before we put the email in the banned emails list
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNotLoggedInUser();
            request.RequestPage("UserComplaintPage?postid=" + Convert.ToString(_postId) + "&action=submit&complaintreason=libellous&complainttext=Complaint&[email protected]&skin=purexml");
            XmlDocument xml = request.GetLastResponseAsXML();

            // Check to make sure complaint was processed
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/USERCOMPLAINT/@MODID") != null, "Complaint did not succeed");

             // Now put the users email into the banned emails list for complaints
            IInputContext context = DnaMockery.CreateDatabaseInputContext();
            using (IDnaDataReader reader = context.CreateDnaDataReader("AddEMailToBannedList"))
            {
                reader.AddParameter("Email", "[email protected]");
                reader.AddParameter("SigninBanned", 0);
                reader.AddParameter("ComplaintBanned", 1);
                reader.AddParameter("EditorID", 6);
                reader.Execute();

                Assert.IsTrue(reader.HasRows, "No rows came back from the AddEMailToBannedList storedprocedure");
                Assert.IsTrue(reader.Read(), "Failed to read the first set of results from the AddEMailToBannedList storedprocedure");
                Assert.IsTrue(reader.Exists("Duplicate"), "The Duplicate result field is not in the AddEMailToBannedList dataset");
                Assert.IsFalse(reader.GetBoolean("Duplicate"), "The Duplicate result should be false!");
            }

             // Now try to complain again
            request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();
            request.RequestPage("UserComplaintPage?postid=" + Convert.ToString(_postId) + "&action=submit&complaintreason=libellous&complainttext=Complaint&email=damnyoureyes72%[email protected]&skin=purexml");
            xml = request.GetLastResponseAsXML();

            // Check to make sure that complaint was not made.
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/USERCOMPLAINT/@MODID") == null, "User is banned from complaining.");
            Assert.IsTrue(xml.SelectSingleNode("//H2G2/ERROR") != null, "User is banned from complaining.");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:37,代码来源:UserComplaintPageTests.cs


注:本文中的Tests.DnaTestURLRequest.SetCurrentUserNotLoggedInUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。