コード例 #1
0
        /// <summary>
        /// Functions generates the Try Create Review Forum Builder XML
        /// </summary>
        /// <param name="ID">ID of the review forum to get</param>
        /// <param name="skip">Number to skip</param>
        /// <param name="show">Number to show</param>
        /// <param name="orderBy">Ordering of the review forum</param>
        /// <param name="direction">Direction of ordering </param>
        /// <param name="entry">Whether we need to add a description at the top</param>
        public void TryCreateReviewForumBuilderXML(int ID, int skip, int show, ReviewForum.OrderBy orderBy, bool direction, bool entry)
        {
            ReviewForum reviewForum = new ReviewForum(InputContext);

            reviewForum.InitialiseViaReviewForumID(ID, false);

            if (SwitchSites(reviewForum.SiteID, ID, skip, show, orderBy, direction, entry))
            {
                return;
            }

            reviewForum.GetReviewForumThreadList(show, skip, orderBy, direction);
            //add the entry 
            if (entry)
            {
                GuideEntrySetup guideEntrySetup = new GuideEntrySetup(reviewForum.H2G2ID);
                //guideEntrySetup.ShowReferences = true;
                guideEntrySetup.SafeToCache = true;

                GuideEntry guideEntry = new GuideEntry(InputContext, guideEntrySetup);
                guideEntry.Initialise();

                _GuideEntryElement = CreateElement("ROOT");
                _GuideEntryElement.AppendChild(ImportNode(guideEntry.RootElement.FirstChild));
            }
            //add the fact that we don't want/have an entry
            else
            {
                _GuideEntryElement = CreateElement("ROOT");
                AddElementTag(_GuideEntryElement, "NOGUIDE");
            }

            AddInside(reviewForum);
        }
コード例 #2
0
ファイル: ReviewForumTests.cs プロジェクト: rocketeerbkw/DNA
        private void PerformTest(ReviewForum.OrderBy orderBy)
        {
            int forumID = SubmitArticleForReview();
            ReviewForum reviewForum = new ReviewForum(_context);

            reviewForum.InitialiseViaReviewForumID(1, true);

            reviewForum.GetReviewForumThreadList(20, 0, orderBy, false);

            XmlElement xml = reviewForum.RootElement;

            Assert.IsTrue(xml.SelectSingleNode("REVIEWFORUM/REVIEWFORUMTHREADS") != null, "The xml is not generated correctly!!!");
            
            Assert.IsTrue(xml.SelectSingleNode("REVIEWFORUM/REVIEWFORUMTHREADS[@ORDERBY='" + ((int) orderBy).ToString() +"']") != null, "The xml is not generated correctly - ORDER BY!!!");

            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
        }