diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs index 816f1919ca..854da9787f 100644 --- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs +++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs @@ -648,6 +648,12 @@ private static IList LoadCoreDirectories() // Suite and test case setup/ cleanup. // ----------------------------------------------------------------- + // LUCENENET specific: Temporary storage for random selections so they + // can be set once per OneTimeSetUp and reused multiple times in SetUp + // where they are written to the output. + private string codecType; + private string similarityName; + /// /// For subclasses to override. Overrides must call base.SetUp(). /// @@ -671,11 +677,11 @@ public virtual void SetUp() Console.Write("Default Codec: "); Console.Write(ClassEnvRule.codec.Name); Console.Write(" ("); - Console.Write(ClassEnvRule.codec.GetType().ToString()); + Console.Write(codecType); Console.WriteLine(")"); Console.Write("Default Similarity: "); - Console.WriteLine(ClassEnvRule.similarity.ToString()); + Console.WriteLine(similarityName); } /// @@ -736,6 +742,9 @@ public static void BeforeClass(Microsoft.VisualStudio.TestTools.UnitTesting.Test ClassEnvRule.Before(null); + // LUCENENET: Generate the info once so it can be printed out for each test + codecType = ClassEnvRule.codec.GetType().Name; + similarityName = ClassEnvRule.similarity.ToString(); // LUCENENET TODO: Scan for a custom attribute and setup ordering to // initialize data from this class to the top class @@ -767,6 +776,10 @@ public virtual void BeforeClass() LuceneTestFrameworkInitializer.EnsureInitialized(); ClassEnvRule.Before(this); + + // LUCENENET: Generate the info once so it can be printed out for each test + codecType = ClassEnvRule.codec.GetType().Name; + similarityName = ClassEnvRule.similarity.ToString(); } catch (Exception ex) {