lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [07/20] lucenenet git commit: Fixed all OneTimeSetUp and OneTimeTearDown methods to be named BeforeClass() and AfterClass() and called base classes to ensure correct calling order
Date Tue, 28 Feb 2017 12:29:58 GMT
Fixed all OneTimeSetUp and OneTimeTearDown methods to be named BeforeClass() and AfterClass() and called base classes to ensure correct calling order


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/6de19b95
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/6de19b95
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/6de19b95

Branch: refs/heads/api-work
Commit: 6de19b957fb438755d0559d9cfdec27e06432f52
Parents: e70f4c7
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Feb 28 02:07:54 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Tue Feb 28 05:09:25 2017 +0700

----------------------------------------------------------------------
 .../Index/BasePostingsFormatTestCase.cs                      | 7 +++++--
 .../Search/RandomSimilarityProvider.cs                       | 1 -
 .../Search/SearchEquivalenceTestBase.cs                      | 3 ++-
 .../Util/TestRuleSetupAndRestoreClassEnv.cs                  | 2 +-
 .../Analysis/Core/TestRandomChains.cs                        | 4 +++-
 .../Analysis/Hunspell/TestHunspellStemFilter.cs              | 3 ++-
 .../Taxonomy/TestTaxonomyFacetAssociations.cs                | 4 +++-
 .../Taxonomy/TestTaxonomyFacetCounts2.cs                     | 7 +++++--
 src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs             | 8 ++++++--
 src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs       | 7 +++++--
 src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs   | 4 +++-
 src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs     | 8 ++++++--
 .../Index/Sorter/SortingAtomicReaderTest.cs                  | 3 ++-
 src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs          | 8 ++++++--
 .../Flexible/Precedence/TestPrecedenceQueryParser.cs         | 6 ++++--
 .../Flexible/Standard/TestNumericQueryParser.cs              | 4 +++-
 .../Flexible/Standard/TestQPHelper.cs                        | 3 ++-
 src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs | 3 ++-
 src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs           | 4 ++--
 .../Queries/TestSortedSetSortFieldSelectors.cs               | 8 ++++++--
 .../Codecs/Lucene3x/TestTermInfosReaderIndex.cs              | 5 ++++-
 src/Lucene.Net.Tests/Index/Test2BDocs.cs                     | 5 +++--
 src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs     | 7 +++++--
 src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs   | 7 +++++--
 src/Lucene.Net.Tests/Index/TestFieldsReader.cs               | 3 ++-
 src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs   | 3 ++-
 src/Lucene.Net.Tests/Index/TestIndexInput.cs                 | 3 ++-
 src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs           | 7 +++++--
 src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs | 3 ++-
 src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs | 5 ++++-
 src/Lucene.Net.Tests/Search/Spans/TestBasics.cs              | 3 ++-
 .../Search/Spans/TestFieldMaskingSpanQuery.cs                | 3 ++-
 src/Lucene.Net.Tests/Search/TestBoolean2.cs                  | 3 ++-
 src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs     | 3 ++-
 src/Lucene.Net.Tests/Search/TestDateFilter.cs                | 8 ++++++--
 src/Lucene.Net.Tests/Search/TestExplanations.cs              | 7 +++++--
 src/Lucene.Net.Tests/Search/TestFieldCache.cs                | 3 ++-
 src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs           | 3 ++-
 src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs    | 3 ++-
 src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs    | 3 ++-
 src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs          | 3 ++-
 src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs       | 3 ++-
 src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs       | 3 ++-
 src/Lucene.Net.Tests/Search/TestPhraseQuery.cs               | 4 +++-
 src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs      | 4 +++-
 src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs            | 8 ++++++--
 src/Lucene.Net.Tests/Search/TestTermVectors.cs               | 4 +++-
 47 files changed, 150 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index 397050f..4715fc2 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -368,8 +368,10 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeSetUp]
-        public static void CreatePostings()
+        public override void BeforeClass() // Renamed from CreatePostings to ensure the base class setup is called before this one
         {
+            base.BeforeClass();
+
             TotalPostings = 0;
             TotalPayloadBytes = 0;
             Fields = new SortedDictionary<string, SortedDictionary<BytesRef, long>>();
@@ -486,12 +488,13 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             AllTerms = null;
             FieldInfos = null;
             Fields = null;
             GlobalLiveDocs = null;
+            base.AfterClass();
         }
 
         // TODO maybe instead of @BeforeClass just make a single test run: build postings & index & test it?

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs b/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
index fb80307..a616bf1 100644
--- a/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
+++ b/src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
@@ -74,7 +74,6 @@ namespace Lucene.Net.Search
             ShouldQueryNorm = random.NextBoolean();
             KnownSims = new List<Similarity>(AllSims);
             Collections.Shuffle(KnownSims, random);
-            //Collections.shuffle(KnownSims, random);
         }
 
         public override float Coord(int overlap, int maxOverlap)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs b/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
index 312203b..5b8dec1 100644
--- a/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
+++ b/src/Lucene.Net.TestFramework/Search/SearchEquivalenceTestBase.cs
@@ -109,7 +109,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Directory.Dispose();
@@ -118,6 +118,7 @@ namespace Lucene.Net.Search
             Directory = null;
             Analyzer = null;
             S1 = S2 = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index ce0ddfa..bef99b6 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -268,7 +268,7 @@ namespace Lucene.Net.Util
             //TimeZone = testTimeZone.Equals("random") ? randomTimeZone : TimeZone.getTimeZone(testTimeZone);
             //TimeZone.Default = TimeZone;
 
-            similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(new Random(1));
+            similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new RandomSimilarityProvider(random);
             
             // Check codec restrictions once at class level.
             try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
index 2f7ccb3..2607c19 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
@@ -260,11 +260,13 @@ namespace Lucene.Net.Analysis.Core
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             tokenizers = null;
             tokenfilters = null;
             charfilters = null;
+
+            base.AfterClass();
         }
 
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
index 799544d..8873b7a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestHunspellStemFilter.cs
@@ -46,9 +46,10 @@ namespace Lucene.Net.Analysis.Hunspell
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             dictionary = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
index d67e1f5..6f3b1e5 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetAssociations.cs
@@ -95,7 +95,7 @@ namespace Lucene.Net.Facet.Taxonomy
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             reader.Dispose();
             reader = null;
@@ -105,6 +105,8 @@ namespace Lucene.Net.Facet.Taxonomy
             taxoReader = null;
             taxoDir.Dispose();
             taxoDir = null;
+
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
index ab94a16..ef1f02c 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs
@@ -86,9 +86,10 @@ namespace Lucene.Net.Facet.Taxonomy
         private static IDictionary<string, int?> allExpectedCounts, termExpectedCounts;
 
         [OneTimeTearDown]
-        public static void AfterClassCountingFacetsAggregatorTest()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassCountingFacetsAggregatorTest() to ensure calling order
         {
             IOUtils.Close(indexDir, taxoDir);
+            base.AfterClass();
         }
 
         private static IList<FacetField> RandomCategories(Random random)
@@ -246,8 +247,10 @@ namespace Lucene.Net.Facet.Taxonomy
         }
 
         [OneTimeSetUp]
-        public void BeforeClassCountingFacetsAggregatorTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassCountingFacetsAggregatorTest() to ensure calling order
         {
+            base.BeforeClass();
+
             indexDir = NewDirectory();
             taxoDir = NewDirectory();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs b/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
index 2ab70d8..4227f8c 100644
--- a/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
+++ b/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Facet
 
       
         [OneTimeTearDown]
-        public static void AfterClassDrillDownQueryTest()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassDrillDownQueryTest() to ensure calling order
         {
             IOUtils.Close(reader, taxo, dir, taxoDir);
             reader = null;
@@ -65,11 +65,15 @@ namespace Lucene.Net.Facet
             dir = null;
             taxoDir = null;
             config = null;
+
+            base.AfterClass();
         }
 
         [OneTimeSetUp]
-        public void BeforeClassDrillDownQueryTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassDrillDownQueryTest() to ensure calling order
         {
+            base.BeforeClass();
+
             dir = NewDirectory();
             Random r = Random();
             RandomIndexWriter writer = new RandomIndexWriter(r, dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(r, MockTokenizer.KEYWORD, false)));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
index 228cb8b..cacef9e 100644
--- a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
+++ b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
@@ -21,7 +21,7 @@ namespace Lucene.Net.Documents
         public Directory dir = NewDirectory();
 
         [OneTimeTearDown]
-        public void RemoveIndex()
+        public override void AfterClass() // LUCENENET specific - changed from CreateIndex() to ensure calling order vs base class
         {
             if (null != dir)
             {
@@ -32,11 +32,14 @@ namespace Lucene.Net.Documents
                 }
                 catch (Exception /*e*/) { /* NOOP */ }
             }
+
+            base.AfterClass();
         }
 
         [OneTimeSetUp]
-        public void CreateIndex()
+        public override void BeforeClass() // LUCENENET specific - changed from CreateIndex() to ensure calling order vs base class
         {
+            base.BeforeClass();
 
             Analyzer analyzer = new MockAnalyzer(Random());
             IndexWriter writer = new IndexWriter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
index 455d9ef..2baad9a 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs
@@ -34,8 +34,10 @@ namespace Lucene.Net.Index.Sorter
         };
 
         [OneTimeSetUp]
-        public void BeforeClassSorterUtilTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassSorterUtilTest() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             // only read the values of the undeleted documents, since after addIndexes,
             // the deleted ones will be dropped from the index.
             IBits liveDocs = reader.LiveDocs;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
index 9e2ad28..b78f64f 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
@@ -214,8 +214,10 @@ namespace Lucene.Net.Index.Sorter
         }
 
         [OneTimeSetUp]
-        public void BeforeClassSorterTestBase()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassSorterTestBase() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             dir = NewDirectory();
             int numDocs = AtLeast(20);
             CreateIndex(dir, numDocs, Random());
@@ -224,10 +226,12 @@ namespace Lucene.Net.Index.Sorter
         }
 
         [OneTimeTearDown]
-        public static void AfterClassSorterTestBase()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassSorterTestBase() to ensure calling order vs base class
         {
             reader.Dispose();
             dir.Dispose();
+
+            base.AfterClass();
         }
 
         // [Test] // LUCENENET NOTE: For now, we are overriding this test in every subclass to pull it into the right context for the subclass

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
index b296091..191830b 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs
@@ -26,8 +26,9 @@ namespace Lucene.Net.Index.Sorter
     public class SortingAtomicReaderTest : SorterTestBase
     {
         [OneTimeSetUp]
-        public static void BeforeClassSortingAtomicReaderTest()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassSortingAtomicReaderTest() to ensure calling order vs base class
         {
+            base.BeforeClass();
 
             // sort the index by id (as integer, in NUMERIC_DV_FIELD)
             Sort sort = new Sort(new SortField(NUMERIC_DV_FIELD, SortFieldType.INT32));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
index 5b27e86..dadac2a 100644
--- a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
+++ b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
@@ -16,8 +16,10 @@ namespace Lucene.Net.Misc
         private static IndexReader reader = null;
 
         [OneTimeSetUp]
-        public void SetUpClass()
+        public override void BeforeClass() // LUCENENET specific - renamed from SetUpClass() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             dir = NewDirectory();
             writer = new IndexWriter(dir, NewIndexWriterConfig(Random(),
                TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, false))
@@ -28,13 +30,15 @@ namespace Lucene.Net.Misc
         }
 
         [OneTimeTearDown]
-        public static void TearDownClass()
+        public override void AfterClass() // LUCENENET specific - renamed from TearDownClass() to ensure calling order vs base class
         {
             reader.Dispose();
             dir.Dispose();
             dir = null;
             reader = null;
             writer = null;
+
+            base.AfterClass();
         }
         /******************** Tests for getHighFreqTerms **********************************/
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
index 4f82620..fe62cda 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
@@ -47,15 +47,17 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
         public static Analyzer qpAnalyzer;
 
         [OneTimeSetUp]
-        public static void beforeClass()
+        public override void BeforeClass()
         {
+            base.BeforeClass();
             qpAnalyzer = new QPTestAnalyzer();
         }
 
         [OneTimeTearDown]
-        public static void afterClass()
+        public override void AfterClass()
         {
             qpAnalyzer = null;
+            base.AfterClass();
         }
 
         public sealed class QPTestFilter : TokenFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 179cf27..99ba96f 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -570,7 +570,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             searcher = null;
             reader.Dispose();
@@ -578,6 +578,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             directory.Dispose();
             directory = null;
             qp = null;
+
+            base.AfterClass();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
index e157111..5c4fa18 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
@@ -57,9 +57,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             qpAnalyzer = null;
+            base.AfterClass();
         }
 
         public sealed class QPTestFilter : TokenFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
index f4471ab..ffffc76 100644
--- a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
@@ -33,9 +33,10 @@ namespace Lucene.Net.QueryParsers.Util
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             qpAnalyzer = null;
+            base.AfterClass();
         }
 
         public sealed class QPTestFilter : TokenFilter

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
index f8de85a..6aae1a4 100644
--- a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs
@@ -70,11 +70,10 @@ namespace Lucene.Net.QueryParsers.Xml
             writer.Dispose();
             reader = DirectoryReader.Open(dir);
             searcher = NewSearcher(reader);
-
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             reader.Dispose();
             dir.Dispose();
@@ -82,6 +81,7 @@ namespace Lucene.Net.QueryParsers.Xml
             searcher = null;
             dir = null;
             builder = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs b/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
index 6187dcc..76a0ef5 100644
--- a/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
+++ b/src/Lucene.Net.Tests.Sandbox/Queries/TestSortedSetSortFieldSelectors.cs
@@ -37,8 +37,10 @@ namespace Lucene.Net.Sandbox.Queries
         static Codec savedCodec;
 
         [OneTimeSetUp]
-        public static void beforeClass()
+        public override void BeforeClass()
         {
+            base.BeforeClass();
+
             savedCodec = Codec.Default;
             // currently only these codecs that support random access ordinals
             int victim = Random().nextInt(3);
@@ -51,9 +53,11 @@ namespace Lucene.Net.Sandbox.Queries
         }
 
         [OneTimeTearDown]
-        public static void afterClass()
+        public override void AfterClass()
         {
             Codec.Default = (savedCodec);
+
+            base.AfterClass();
         }
 
         public override void SetUp()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
index 246a3ec..d522254 100644
--- a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
+++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
@@ -70,6 +70,8 @@ namespace Lucene.Net.Codecs.Lucene3x
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             // NOTE: turn off compound file, this test will open some index files directly.
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
             IndexWriterConfig config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.KEYWORD, false)).SetUseCompoundFile(false);
@@ -112,7 +114,7 @@ namespace Lucene.Net.Codecs.Lucene3x
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             TermEnum.Dispose();
             Reader.Dispose();
@@ -122,6 +124,7 @@ namespace Lucene.Net.Codecs.Lucene3x
             Directory = null;
             Index = null;
             SampleTerms = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/Test2BDocs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/Test2BDocs.cs b/src/Lucene.Net.Tests/Index/Test2BDocs.cs
index 2c8c5a9..f7ce0f7 100644
--- a/src/Lucene.Net.Tests/Index/Test2BDocs.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BDocs.cs
@@ -46,14 +46,15 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             Dir.Dispose();
             Dir = null;
             base.TearDown();
+            base.AfterClass();
         }
 
-        public override void TearDown()
+        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
         {
             // LUCENENET: We don't want our temp directory deleted until after
             // all of the tests in the class run. So we need to override this and

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
index 163bbc7..c815c91 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -202,6 +202,8 @@ namespace Lucene.Net.Index
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             Assert.IsFalse(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "test infra is broken!");
             IList<string> names = new List<string>(OldNames.Length + OldSingleSegmentNames.Length);
             names.AddRange(Arrays.AsList(OldNames));
@@ -219,7 +221,7 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             foreach (Directory d in OldIndexDirs.Values)
             {
@@ -227,9 +229,10 @@ namespace Lucene.Net.Index
             }
             OldIndexDirs = null;
             base.TearDown();
+            base.AfterClass();
         }
 
-        public override void TearDown()
+        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
         {
             // LUCENENET: We don't want our temp directory deleted until after
             // all of the tests in the class run. So we need to override this and

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
index 19a2e98..8b437ac 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -131,6 +131,8 @@ namespace Lucene.Net.Index
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             assertFalse("test infra is broken!", OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             IList<string> names = new List<string>(OldNames.Length + OldSingleSegmentNames.Length);
             names.AddRange(Arrays.AsList(OldNames));
@@ -148,7 +150,7 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public void AfterClass()
+        public override void AfterClass()
         {
             foreach (Directory d in OldIndexDirs.Values)
             {
@@ -156,9 +158,10 @@ namespace Lucene.Net.Index
             }
             OldIndexDirs = null;
             base.TearDown();
+            base.AfterClass();
         }
 
-        public override void TearDown()
+        public override void TearDown() // LUCENENET TODO: Fix teardown for directories
         {
             // LUCENENET: We don't want our temp directory deleted until after
             // all of the tests in the class run. So we need to override this and

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestFieldsReader.cs b/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
index 698eacd..86ef767 100644
--- a/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestFieldsReader.cs
@@ -70,12 +70,13 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Dir.Dispose();
             Dir = null;
             FieldInfos = null;
             TestDoc = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
index c9bf2e1..9aa5936 100644
--- a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs
@@ -47,10 +47,11 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             LineDocFile.Dispose();
             LineDocFile = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Index/TestIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexInput.cs b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
index 82e293a..a0ded79 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexInput.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexInput.cs
@@ -74,11 +74,12 @@ namespace Lucene.Net.Index
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             INTS = null;
             LONGS = null;
             RANDOM_TEST_BYTES = null;
+            base.AfterClass();
         }
 
         private void CheckReads(DataInput @is, Type expectedEx)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs b/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
index 3bd412e..0d907e7 100644
--- a/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
+++ b/src/Lucene.Net.Tests/Search/BaseTestRangeFilter.cs
@@ -101,8 +101,10 @@ namespace Lucene.Net.Search
         /// longer static.
         /// </summary>
         [OneTimeSetUp]
-        public void BeforeClassBaseTestRangeFilter()
+        public override void BeforeClass() // LUCENENET specific: renamed from BeforeClassBaseTestRangeFilter() so we can override to control the order of execution
         {
+            base.BeforeClass();
+
             MaxId = AtLeast(500);
             SignedIndexDir = new TestIndex(Random(), int.MaxValue, int.MinValue, true);
             UnsignedIndexDir = new TestIndex(Random(), int.MaxValue, 0, false);
@@ -111,7 +113,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClassBaseTestRangeFilter()
+        public override void AfterClass() // LUCENENET specific: renamed from AfterClassBaseTestRangeFilter() so we can override to control the order of execution
         {
             SignedIndexReader.Dispose();
             UnsignedIndexReader.Dispose();
@@ -121,6 +123,7 @@ namespace Lucene.Net.Search
             UnsignedIndexReader = null;
             SignedIndexDir = null;
             UnsignedIndexDir = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
index c21fbb8..fe840dc 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
@@ -138,13 +138,14 @@ namespace Lucene.Net.Search.Payloads
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
index 44f70c3..3260d41 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
@@ -122,6 +122,8 @@ namespace Lucene.Net.Search.Payloads
         [OneTimeSetUp]
         public override void BeforeClass()
         {
+            base.BeforeClass();
+
             Directory = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()).SetSimilarity(similarity).SetMergePolicy(NewLogMergePolicy()));
             //writer.infoStream = System.out;
@@ -143,13 +145,14 @@ namespace Lucene.Net.Search.Payloads
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs b/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
index de0dfb8..111b332 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestBasics.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Search.Spans
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Directory.Dispose();
@@ -142,6 +142,7 @@ namespace Lucene.Net.Search.Spans
             Reader = null;
             Directory = null;
             SimplePayloadAnalyzer = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs b/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
index a4c144a..3ffc936 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestFieldMaskingSpanQuery.cs
@@ -81,13 +81,14 @@ namespace Lucene.Net.Search.Spans
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         protected internal virtual void Check(SpanQuery q, int[] docs)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestBoolean2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/Search/TestBoolean2.cs
index 093b0d1..7c9b66d 100644
--- a/src/Lucene.Net.Tests/Search/TestBoolean2.cs
+++ b/src/Lucene.Net.Tests/Search/TestBoolean2.cs
@@ -123,7 +123,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             LittleReader.Dispose();
@@ -135,6 +135,7 @@ namespace Lucene.Net.Search
             Dir2 = null;
             Directory = null;
             BigSearcher = null;
+            base.AfterClass();
         }
 
         private static string[] DocFields = new string[] { "w1 w2 w3 w4 w5", "w1 w3 w2 w3", "w1 xx w2 yy w3", "w1 w3 xx w2 yy w3" };

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
index 3fe841a..83cfb16 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs
@@ -77,13 +77,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             s = null;
             r.Dispose();
             r = null;
             Index.Dispose();
             Index = null;
+            base.AfterClass();
         }
 
         public virtual void VerifyNrHits(Query q, int expected)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestDateFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestDateFilter.cs b/src/Lucene.Net.Tests/Search/TestDateFilter.cs
index 11e62e1..4bdb093 100644
--- a/src/Lucene.Net.Tests/Search/TestDateFilter.cs
+++ b/src/Lucene.Net.Tests/Search/TestDateFilter.cs
@@ -42,8 +42,10 @@ namespace Lucene.Net.Search
     {
         ///
         [OneTimeSetUp]
-        public virtual void TestBefore()
+        public override void BeforeClass() // LUCENENET specific - renamed from TestBefore() to ensure calling order vs base class
         {
+            base.BeforeClass();
+
             // create an index
             Directory indexStore = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), indexStore, Similarity, TimeZone);
@@ -106,7 +108,7 @@ namespace Lucene.Net.Search
 
         ///
         [OneTimeTearDown]
-        public virtual void TestAfter()
+        public override void AfterClass() // LUCENENET specific - renamed from TestAfter() to ensure calling order vs base class
         {
             // create an index
             Directory indexStore = NewDirectory();
@@ -160,6 +162,8 @@ namespace Lucene.Net.Search
             Assert.AreEqual(0, result.Length);
             reader.Dispose();
             indexStore.Dispose();
+
+            base.AfterClass();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestExplanations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestExplanations.cs b/src/Lucene.Net.Tests/Search/TestExplanations.cs
index ee2abb2..f4a219b 100644
--- a/src/Lucene.Net.Tests/Search/TestExplanations.cs
+++ b/src/Lucene.Net.Tests/Search/TestExplanations.cs
@@ -64,13 +64,14 @@ namespace Lucene.Net.Search
         public const string ALTFIELD = "alt";
 
         [OneTimeTearDown]
-        public static void AfterClassTestExplanations()
+        public override void AfterClass() // LUCENENET specific - renamed from AfterClassTestExplanations() to ensure calling order
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         /// <summary>
@@ -79,8 +80,10 @@ namespace Lucene.Net.Search
         /// NewStringField are no longer static.
         /// </summary>
         [OneTimeSetUp]
-        public void BeforeClassTestExplanations()
+        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassTestExplanations() to ensure calling order
         {
+            base.BeforeClass();
+
             Directory = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergePolicy(NewLogMergePolicy()));
             for (int i = 0; i < DocFields.Length; i++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestFieldCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
index 41bfdee..8e35474 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
@@ -168,7 +168,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Reader = null;
@@ -176,6 +176,7 @@ namespace Lucene.Net.Search
             Directory = null;
             UnicodeStrings = null;
             MultiValued = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs b/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
index 4103f91..ecc332e 100644
--- a/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
+++ b/src/Lucene.Net.Tests/Search/TestMinShouldMatch2.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             atomicReader.Dispose();
             Dir.Dispose();
@@ -122,6 +122,7 @@ namespace Lucene.Net.Search
             atomicReader = null;
             r = null;
             Dir = null;
+            base.AfterClass();
         }
 
         private static void AddSome(Document doc, string[] values)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
index ef754e4..1260ca5 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs
@@ -83,12 +83,13 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Small.Dispose();
             Reader = null;
             Small = null;
+            base.AfterClass();
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
index 88abfb6..ec907df 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
@@ -88,7 +88,7 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             MultiReader.Dispose();
@@ -99,6 +99,7 @@ namespace Lucene.Net.Search
             Reader = MultiReader = MultiReaderDupls = null;
             Searcher = MultiSearcher = MultiSearcherDupls = null;
             Dir = Sdir1 = Sdir2 = null;
+            base.AfterClass();
         }
 
         private Query ExtractInnerQuery(Query q)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
index bbcb21f..3693a6c 100644
--- a/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestNGramPhraseQuery.cs
@@ -48,12 +48,13 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
index 10ba1fc..d82564c 100644
--- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
+++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs
@@ -137,13 +137,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [SetUp]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
index bb89508..ffa2557 100644
--- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
+++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs
@@ -146,13 +146,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+            base.AfterClass();
         }
 
         [SetUp]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
index 05042d0..fb5fc39 100644
--- a/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestPhraseQuery.cs
@@ -111,13 +111,15 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs b/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
index de130ae..f426a2a 100644
--- a/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestPrefixInBooleanQuery.cs
@@ -85,13 +85,15 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Searcher = null;
             Reader.Dispose();
             Reader = null;
             Directory.Dispose();
             Directory = null;
+
+            base.AfterClass();
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs b/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
index 1be58e1..f92118a 100644
--- a/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
+++ b/src/Lucene.Net.Tests/Search/TestSubScorerFreqs.cs
@@ -37,8 +37,10 @@ namespace Lucene.Net.Search
         private static IndexSearcher s;
 
         [OneTimeSetUp]
-        public void MakeIndex()
+        public override void BeforeClass() // LUCENENET specific - renamed from MakeIndex() to ensure calling order
         {
+            base.BeforeClass();
+
             Dir = new RAMDirectory();
             RandomIndexWriter w = new RandomIndexWriter(Random(), Dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergePolicy(NewLogMergePolicy()));
             // make sure we have more than one segment occationally
@@ -59,12 +61,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void Finish()
+        public override void AfterClass() // LUCENENET specific - renamed from Finish() to ensure calling order
         {
             s.IndexReader.Dispose();
             s = null;
             Dir.Dispose();
             Dir = null;
+
+            base.AfterClass();
         }
 
         private class CountingCollector : ICollector

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6de19b95/src/Lucene.Net.Tests/Search/TestTermVectors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestTermVectors.cs b/src/Lucene.Net.Tests/Search/TestTermVectors.cs
index 58aad23..490115f 100644
--- a/src/Lucene.Net.Tests/Search/TestTermVectors.cs
+++ b/src/Lucene.Net.Tests/Search/TestTermVectors.cs
@@ -96,12 +96,14 @@ namespace Lucene.Net.Search
         }
 
         [OneTimeTearDown]
-        public static void AfterClass()
+        public override void AfterClass()
         {
             Reader.Dispose();
             Directory.Dispose();
             Reader = null;
             Directory = null;
+
+            base.AfterClass();
         }
 
         // In a single doc, for the same field, mix the term


Mime
View raw message