You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2007/08/14 21:47:12 UTC

svn commit: r565883 - /incubator/lucene.net/trunk/C#/src/Test/Search/CheckHits.cs

Author: aroush
Date: Tue Aug 14 12:47:11 2007
New Revision: 565883

URL: http://svn.apache.org/viewvc?view=rev&rev=565883
Log:
Fix: LUCENENET-58 "Issue in CheckHits c# doesn't perform an Assert against a hashtable"

Modified:
    incubator/lucene.net/trunk/C#/src/Test/Search/CheckHits.cs

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/CheckHits.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/CheckHits.cs?view=diff&rev=565883&r1=565882&r2=565883
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/CheckHits.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/CheckHits.cs Tue Aug 14 12:47:11 2007
@@ -93,15 +93,20 @@
         public static void  CheckHitCollector(Query query, System.String defaultFieldName, Searcher searcher, int[] results)
         {
 			
-            System.Collections.Hashtable correct = new System.Collections.Hashtable();
+            System.Collections.ArrayList correct = new System.Collections.ArrayList(results.Length);
             for (int i = 0; i < results.Length; i++)
             {
-                correct.Add((System.Int32) results[i], (System.Int32) results[i]);
+                correct.Add(results[i]);
             }
 			
             System.Collections.Hashtable actual = new System.Collections.Hashtable();
             searcher.Search(query, new AnonymousClassHitCollector(actual));
-            Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
+
+            System.Collections.IDictionaryEnumerator e = actual.GetEnumerator();
+            while (e.MoveNext())
+            {
+                Assert.Contains(e.Key, correct, query.ToString(defaultFieldName));
+            }
 			
             QueryUtils.Check(query, searcher);
         }
@@ -134,19 +139,16 @@
 			
             Hits hits = searcher.Search(query);
 			
-            System.Collections.Hashtable correct = new System.Collections.Hashtable();
+            System.Collections.ArrayList correct = new System.Collections.ArrayList(results.Length);
             for (int i = 0; i < results.Length; i++)
             {
-                correct.Add((System.Int32) results[i], (System.Int32) results[i]);
+                correct.Add(results[i]);
             }
 			
-            System.Collections.Hashtable actual = new System.Collections.Hashtable();
             for (int i = 0; i < hits.Length(); i++)
             {
-                actual.Add((System.Int32) hits.Id(i), (System.Int32) hits.Id(i));
+                Assert.Contains(hits.Id(i), correct, query.ToString(defaultFieldName));
             }
-			
-            Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
 			
             QueryUtils.Check(query, searcher);
         }