public void TestTermIntListAddCorrectOrder()
        {
            TermInt32List tsl1 = new TermInt32List("000");

            tsl1.Add(null);
            tsl1.Add("0");
            try
            {
                tsl1.Add("1");
                tsl1.Add("2");
                tsl1.Add("3");
            }
            catch (Exception e)
            {
                Assert.False(e.Message.Contains("ascending order"), "There should NOT be an exception and the message contains ascending order");
                return;
            }
            tsl1.Seal();
            Assert.AreEqual(1, tsl1.IndexOf(0), "Should skip index 0 which is used for dummy null");
        }
        public void TestDefaultIntFacetIterator()
        {
            string format = "00";
            List <Int32FacetIterator> list = new List <Int32FacetIterator>();

            for (int seg = 0; seg < 5; seg++)
            {
                TermInt32List tsl1  = new TermInt32List(format);
                int           limit = 25;
                BigInt32Array count = new BigInt32Array(limit);
                string[]      terms = new string[limit];
                for (int i = limit - 1; i >= 0; i--)
                {
                    terms[i] = i.ToString(format);
                }
                Array.Sort(terms);
                for (int i = 0; i < limit; i++)
                {
                    tsl1.Add(terms[i]);
                    count.Add(i, i);
                }
                tsl1.Seal();
                DefaultInt32FacetIterator itr1 = new DefaultInt32FacetIterator(tsl1, count, limit, true);
                list.Add(itr1);
            }
            CombinedInt32FacetIterator ctr = new CombinedInt32FacetIterator(list);
            string result = "";

            while (ctr.HasNext())
            {
                ctr.Next();
                result += (ctr.Facet + ":" + ctr.Count + " ");
            }
            string expected = "1:5 2:10 3:15 4:20 5:25 6:30 7:35 8:40 9:45 10:50 11:55 12:60 13:65 14:70 15:75 16:80 17:85 18:90 19:95 20:100 21:105 22:110 23:115 24:120 ";

            Assert.AreEqual(expected, result);
        }