This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 451ca45414e823bfe3a318e1dbad7c8ca48babb2
Author: Shad Storhaug <[email protected]>
AuthorDate: Sun Jun 28 16:13:43 2020 +0700

    Lucene.Net.TestFramework: Removed NUnit.CollectionAssert overloads
---
 .../Support/TestFramework/Assert.cs                | 28 ++++------------------
 src/Lucene.Net.TestFramework/Search/CheckHits.cs   | 18 +++++++-------
 .../Util/LuceneTestCase.cs                         |  2 +-
 src/Lucene.Net.TestFramework/Util/TestUtil.cs      |  6 ++---
 4 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/src/Lucene.Net.TestFramework.NUnit/Support/TestFramework/Assert.cs 
b/src/Lucene.Net.TestFramework.NUnit/Support/TestFramework/Assert.cs
index 303ce85..3a2be20 100644
--- a/src/Lucene.Net.TestFramework.NUnit/Support/TestFramework/Assert.cs
+++ b/src/Lucene.Net.TestFramework.NUnit/Support/TestFramework/Assert.cs
@@ -1,13 +1,11 @@
-using Lucene.Net.Support;
+using J2N.Text;
+using Lucene.Net.Support;
 using Lucene.Net.Support.IO;
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
-using J2N.Text;
-using NUnit.Framework.Constraints;
-using JCG = J2N.Collections.Generic;
 using _NUnit = NUnit.Framework;
+using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.TestFramework
 {
@@ -413,37 +411,21 @@ namespace Lucene.Net.TestFramework
         // From CollectionAssert
         public static void AreEqual<T>(T[] expected, T[] actual)
         {
-            // LUCENENET: Do the initial check with the (fast) J2N array 
comparison. If it fails,
-            // then use CollectionAssert to re-do the check in a slower way 
and generate the assert message.
             if 
(!J2N.Collections.ArrayEqualityComparer<T>.OneDimensional.Equals(expected, 
actual))
             {
-                _NUnit.CollectionAssert.AreEqual(expected, actual);
+                _NUnit.Assert.Fail("Expected: '{0}', Actual: '{1}'", 
FormatCollection(expected), FormatCollection(actual));
             }
         }
 
         // From CollectionAssert
         public static void AreEqual<T>(T[] expected, T[] actual, string 
message, params object[] args)
         {
-            // LUCENENET: Do the initial check with the (fast) J2N array 
comparison. If it fails,
-            // then use CollectionAssert to re-do the check in a slower way 
and generate the assert message.
             if 
(!J2N.Collections.ArrayEqualityComparer<T>.OneDimensional.Equals(expected, 
actual))
             {
-                _NUnit.CollectionAssert.AreEqual(expected, actual, message, 
args);
+                _NUnit.Assert.Fail(message, args);
             }
         }
 
-        // From CollectionAssert
-        public static void AreEqual(ICollection expected, ICollection actual)
-        {
-            _NUnit.CollectionAssert.AreEqual(expected, actual);
-        }
-
-        // From CollectionAssert
-        public static void AreEqual(ICollection expected, ICollection actual, 
string message, params object[] args)
-        {
-            _NUnit.CollectionAssert.AreEqual(expected, actual, message, args);
-        }
-
         //
         // Summary:
         //     Verifies that two objects are not equal. Two objects are 
considered equal if
diff --git a/src/Lucene.Net.TestFramework/Search/CheckHits.cs 
b/src/Lucene.Net.TestFramework/Search/CheckHits.cs
index 9aec282..ff9b103 100644
--- a/src/Lucene.Net.TestFramework/Search/CheckHits.cs
+++ b/src/Lucene.Net.TestFramework/Search/CheckHits.cs
@@ -119,17 +119,17 @@ namespace Lucene.Net.Search
 
             Trace.TraceInformation("Checked");
 
-            JCG.SortedSet<int?> correct = new JCG.SortedSet<int?>();
+            JCG.SortedSet<int> correct = new JCG.SortedSet<int>();
             for (int i = 0; i < results.Length; i++)
             {
                 correct.Add(Convert.ToInt32(results[i], 
CultureInfo.InvariantCulture));
             }
-            JCG.SortedSet<int?> actual = new JCG.SortedSet<int?>();
+            JCG.SortedSet<int> actual = new JCG.SortedSet<int>();
             ICollector c = new SetCollector(actual);
 
             searcher.Search(query, c);
 
-            Assert.AreEqual(correct, actual, "Simple: " + 
query.ToString(defaultFieldName));
+            Assert.AreEqual(correct, actual, aggressive: false, "Simple: " + 
query.ToString(defaultFieldName));
 
             for (int i = -1; i < 2; i++)
             {
@@ -140,7 +140,7 @@ namespace Lucene.Net.Search
 #endif
                     random, searcher, i);
                 s.Search(query, c);
-                Assert.AreEqual(correct, actual, "Wrap Reader " + i + ": " + 
query.ToString(defaultFieldName));
+                Assert.AreEqual(correct, actual, aggressive: false, "Wrap 
Reader " + i + ": " + query.ToString(defaultFieldName));
             }
         }
 
@@ -181,19 +181,19 @@ namespace Lucene.Net.Search
         {
             ScoreDoc[] hits = searcher.Search(query, 1000).ScoreDocs;
 
-            SortedSet<int?> correct = new SortedSet<int?>();
+            JCG.SortedSet<int> correct = new JCG.SortedSet<int>();
             for (int i = 0; i < results.Length; i++)
             {
                 correct.Add(Convert.ToInt32(results[i], 
CultureInfo.InvariantCulture));
             }
 
-            SortedSet<int?> actual = new SortedSet<int?>();
+            JCG.SortedSet<int> actual = new JCG.SortedSet<int>();
             for (int i = 0; i < hits.Length; i++)
             {
                 actual.Add(Convert.ToInt32(hits[i].Doc, 
CultureInfo.InvariantCulture));
             }
 
-            Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
+            Assert.AreEqual(correct, actual, aggressive: false, 
query.ToString(defaultFieldName));
 
             QueryUtils.Check(
 #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION
@@ -466,9 +466,9 @@ namespace Lucene.Net.Search
     /// </summary>
     public class SetCollector : ICollector
     {
-        internal readonly ISet<int?> bag;
+        internal readonly ISet<int> bag;
 
-        public SetCollector(ISet<int?> bag)
+        public SetCollector(ISet<int> bag)
         {
             this.bag = bag;
         }
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs 
b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index a05084f..816f191 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2951,7 +2951,7 @@ namespace Lucene.Net.Util
                 right.Add(fi.Name);
             }
 
-            Assert.AreEqual(left, right, info);
+            Assert.AreEqual(left, right, aggressive: false, info);
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs 
b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index d54c2df..200ac16 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -1031,12 +1031,12 @@ namespace Lucene.Net.Util
         /// <param name="reflectedValues"> Contains a <see 
cref="IDictionary{String, Object}"/> with "AttributeSubclassType/key" as 
values.</param>
         public static void AssertAttributeReflection(Attribute att, 
IDictionary<string, object> reflectedValues)
         {
-            IDictionary<string, object> map = new Dictionary<string, object>();
+            IDictionary<string, object> map = new JCG.Dictionary<string, 
object>();
             att.ReflectWith(new 
AttributeReflectorAnonymousInnerClassHelper(map));
-            IDictionary<string, object> newReflectedObjects = new 
Dictionary<string, object>();
+            IDictionary<string, object> newReflectedObjects = new 
JCG.Dictionary<string, object>();
             foreach (KeyValuePair<string, object> de in reflectedValues)
                 newReflectedObjects.Add(de.Key, (object)de.Value);
-            Assert.AreEqual((ICollection)newReflectedObjects, 
(ICollection)map, "Reflection does not produce same map");
+            Assert.AreEqual(newReflectedObjects, map, aggressive: false, 
"Reflection does not produce same map");
         }
 
         private class AttributeReflectorAnonymousInnerClassHelper : 
IAttributeReflector

Reply via email to