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


C# Api.CommentInfo类代码示例

本文整理汇总了C#中BBC.Dna.Api.CommentInfo的典型用法代码示例。如果您正苦于以下问题:C# CommentInfo类的具体用法?C# CommentInfo怎么用?C# CommentInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CommentForum_BasicAddCommentWithStatsCheck

        public void CommentForum_BasicAddCommentWithStatsCheck()
		{
            CommentForum commentForum = new CommentForum
            {
                Id = Guid.NewGuid().ToString(),
                ParentUri = "http://www.bbc.co.uk/dna/h2g2/",
                Title = "testCommentForum"
            };

            CommentForum result = CreateForum(commentForum);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.commentSummary.Total == 0);

            //add a comment 
            CommentInfo comment = new CommentInfo { text = "this is a nunit generated comment." + Guid.NewGuid().ToString() };

            CreateComment(comment, result);

            //get forum again
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.commentSummary.Total == 1);

            XmlDocument xStats = GetAllStatCounter();
            Assert.IsTrue(GetStatCounter(xStats, "RAWREQUESTS") == 3);
            
            //get forum again
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.commentSummary.Total == 1);
            xStats = GetAllStatCounter();
            Assert.IsTrue(GetStatCounter(xStats, "RAWREQUESTS") == 4);

		}
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:34,代码来源:CommentForumCachingAndStats.cs

示例2: CreateCommentforumToPost

 public static CommentForum CreateCommentforumToPost(bool allowAnonymousPosting, string title, string id, string text, string parentUri, string userName)
 {
     CommentForum postDataForum = new CommentForum();
     postDataForum.ParentUri = parentUri;
     postDataForum.Title = title;
     postDataForum.Id = id;
     postDataForum.allowNotSignedInCommenting = allowAnonymousPosting;
     postDataForum.commentList = new CommentsList();
     postDataForum.commentList.comments = new List<CommentInfo>();
     CommentInfo testCommentInfo = new CommentInfo();
     testCommentInfo.text = text;
     testCommentInfo.User.DisplayName = userName;
     postDataForum.commentList.comments.Add(testCommentInfo);
     return postDataForum;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:15,代码来源:CommentForumTestUtils.cs

示例3: CreateTestForumAndComment

        public void CreateTestForumAndComment(ref CommentForum commentForum, ref CommentInfo returnedComment)
        {
            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNormal();
            //create the forum
            if(string.IsNullOrEmpty(commentForum.Id))
            {
                commentForum = commentsHelper.CommentForumCreate("tests", Guid.NewGuid().ToString());
            }

            string text = "Functiontest Title" + Guid.NewGuid().ToString();
            string commentForumXml = String.Format("<comment xmlns=\"BBC.Dna.Api\">" +
                "<text>{0}</text>" +
                "</comment>", text);

            // Setup the request url
            string url = String.Format("https://" + _secureserver + "/dna/api/comments/CommentsService.svc/V1/site/{0}/commentsforums/{1}/", _sitename, commentForum.Id);
            // now get the response
            request.RequestPageWithFullURL(url, commentForumXml, "text/xml");
            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaCommentForum);
            validator.Validate();

            //check the TextAsHtml element
            //string textAsHtml = xml.DocumentElement.ChildNodes[2].InnerXml;
            //Assert.IsTrue(textAsHtml == "<div class=\"dna-comment text\" xmlns=\"\">" + text + "</div>");

            returnedComment = (CommentInfo)StringUtils.DeserializeObject(request.GetLastResponseAsString(), typeof(CommentInfo));
            Assert.IsTrue(returnedComment.text == text);
            Assert.IsNotNull(returnedComment.User);
            Assert.IsTrue(returnedComment.User.UserId == request.CurrentUserID);

            DateTime created = DateTime.Parse(returnedComment.Created.At);
            DateTime createdTest = BBC.Dna.Utils.TimeZoneInfo.GetTimeZoneInfo().ConvertUtcToTimeZone(DateTime.Now.AddMinutes(5));
            Assert.IsTrue(created < createdTest);//should be less than 5mins
            Assert.IsTrue(!String.IsNullOrEmpty(returnedComment.Created.Ago));
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:38,代码来源:CommentsNeroRatings_v1.cs

示例4: AddToCommentRepository

        private CommentInfo AddToCommentRepository(string commentForumUid, int conversationId, CommentInfo comment)
        {
            using (var reader = CreateReader("dna.AddComment"))
            {
                reader.AddParameter("bbcIdentityUserId", CallingUser.IdentityUserID);
                reader.AddParameter("commentForumId", commentForumUid);
                reader.AddParameter("commentText", comment.text);
                reader.AddParameter("trusetedSource", CallingUser.IsTrustedUser());
                reader.AddParameter("threadId", conversationId);
                reader.AddParameter("trustedSource", CallingUser.IsTrustedUser());
                reader.Execute();

                if(reader.HasRows && reader.Read())
                {
                    //fill in comment
                }
            }
            return comment;         
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:Comments.cs

示例5: AddCommentToPreModerationQueue

 private int AddCommentToPreModerationQueue(string commentForumUid, int conversationId, CommentInfo comment, int modId)
 {
     using (var reader = CreateReader("dna.AddCommentToPreModerationQueue"))
     {
         reader.AddParameter("commentForumId", commentForumUid);
         reader.AddParameter("bbcIdentityUserId", CallingUser.IdentityUserID);
         reader.AddParameter("userName", CallingUser.UserName);
         reader.AddParameter("text", comment.text);
         reader.AddParameter("hash", GenerateHash(comment.text, commentForumUid, CallingUser.IdentityUserID));
         reader.AddParameter("threadId", conversationId);
         reader.AddParameter("subject", comment.Title);
         reader.Execute();
         if (reader.HasRows && reader.Read())
         {
             modId = reader.GetInt32NullAsZero("ModerationQueueId");
         }
     }
     return modId;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:Comments.cs

示例6: CommentListReadBySiteNameAndPrefix

        public void CommentListReadBySiteNameAndPrefix()
        {
            string prefix = "prefixtestsbycomments" + Guid.NewGuid().ToString();
            CommentForum commentForum = new CommentForum
            {
                Id = prefix + "_" + Guid.NewGuid().ToString(),
                ParentUri = "http://www.bbc.co.uk/dna/h2g2/",
                Title = "testCommentForum"
            };
            

            //create the forum
            CommentForum result = _comments.CreateCommentForum(commentForum, site);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            //create the comment
            //set up test data
            for (int i = 0; i < 10; i++)
            {
                CommentInfo comment = new CommentInfo
                {
                    text = "this is a nunit generated comment."
                };
                comment.text += Guid.NewGuid().ToString();//have to randomize the string to post
                string IPAddress = String.Empty;
                Guid BBCUid = Guid.NewGuid();
                //normal user
                _comments.CallingUser = new CallingUser(SignInSystem.DebugIdentity, null, null, null, TestUserAccounts.GetNormalUserAccount.UserName, _siteList);
                _comments.CallingUser.CreateUserFromDnaUserID(TestUtils.TestUserAccounts.GetNormalUserAccount.UserID, site.SiteID);
                CommentInfo commentInfo = _comments.CreateComment(result, comment);
                Assert.IsTrue(commentInfo != null);
                Assert.IsTrue(commentInfo.ID > 0);
                Assert.IsTrue(commentInfo.text == comment.text);
            }


            //test good site
            CommentsList resultList = _comments.GetCommentsListBySite(site, prefix);
            Assert.IsTrue(resultList != null);
            Assert.IsTrue(resultList.TotalCount == 10);
            //test paging
            _comments.ItemsPerPage = 3;
            _comments.StartIndex = 5;
            resultList = _comments.GetCommentsListBySite(site, prefix);
            Assert.IsTrue(resultList != null);
            Assert.IsTrue(resultList.TotalCount == 10);
            Assert.IsTrue(resultList.ItemsPerPage == _comments.ItemsPerPage);
            Assert.IsTrue(resultList.StartIndex == _comments.StartIndex);

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:52,代码来源:CommentForum.cs

示例7: CreateRatingThreadComment

        public Stream CreateRatingThreadComment(string ratingForumID, string threadID, string siteName, CommentInfo comment)
        {
            int id = 0;
            if (!Int32.TryParse(threadID, out id))
            {
                throw new DnaWebProtocolException(ApiException.GetError(ErrorType.InvalidThreadID));
            }
            CommentInfo ratingThreadCommentInfo = null;
            try
            {
                ISite site = GetSite(siteName);
                RatingForum ratingForumData = null;
                ratingForumData = _ratingObj.RatingForumReadByUID(ratingForumID, site);
                _ratingObj.CallingUser = GetCallingUser(site);
                ratingThreadCommentInfo = _ratingObj.RatingCommentCreate(ratingForumData, id, comment);

            }
            catch (ApiException ex)
            {
                throw new DnaWebProtocolException(ex);
            }
            return GetOutputStream(ratingThreadCommentInfo);

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:24,代码来源:ReviewService.cs

示例8: SetupComment

 private CommentInfo SetupComment()
 {
     //create the comment
     CommentInfo comment = new CommentInfo
     {
         text = "this is a nunit generated comment."
     };
     comment.text += Guid.NewGuid().ToString();//have to randomize the string to post
     string IPAddress = String.Empty;
     Guid BBCUid = Guid.NewGuid();
     //normal user
     _comments.CallingUser = new CallingUser(SignInSystem.DebugIdentity, null, null, null, TestUserAccounts.GetNormalUserAccount.UserName, _siteList);
     _comments.CallingUser.CreateUserFromDnaUserID(TestUtils.TestUserAccounts.GetNormalUserAccount.UserID, site.SiteID);
     return comment;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:15,代码来源:CommentForum.cs

示例9: CreateComment

        private CommentInfo CreateComment(CommentInfo info, CommentForum forum)
        {
            string commentForumXml = String.Format("<comment xmlns=\"BBC.Dna.Api\">" +
                "<text>{0}</text>" +
                "</comment>", info.text);

            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNormal();

            // Setup the request url
            string url = String.Format("https://" + _secureserver + "/dna/api/comments/CommentsService.svc/V1/site/{0}/commentsforums/{1}/", _sitename, forum.Id);
            // now get the response
            request.RequestPageWithFullURL(url, commentForumXml, "text/xml");
            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            CommentInfo returnedComment = (CommentInfo)StringUtils.DeserializeObject(request.GetLastResponseAsString(), typeof(CommentInfo));
            Assert.IsNotNull(returnedComment.User);
            Assert.IsTrue(returnedComment.User.UserId == request.CurrentUserID);

            return returnedComment;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:21,代码来源:CommentForumCachingAndStats.cs

示例10: CreateComment

        /// <summary>
        /// Creates a comment for the given comment forum id
        /// </summary>
        /// <param name="commentForum"></param>
        /// <param name="comment">The comment to add</param>
        /// <returns>The created comment object</returns>
        public CommentInfo CreateComment(Forum commentForum, CommentInfo comment)
        {
            ISite site = SiteList.GetSite(commentForum.SiteName);
            bool ignoreModeration;
            bool forceModeration;
            var notes = string.Empty;
            string profanityxml = string.Empty;
            
            List<Term> terms = null;

            ValidateComment(commentForum, comment, site, out ignoreModeration, out forceModeration, out notes, out terms);

            if (terms != null && terms.Count > 0)
            {
                profanityxml = new Term().GetProfanityXML(terms);
            }

            //create unique comment hash
            Guid guid = DnaHasher.GenerateCommentHashValue(comment.text, commentForum.Id, CallingUser.UserID);
            //add comment to db
            try
            {
                using (IDnaDataReader reader = CreateReader("commentcreate"))
                {
                    reader.AddParameter("commentforumid", commentForum.Id);
                    reader.AddParameter("userid", CallingUser.UserID);
                    if (commentForum.isContactForm)
                    {
                        reader.AddParameter("content", CONTACT_POST_TEXT);
                    }
                    else
                    {
                        reader.AddParameter("content", comment.text);
                    }
                    reader.AddParameter("hash", guid);
                    reader.AddParameter("forcemoderation", forceModeration);
                    //reader.AddParameter("forcepremoderation", (commentForum.ModerationServiceGroup == ModerationStatus.ForumStatus.PreMod?1:0));
                    reader.AddParameter("ignoremoderation", ignoreModeration);
                    reader.AddParameter("isnotable", CallingUser.IsUserA(UserTypes.Notable));
                    reader.AddParameter("applyprocesspremodexpirytime", comment.ApplyProcessPremodExpiryTime);

                    if (CallingUser.UserID != commentForum.NotSignedInUserId)
                    {//dont include as this is data protection
                        reader.AddParameter("ipaddress", IpAddress);
                        reader.AddParameter("bbcuid", BbcUid);
                    }

                    if (CallingUser.UserID == commentForum.NotSignedInUserId && comment.User != null && !String.IsNullOrEmpty(comment.User.DisplayName))
                    {//add display name for not signed in comment
                        reader.AddParameter("nickname", comment.User.DisplayName);
                    }
                    reader.AddIntReturnValue();
                    reader.AddParameter("poststyle", (int) comment.PostStyle);
                    if (!String.IsNullOrEmpty(notes))
                    {
                        reader.AddParameter("modnotes", notes);
                    }

                    if (false == string.IsNullOrEmpty(profanityxml))
                    {
                        reader.AddParameter("profanityxml", profanityxml);
                    }

                    reader.Execute();

                    if (reader.HasRows && reader.Read())
                    {
//all good - create comment
                        comment.PreModPostingsModId = reader.GetInt32NullAsZero("PreModPostingModId");
                        comment.IsPreModerated = (reader.GetInt32NullAsZero("IsPreModerated") == 1);
                        comment.hidden = (comment.IsPreModerated
                                              ? CommentStatus.Hidden.Hidden_AwaitingPreModeration
                                              : CommentStatus.Hidden.NotHidden);
                        comment.text = CommentInfo.FormatComment(comment.text, comment.PostStyle, comment.hidden, CallingUser.IsUserA(UserTypes.Editor));
                        var displayName = CallingUser.UserName;
                        if (CallingUser.UserID == commentForum.NotSignedInUserId && comment.User != null && !String.IsNullOrEmpty(comment.User.DisplayName))
                        {//add display name for not signed in comment
                            displayName = comment.User.DisplayName;
                        }
                        comment.User = UserReadByCallingUser(site);
                        comment.User.DisplayName = displayName;
                        comment.Created = new DateTimeHelper(DateTime.Now);

                        if (reader.GetInt32NullAsZero("postid") != 0)
                        {
// no id as it is may be pre moderated
                            comment.ID = reader.GetInt32NullAsZero("postid");
                            var replacement = new Dictionary<string, string>();
                            replacement.Add("sitename", site.SiteName);
                            replacement.Add("postid", comment.ID.ToString());
                            comment.ComplaintUri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                                            SiteList.GetSiteOptionValueString(site.SiteID, "General", "ComplaintUrl")
                                                                                            , replacement);

//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:Comments.cs

示例11: CommentForum_ComplaintHideComment

        public void CommentForum_ComplaintHideComment()
        {
            CommentForum commentForum = new CommentForum
            {
                Id = Guid.NewGuid().ToString(),
                ParentUri = "http://www.bbc.co.uk/dna/h2g2/",
                Title = "testCommentForum"
            };

            CommentForum result = CreateForum(commentForum);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            Assert.IsTrue(result.commentSummary.Total == 0);

            //add a comment 
            CommentInfo comment = new CommentInfo { text = "this is a nunit generated comment." + Guid.NewGuid().ToString() };

            

            CreateComment(comment, result);

            //get forum again
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            Assert.IsTrue(result.commentSummary.Total == 1);

            // Now ste the closing date of the forum to something in the past.
            using (FullInputContext _context = new FullInputContext(true))
            {

                using (IDnaDataReader dataReader = _context.CreateDnaDataReader("hidepost"))
                {
                    dataReader.AddParameter("postid", result.commentList.comments[0].ID);
                    dataReader.AddParameter("hiddenid", 6);
                    dataReader.Execute();
                }
          
            }
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.commentList.comments[0].text == "This post has been removed.", "Comment not hidden!");
            Assert.IsTrue(result.commentList.comments[0].hidden == CommentStatus.Hidden.Removed_EditorComplaintTakedown);



        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:51,代码来源:CommentForumCachingAndStats.cs

示例12: CommentForum_PreMod_PassWithEdit

        public void CommentForum_PreMod_PassWithEdit()
        {
            CommentForum commentForum = new CommentForum
            {
                Id = Guid.NewGuid().ToString(),
                ParentUri = "http://www.bbc.co.uk/dna/h2g2/",
                Title = "testCommentForum",
                ModerationServiceGroup = ModerationStatus.ForumStatus.PreMod
            };

            CommentForum result = CreateForum(commentForum);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            Assert.IsTrue(result.commentSummary.Total == 0);

            //add a comment 
            CommentInfo comment = new CommentInfo { text = "this is a nunit generated comment." + Guid.NewGuid().ToString() };

            

            CreateComment(comment, result);

            //get forum again
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.commentList.comments[0].hidden == CommentStatus.Hidden.Hidden_AwaitingPreModeration);
            Assert.IsTrue(result.commentList.comments[0].text == "This post is awaiting moderation.", "Comment not hidden!");
            Assert.IsTrue(result.commentSummary.Total == 1);


            string newText = " this is editted text";
            // Now ste the closing date of the forum to something in the past.
            ModerateComment(result.commentList.comments[0].ID, result.ForumID, BBC.Dna.Component.ModeratePosts.Status.PassedWithEdit, newText);

            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.commentList.comments[0].text == newText);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:40,代码来源:CommentForumCachingAndStats.cs

示例13: CommentForum_ChangeCanWriteFlag

        public void CommentForum_ChangeCanWriteFlag()
        {
            CommentForum commentForum = new CommentForum
            {
                Id = Guid.NewGuid().ToString(),
                ParentUri = "http://www.bbc.co.uk/dna/h2g2/",
                Title = "testCommentForum"
            };

            CommentForum result = CreateForum(commentForum);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            Assert.IsTrue(result.commentSummary.Total == 0);

            //add a comment 
            CommentInfo comment = new CommentInfo { text = "this is a nunit generated comment." + Guid.NewGuid().ToString() };



            CreateComment(comment, result);

            //get forum again
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            Assert.IsTrue(result.commentSummary.Total == 1);
            Assert.IsFalse(result.isClosed);

            // Now ste the closing date of the forum to something in the past.
            using (FullInputContext _context = new FullInputContext(true))
            {
                using (IDnaDataReader dataReader = _context.CreateDnaDataReader("updatecommentforumstatus"))
                {
                    dataReader.AddParameter("uid", result.Id);
                    dataReader.AddParameter("canwrite", 0);
                    dataReader.Execute();
                }
            }
            result = ReadForum(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.isClosed);

            //try and read it again as json - to check the isclosed forum flag is honoured.
            result = ReadForumJson(result.Id);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.isClosed);
            


        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:54,代码来源:CommentForumCachingAndStats.cs

示例14: CommentsBySite_BasicAddCommentWithStatsCheck

        public void CommentsBySite_BasicAddCommentWithStatsCheck()
        {
            CommentForum commentForum = new CommentForum
            {
                Id = Guid.NewGuid().ToString(),
                ParentUri = "http://www.bbc.co.uk/dna/h2g2/",
                Title = "testCommentForum"
            };

            CommentForum result = CreateForum(commentForum);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.Id == commentForum.Id);
            Assert.IsTrue(result.ParentUri == commentForum.ParentUri);
            Assert.IsTrue(result.Title == commentForum.Title);
            Assert.IsTrue(result.commentSummary.Total == 0);

            //get total for this site
            CommentsList list = ReadCommentsReadBySite("");
            Assert.IsTrue(list.TotalCount != 0);

            CommentsList listPrefix = ReadCommentsReadBySite(commentForum.Id.Substring(0, 4));
            Assert.IsTrue(listPrefix.TotalCount == 0);

            //add a comment 
            CommentInfo comment = new CommentInfo { text = "this is a nunit generated comment." + Guid.NewGuid().ToString() };
            CreateComment(comment, result);

            //get total for this site
            CommentsList listAfter = ReadCommentsReadBySite("");
            Assert.IsTrue(listAfter.TotalCount == list.TotalCount+1);

            XmlDocument xStats = GetAllStatCounter();
            Assert.IsTrue(GetStatCounter(xStats, "RAWREQUESTS") == 5);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEHITS") == 0);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEMISSES") == 3);

            CommentsList listPrefixAfter = ReadCommentsReadBySite(commentForum.Id.Substring(0, 4));
            Assert.IsTrue(listPrefixAfter.TotalCount == 1);
            xStats = GetAllStatCounter();
            Assert.IsTrue(GetStatCounter(xStats, "RAWREQUESTS") == 6);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEHITS") == 0);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEMISSES") == 4);

            //reget totals
            listAfter = ReadCommentsReadBySite("");
            Assert.IsTrue(listAfter.TotalCount == list.TotalCount + 1);
            xStats = GetAllStatCounter();
            Assert.IsTrue(GetStatCounter(xStats, "RAWREQUESTS") == 7);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEHITS") == 1);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEMISSES") == 4);

            listPrefixAfter = ReadCommentsReadBySite(commentForum.Id.Substring(0, 4));
            Assert.IsTrue(listPrefixAfter.TotalCount == 1);
            xStats = GetAllStatCounter();
            Assert.IsTrue(GetStatCounter(xStats, "RAWREQUESTS") == 8);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEHITS") == 2);
            Assert.IsTrue(GetStatCounter(xStats, "HTMLCACHEMISSES") == 4);

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:59,代码来源:CommentForumCachingAndStats.cs

示例15: CreateRatingThreadCommentHtml

 public Stream CreateRatingThreadCommentHtml(string ratingForumID, string threadid, string siteName, NameValueCollection formsData)
 {
     CommentInfo ratingThreadCommentInfo = null;
     try
     {
         ratingThreadCommentInfo = new CommentInfo { text = formsData["text"] };
         if (!String.IsNullOrEmpty(formsData["PostStyle"]))
         {
             try
             {
                 ratingThreadCommentInfo.PostStyle =
                     (PostStyle.Style)Enum.Parse(typeof(PostStyle.Style), formsData["PostStyle"], true);
             }
             catch
             {
                 throw new DnaWebProtocolException(ApiException.GetError(ErrorType.InvalidPostStyle));
             }
         }
     }
     catch (ApiException ex)
     {
         throw new DnaWebProtocolException(ex);
     }
     return CreateRatingThreadComment(ratingForumID, threadid, siteName, ratingThreadCommentInfo);
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:25,代码来源:ReviewService.cs


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