Lucene.Net.Tests.Join: Fixed formatting, code ordering, and console output. Marked lucene compatibility version 4.8.1 at the top of each file.
diff --git a/src/Lucene.Net.Join/FakeScorer.cs b/src/Lucene.Net.Join/FakeScorer.cs
index 90e24ff..a089ccc 100644
--- a/src/Lucene.Net.Join/FakeScorer.cs
+++ b/src/Lucene.Net.Join/FakeScorer.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Search;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Search;
 using System;
 using System.Collections.Generic;
 
diff --git a/src/Lucene.Net.Join/FixedBitSetCachingWrapperFilter.cs b/src/Lucene.Net.Join/FixedBitSetCachingWrapperFilter.cs
index 25ea5cf..ebfa668 100644
--- a/src/Lucene.Net.Join/FixedBitSetCachingWrapperFilter.cs
+++ b/src/Lucene.Net.Join/FixedBitSetCachingWrapperFilter.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Index;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 
diff --git a/src/Lucene.Net.Join/JoinUtil.cs b/src/Lucene.Net.Join/JoinUtil.cs
index d360825..6034516 100644
--- a/src/Lucene.Net.Join/JoinUtil.cs
+++ b/src/Lucene.Net.Join/JoinUtil.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Search;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Search;
 using System;
 using System.IO;
 
diff --git a/src/Lucene.Net.Join/ScoreMode.cs b/src/Lucene.Net.Join/ScoreMode.cs
index ccf2232..bbac796 100644
--- a/src/Lucene.Net.Join/ScoreMode.cs
+++ b/src/Lucene.Net.Join/ScoreMode.cs
@@ -1,4 +1,6 @@
-namespace Lucene.Net.Join
+// Lucene version compatibility level 4.8.1
+
+namespace Lucene.Net.Join
 {
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/src/Lucene.Net.Join/TermsCollector.cs b/src/Lucene.Net.Join/TermsCollector.cs
index add6980..e744438 100644
--- a/src/Lucene.Net.Join/TermsCollector.cs
+++ b/src/Lucene.Net.Join/TermsCollector.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Index;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 
diff --git a/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs b/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
index c28ca38..8b1eb1a 100644
--- a/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
+++ b/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Index;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 using System;
diff --git a/src/Lucene.Net.Join/TermsQuery.cs b/src/Lucene.Net.Join/TermsQuery.cs
index 3d4f770..b2b3022 100644
--- a/src/Lucene.Net.Join/TermsQuery.cs
+++ b/src/Lucene.Net.Join/TermsQuery.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+// Lucene version compatibility level 4.8.1
+using System.Collections.Generic;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
diff --git a/src/Lucene.Net.Join/TermsWithScoreCollector.cs b/src/Lucene.Net.Join/TermsWithScoreCollector.cs
index 13798dd..e79bc43 100644
--- a/src/Lucene.Net.Join/TermsWithScoreCollector.cs
+++ b/src/Lucene.Net.Join/TermsWithScoreCollector.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Index;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Support;
 using Lucene.Net.Util;
diff --git a/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs b/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
index ad0a6d3..31f3538 100644
--- a/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
+++ b/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
@@ -1,10 +1,10 @@
-using Lucene.Net.Diagnostics;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 
 namespace Lucene.Net.Join
 {
diff --git a/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs b/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs
index 79a4e7e..5a5db84 100644
--- a/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs
+++ b/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Diagnostics;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Search.Grouping;
@@ -7,7 +8,6 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.IO;
 
 namespace Lucene.Net.Join
diff --git a/src/Lucene.Net.Join/ToParentBlockJoinFieldComparator.cs b/src/Lucene.Net.Join/ToParentBlockJoinFieldComparator.cs
index 07843d4..54ea12b 100644
--- a/src/Lucene.Net.Join/ToParentBlockJoinFieldComparator.cs
+++ b/src/Lucene.Net.Join/ToParentBlockJoinFieldComparator.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Index;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 using System;
diff --git a/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs b/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
index 611e26b..2517f90 100644
--- a/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
+++ b/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
@@ -1,10 +1,10 @@
-using Lucene.Net.Diagnostics;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Diagnostics;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 
 namespace Lucene.Net.Join
 {
diff --git a/src/Lucene.Net.Join/ToParentBlockJoinSortField.cs b/src/Lucene.Net.Join/ToParentBlockJoinSortField.cs
index 430c329..b12d30b 100644
--- a/src/Lucene.Net.Join/ToParentBlockJoinSortField.cs
+++ b/src/Lucene.Net.Join/ToParentBlockJoinSortField.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Search;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Search;
 
 namespace Lucene.Net.Join
 {
diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
index ac4199d..d7e2fe9 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
@@ -1,4 +1,5 @@
-using J2N.Collections.Generic.Extensions;
+// Lucene version compatibility level 4.8.1
+using J2N.Collections.Generic.Extensions;
 using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
 using Lucene.Net.Documents.Extensions;
@@ -12,6 +13,7 @@
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using Console = Lucene.Net.Util.SystemConsole;
@@ -355,7 +357,8 @@
 
 
             TermQuery us = new TermQuery(new Term("country", "United States"));
-            assertEquals("@ US we have java and ruby", 2, s.Search(new ToChildBlockJoinQuery(us, parentsFilter, Random.NextBoolean()), 10).TotalHits);
+            assertEquals("@ US we have java and ruby", 2,
+                s.Search(new ToChildBlockJoinQuery(us, parentsFilter, Random.NextBoolean()), 10).TotalHits);
 
             assertEquals("java skills in US", 1, s.Search(new ToChildBlockJoinQuery(us, parentsFilter, Random.NextBoolean()), Skill("java"), 10).TotalHits);
 
@@ -438,7 +441,11 @@
             w.Commit();
             IndexSearcher s = NewSearcher(DirectoryReader.Open(dir));
 
-            ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(NumericRangeQuery.NewInt32Range("year", 1990, 2010, true, true), new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume")))), ScoreMode.Total);
+            ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(
+                NumericRangeQuery.NewInt32Range("year", 1990, 2010, true, true),
+                new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume")))),
+                ScoreMode.Total
+            );
 
             TopDocs topDocs = s.Search(q, 10);
             assertEquals(2, topDocs.TotalHits);
@@ -465,7 +472,6 @@
 
         private string[][] GetRandomFields(int maxUniqueValues)
         {
-
             string[][] fields = new string[TestUtil.NextInt32(Random, 2, 4)][];
             for (int fieldID = 0; fieldID < fields.Length; fieldID++)
             {
@@ -531,7 +537,7 @@
             Directory joinDir = NewDirectory();
 
             int numParentDocs = TestUtil.NextInt32(Random, 100 * RandomMultiplier, 300 * RandomMultiplier);
-            //final int numParentDocs = 30;
+            //int numParentDocs = 30;
 
             // Values for parent fields:
             string[][] parentFields = GetRandomFields(numParentDocs / 2);
@@ -693,7 +699,8 @@
                 if (Random.Next(3) == 2)
                 {
                     int childFieldID = Random.Next(childFields.Length);
-                    childQuery = new TermQuery(new Term("child" + childFieldID, childFields[childFieldID][Random.Next(childFields[childFieldID].Length)]));
+                    childQuery = new TermQuery(new Term("child" + childFieldID,
+                        childFields[childFieldID][Random.Next(childFields[childFieldID].Length)]));
                 }
                 else if (Random.Next(3) == 2)
                 {
@@ -727,7 +734,8 @@
 
                     bq.Add(new TermQuery(RandomChildTerm(childFields[0])), Occur.MUST);
                     int childFieldID = TestUtil.NextInt32(Random, 1, childFields.Length - 1);
-                    bq.Add(new TermQuery(new Term("child" + childFieldID, childFields[childFieldID][Random.Next(childFields[childFieldID].Length)])), Random.NextBoolean() ? Occur.MUST : Occur.MUST_NOT);
+                    bq.Add(new TermQuery(new Term("child" + childFieldID, childFields[childFieldID][Random.Next(childFields[childFieldID].Length)])),
+                        Random.NextBoolean() ? Occur.MUST : Occur.MUST_NOT);
                 }
 
                 int x = Random.Next(4);
@@ -910,7 +918,7 @@
                     {
                         Explanation explanation = joinS.Explain(childJoinQuery, hit.Doc);
                         Document document = joinS.Doc(hit.Doc - 1);
-                        int childId = Convert.ToInt32(document.Get("childID"));
+                        int childId = Convert.ToInt32(document.Get("childID"), CultureInfo.InvariantCulture);
                         assertTrue(explanation.IsMatch);
                         assertEquals(hit.Score, explanation.Value, 0.0f);
                         assertEquals(string.Format("Score based on child doc range from {0} to {1}", hit.Doc - 1 - childId, hit.Doc - 1), explanation.Description);
@@ -1060,7 +1068,8 @@
                 // Search join index:
                 if (Verbose)
                 {
-                    Console.WriteLine("TEST: run top down join query=" + childJoinQuery2 + " filter=" + childJoinFilter2 + " sort=" + childSort2);
+                    Console.WriteLine("TEST: run top down join query=" + childJoinQuery2 +
+                        " filter=" + childJoinFilter2 + " sort=" + childSort2);
                 }
                 TopDocs joinResults2 = joinS.Search(childJoinQuery2, childJoinFilter2, joinR.NumDocs, childSort2);
                 if (Verbose)
@@ -1093,7 +1102,8 @@
                 ScoreDoc joinHit = joinResults.ScoreDocs[hitCount];
                 Document doc1 = r.Document(hit.Doc);
                 Document doc2 = joinR.Document(joinHit.Doc);
-                assertEquals("hit " + hitCount + " differs", doc1.Get("childID"), doc2.Get("childID"));
+                assertEquals("hit " + hitCount + " differs",
+                    doc1.Get("childID"), doc2.Get("childID"));
                 // don't compare scores -- they are expected to differ
 
 
@@ -1306,7 +1316,6 @@
         [Test]
         public void TestGetTopGroups()
         {
-
             Directory dir = NewDirectory();
             RandomIndexWriter w = new RandomIndexWriter(
 #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION
@@ -1350,7 +1359,7 @@
             getTopGroupsResults[0] = c.GetTopGroups(childJoinQuery, null, 0, 10, 0, true);
             getTopGroupsResults[1] = c.GetTopGroupsWithAllChildDocs(childJoinQuery, null, 0, 0, true);
 
-            foreach (TopGroups<int> results in getTopGroupsResults)
+            foreach (ITopGroups<int> results in getTopGroupsResults)
             {
                 assertFalse(float.IsNaN(results.MaxScore));
                 assertEquals(2, results.TotalGroupedHitCount);
@@ -1369,7 +1378,7 @@
                 {
                     Document childDoc = s.Doc(scoreDoc.Doc);
                     assertEquals("java", childDoc.Get("skill"));
-                    int year = Convert.ToInt32(childDoc.Get("year"));
+                    int year = Convert.ToInt32(childDoc.Get("year"), CultureInfo.InvariantCulture);
                     assertTrue(year >= 2006 && year <= 2011);
                 }
             }
@@ -1393,7 +1402,7 @@
             {
                 Document childDoc = s.Doc(scoreDoc.Doc);
                 assertEquals("java", childDoc.Get("skill"));
-                int year = Convert.ToInt32(childDoc.Get("year"));
+                int year = Convert.ToInt32(childDoc.Get("year"), CultureInfo.InvariantCulture);
                 assertTrue(year >= 2006 && year <= 2011);
             }
 
diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoinSorting.cs b/src/Lucene.Net.Tests.Join/TestBlockJoinSorting.cs
index 7a9b3bf..38aa343 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoinSorting.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoinSorting.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Analysis;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
 using Lucene.Net.Index;
 using Lucene.Net.Index.Extensions;
@@ -34,7 +35,8 @@
         public void TestNestedSorting()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random, dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)).SetMergePolicy(NoMergePolicy.COMPOUND_FILES));
+            RandomIndexWriter w = new RandomIndexWriter(Random, dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
+                new MockAnalyzer(Random)).SetMergePolicy(NoMergePolicy.COMPOUND_FILES));
 
             IList<Document> docs = new List<Document>();
             Document document = new Document();
@@ -248,7 +250,10 @@
 
             // Sort by field descending, order last, sort filter (filter_1:T)
             childFilter = new QueryWrapperFilter(new TermQuery((new Term("filter_1", "T"))));
-            query = new ToParentBlockJoinQuery(new FilteredQuery(new MatchAllDocsQuery(), childFilter), new FixedBitSetCachingWrapperFilter(parentFilter), ScoreMode.None);
+            query = new ToParentBlockJoinQuery(
+                new FilteredQuery(new MatchAllDocsQuery(), childFilter),
+                new FixedBitSetCachingWrapperFilter(parentFilter),
+                ScoreMode.None);
             sortField = new ToParentBlockJoinSortField("field2", SortFieldType.STRING, true, Wrap(parentFilter), Wrap(childFilter));
             sort = new Sort(sortField);
             topDocs = searcher.Search(query, 5, sort);
diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs b/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
index 48c894d..9d7f6e6 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Analysis;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Analysis;
 using Lucene.Net.Documents;
 using Lucene.Net.Index;
 using Lucene.Net.Join;
@@ -31,7 +32,6 @@
 
     public class TestBlockJoinValidation : LuceneTestCase
     {
-
         public const int AMOUNT_OF_SEGMENTS = 5;
         public const int AMOUNT_OF_PARENT_DOCS = 10;
         public const int AMOUNT_OF_CHILD_DOCS = 5;
@@ -60,13 +60,6 @@
             parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new WildcardQuery(new Term("parent", "*"))));
         }
 
-        [TearDown]
-        public override void TearDown()
-        {
-            indexReader.Dispose();
-            directory.Dispose();
-        }
-
         [Test]
         public void TestNextDocValidationForToParentBjq()
         {
@@ -126,6 +119,13 @@
             StringAssert.Contains(ToChildBlockJoinQuery.INVALID_QUERY_MESSAGE, ex.Message);
         }
 
+        [TearDown]
+        public override void TearDown()
+        {
+            indexReader.Dispose();
+            directory.Dispose();
+        }
+
         private IList<Document> CreateDocsForSegment(int segmentNumber)
         {
             IList<IList<Document>> blocks = new List<IList<Document>>(AMOUNT_OF_PARENT_DOCS);
@@ -185,7 +185,7 @@
         private static Query CreateChildrenQueryWithOneParent(int childNumber)
         {
             TermQuery childQuery = new TermQuery(new Term("child", CreateFieldValue(childNumber)));
-            Query randomParentQuery = new TermQuery(new Term("id", CreateFieldValue(RandomParentId)));
+            Query randomParentQuery = new TermQuery(new Term("id", CreateFieldValue(GetRandomParentId())));
             BooleanQuery childrenQueryWithRandomParent = new BooleanQuery();
             childrenQueryWithRandomParent.Add(new BooleanClause(childQuery, Occur.SHOULD));
             childrenQueryWithRandomParent.Add(new BooleanClause(randomParentQuery, Occur.SHOULD));
@@ -195,19 +195,19 @@
         private static Query CreateParentsQueryWithOneChild(int randomChildNumber)
         {
             BooleanQuery childQueryWithRandomParent = new BooleanQuery();
-            Query parentsQuery = new TermQuery(new Term("parent", CreateFieldValue(RandomParentNumber)));
+            Query parentsQuery = new TermQuery(new Term("parent", CreateFieldValue(GetRandomParentNumber())));
             childQueryWithRandomParent.Add(new BooleanClause(parentsQuery, Occur.SHOULD));
             childQueryWithRandomParent.Add(new BooleanClause(RandomChildQuery(randomChildNumber), Occur.SHOULD));
             return childQueryWithRandomParent;
         }
 
-        private static int RandomParentId => Random.Next(AMOUNT_OF_PARENT_DOCS*AMOUNT_OF_SEGMENTS);
+        private static int GetRandomParentId() => Random.Next(AMOUNT_OF_PARENT_DOCS*AMOUNT_OF_SEGMENTS);
 
-        private static int RandomParentNumber => Random.Next(AMOUNT_OF_PARENT_DOCS);
+        private static int GetRandomParentNumber() => Random.Next(AMOUNT_OF_PARENT_DOCS);
 
         private static Query RandomChildQuery(int randomChildNumber)
         {
-            return new TermQuery(new Term("id", CreateFieldValue(RandomParentId, randomChildNumber)));
+            return new TermQuery(new Term("id", CreateFieldValue(GetRandomParentId(), randomChildNumber)));
         }
 
         private static int GetRandomChildNumber(int notLessThan)
diff --git a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
index 29f7f8d..1d62485 100644
--- a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
+++ b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Analysis;
+// Lucene version compatibility level 4.8.1
+using Lucene.Net.Analysis;
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Documents;
 using Lucene.Net.Index;
@@ -10,6 +11,7 @@
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using Console = Lucene.Net.Util.SystemConsole;
 using JCG = J2N.Collections.Generic;
 
@@ -129,7 +131,7 @@
         public void TestOverflowTermsWithScoreCollectorRandom()
         {
             var scoreModeLength = Enum.GetNames(typeof(ScoreMode)).Length;
-            Test300spartans(Random.NextBoolean(), (ScoreMode) Random.Next(scoreModeLength));
+            Test300spartans(Random.NextBoolean(), (ScoreMode)Random.Next(scoreModeLength));
         }
 
         protected virtual void Test300spartans(bool multipleValues, ScoreMode scoreMode)
@@ -502,8 +504,8 @@
                     {
                         if (Verbose)
                         {
-                            string.Format("Expected doc: {0} | Actual doc: {1}\n", expectedTopDocs.ScoreDocs[i].Doc, actualTopDocs.ScoreDocs[i].Doc);
-                            string.Format("Expected score: {0} | Actual score: {1}\n", expectedTopDocs.ScoreDocs[i].Score, actualTopDocs.ScoreDocs[i].Score);
+                            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Expected doc: {0} | Actual doc: {1}\n", expectedTopDocs.ScoreDocs[i].Doc, actualTopDocs.ScoreDocs[i].Doc));
+                            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Expected score: {0} | Actual score: {1}\n", expectedTopDocs.ScoreDocs[i].Score, actualTopDocs.ScoreDocs[i].Score));
                         }
                         assertEquals(expectedTopDocs.ScoreDocs[i].Doc, actualTopDocs.ScoreDocs[i].Doc);
                         assertEquals(expectedTopDocs.ScoreDocs[i].Score, actualTopDocs.ScoreDocs[i].Score, 0.0f);
@@ -554,8 +556,7 @@
             public virtual bool AcceptsDocsOutOfOrder => scoreDocsInOrder;
         }
         
-        private IndexIterationContext CreateContext(int nDocs, RandomIndexWriter writer, bool multipleValuesPerDocument,
-            bool scoreDocsInOrder)
+        private IndexIterationContext CreateContext(int nDocs, RandomIndexWriter writer, bool multipleValuesPerDocument, bool scoreDocsInOrder)
         {
             return CreateContext(nDocs, writer, writer, multipleValuesPerDocument, scoreDocsInOrder);
         }
@@ -564,7 +565,7 @@
             bool multipleValuesPerDocument, bool scoreDocsInOrder)
         {
             IndexIterationContext context = new IndexIterationContext();
-            int numRandomValues = nDocs/2;
+            int numRandomValues = nDocs / 2;
             context.RandomUniqueValues = new string[numRandomValues];
             ISet<string> trackSet = new JCG.HashSet<string>();
             context.RandomFrom = new bool[numRandomValues];
@@ -585,7 +586,7 @@
             RandomDoc[] docs = new RandomDoc[nDocs];
             for (int i = 0; i < nDocs; i++)
             {
-                string id = Convert.ToString(i);
+                string id = Convert.ToString(i, CultureInfo.InvariantCulture);
                 int randomI = Random.Next(context.RandomUniqueValues.Length);
                 string value = context.RandomUniqueValues[randomI];
                 Document document = new Document();
@@ -708,9 +709,7 @@
                                     docsEnum = termsEnum.Docs(slowCompositeReader.LiveDocs, docsEnum, DocsFlags.NONE);
                                     JoinScore joinScore = joinValueToJoinScores[joinValue];
 
-                                    for (int doc = docsEnum.NextDoc();
-                                        doc != DocIdSetIterator.NO_MORE_DOCS;
-                                        doc = docsEnum.NextDoc())
+                                    for (int doc = docsEnum.NextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = docsEnum.NextDoc())
                                     {
                                         // First encountered join value determines the score.
                                         // Something to keep in mind for many-to-many relations.
@@ -936,7 +935,9 @@
             }
         }
 
-        private TopDocs CreateExpectedTopDocs(string queryValue, bool from, ScoreMode scoreMode,
+        private TopDocs CreateExpectedTopDocs(string queryValue,
+            bool from,
+            ScoreMode scoreMode,
             IndexIterationContext context)
         {
             var hitsToJoinScores = @from
@@ -1071,7 +1072,7 @@
                     case ScoreMode.Total:
                         return total;
                     case ScoreMode.Avg:
-                        return total/count;
+                        return total / count;
                     case ScoreMode.Max:
                         return maxScore;
                 }