Lucene.Net.Index.TestLazyBug.DoTest C# (CSharp) Method

DoTest() public method

public DoTest ( int docs ) : void
docs int
return void
		public virtual void  DoTest(int[] docs)
		{
            if (dataset.Count == 0)
                for (int i = 0; i < data.Length; i++)
                    dataset.Add(data[i], data[i]);

			Directory dir = MakeIndex();
		    IndexReader reader = IndexReader.Open(dir, true);
			for (int i = 0; i < docs.Length; i++)
			{
				Document d = reader.Document(docs[i], SELECTOR);
				d.Get(MAGIC_FIELD);
				
				var fields = d.GetFields();
				for (System.Collections.IEnumerator fi = fields.GetEnumerator(); fi.MoveNext(); )
				{
					IFieldable f = null;
					try
					{
						f = (IFieldable) fi.Current;
						System.String fname = f.Name;
						System.String fval = f.StringValue;
						Assert.IsNotNull(docs[i] + " FIELD: " + fname, fval);
						System.String[] vals = fval.Split('#');
                        Assert.IsTrue(dataset.Contains(vals[0]) || dataset.Contains(vals[1]), "FIELD:" + fname + ",VAL:" + fval);
					}
					catch (System.Exception e)
					{
						throw new Exception(docs[i] + " WTF: " + f.Name, e);
					}
				}
			}
			reader.Close();
		}