예제 #1
0
        public void CompileSuggestionsListTest()
        {
            List <List <TagData> > pages;
            List <TagData>         tagData = new List <TagData>();
            const int MaxFields            = 25;

            for (int i = 0; i < 105; i++)
            {
                tagData.Add(new TagData("a", 1, 1));
            }

            pages = TagParser.CompileSuggestions(tagData, MaxFields);

            Assert.AreEqual(5, pages.Count);
            Assert.AreEqual(MaxFields, pages[0].Count);
            Assert.AreEqual(MaxFields, pages[1].Count);
            Assert.AreEqual(MaxFields, pages[2].Count);
            Assert.AreEqual(MaxFields, pages[3].Count);
            Assert.AreEqual(5, pages[4].Count);

            tagData.Clear();

            for (int i = 0; i < 100; i++)
            {
                tagData.Add(new TagData("a", 1, 1));
            }

            pages = TagParser.CompileSuggestions(tagData, MaxFields);

            Assert.AreEqual(4, pages.Count);
            Assert.AreEqual(MaxFields, pages[0].Count);
            Assert.AreEqual(MaxFields, pages[1].Count);
            Assert.AreEqual(MaxFields, pages[2].Count);
            Assert.AreEqual(MaxFields, pages[3].Count);
        }