コード例 #1
0
        public void IntEnumTest()
        {
            using (IntFieldEnumerator ife = new IntFieldEnumerator(reader, "string", FieldParser.String))
            {
                int value = 0;
                foreach (int i in ife.Terms)
                {
                    foreach (int doc in ife.Docs)
                    {
                        int expected = Int32.Parse(reader.Document(doc).Get("string"));
                        Assert.AreEqual(expected, i);
                    }
                    value++;
                }
                Assert.AreEqual(1000, value);
            }

            using (IntFieldEnumerator ife = new IntFieldEnumerator(reader, "int", FieldParser.Numeric))
            {
                int value = 0;
                foreach (int i in ife.Terms)
                {
                    foreach (int doc in ife.Docs)
                    {
                        int expected = Int32.Parse(reader.Document(doc).Get("int"));
                        Assert.AreEqual(expected, i);
                    }
                    value++;
                }
                Assert.AreEqual(1000, value);
            }
        }
コード例 #2
0
        public void IntEnumTest()
        {
            using (IntFieldEnumerator ife = new IntFieldEnumerator(reader, "string", FieldParser.String))
            {
                int value = 0;
                foreach (int i in ife.Terms)
                {
                    foreach (int doc in ife.Docs)
                    {
                        int expected = Int32.Parse(reader.Document(doc).Get("string"));
                        Assert.AreEqual(expected, i);
                    }
                    value++;
                }
                Assert.AreEqual(1000, value);
            }

            using (IntFieldEnumerator ife = new IntFieldEnumerator(reader, "int", FieldParser.Numeric))
            {
                int value = 0;
                foreach (int i in ife.Terms)
                {
                    foreach (int doc in ife.Docs)
                    {
                        int expected = Int32.Parse(reader.Document(doc).Get("int"));
                        Assert.AreEqual(expected, i);
                    }
                    value++;
                }
                Assert.AreEqual(1000, value);
            }
        }