Lucene.Net.Index.TestStressIndexing2.VerifyEquals C# (CSharp) Method

VerifyEquals() public static method

public static VerifyEquals ( Lucene.Net.Documents.Document d1, Lucene.Net.Documents.Document d2 ) : void
d1 Lucene.Net.Documents.Document
d2 Lucene.Net.Documents.Document
return void
		public static void  VerifyEquals(Document d1, Document d2)
		{
            var ff1 = d1.GetFields().OrderBy(x => x.Name).ToList();
            var ff2 = d2.GetFields().OrderBy(x => x.Name).ToList();

			
			if (ff1.Count != ff2.Count)
			{
                System.Console.Out.WriteLine("[" + String.Join(",", ff1.Select(x => x.ToString()).ToArray()) + "]");
                System.Console.Out.WriteLine("[" + String.Join(",", ff2.Select(x => x.ToString()).ToArray()) + "]");
				Assert.AreEqual(ff1.Count, ff2.Count);
			}
			
			
			for (int i = 0; i < ff1.Count; i++)
			{
				IFieldable f1 = (IFieldable) ff1[i];
				IFieldable f2 = (IFieldable) ff2[i];
				if (f1.IsBinary)
				{
					System.Diagnostics.Debug.Assert(f2.IsBinary);
					//TODO
				}
				else
				{
					System.String s1 = f1.StringValue;
					System.String s2 = f2.StringValue;
					if (!s1.Equals(s2))
					{
						// print out whole doc on error
                        System.Console.Out.WriteLine("[" + String.Join(",", ff1.Select(x => x.ToString()).ToArray()) + "]");
                        System.Console.Out.WriteLine("[" + String.Join(",", ff2.Select(x => x.ToString()).ToArray()) + "]");
						Assert.AreEqual(s1, s2);
					}
				}
			}
		}
		

Same methods

TestStressIndexing2::VerifyEquals ( Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir2, System idField ) : void
TestStressIndexing2::VerifyEquals ( ITermFreqVector d1, ITermFreqVector d2 ) : void
TestStressIndexing2::VerifyEquals ( IndexReader r1, Lucene.Net.Store.Directory dir2, System idField ) : void
TestStressIndexing2::VerifyEquals ( IndexReader r1, IndexReader r2, System idField ) : void