diff --git a/Lucene.Net.sln.DotSettings b/Lucene.Net.sln.DotSettings index 464613e85d..747aae4ad6 100644 --- a/Lucene.Net.sln.DotSettings +++ b/Lucene.Net.sln.DotSettings @@ -1,2 +1,3 @@  - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs index d27302ba16..9c5a9f6d4e 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs @@ -135,7 +135,7 @@ public virtual void TestSettersChaining() // IndexWriterConfig return type and second with LiveIndexWriterConfig. The ones // from LiveIndexWriterConfig are marked 'synthetic', so just collect them and // assert in the end that we also received them from IWC. - // In C# we do not have them marked synthetic so we look at the declaring type instead. + // LUCENENET: In C# we do not have them marked synthetic so we look at the declaring type instead. if (m.DeclaringType?.Name == "LiveIndexWriterConfig") { liveSetters.Add(m.Name); diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs index f634823722..a64e9af0dc 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs @@ -16,6 +16,8 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Console = Lucene.Net.Util.SystemConsole; +// ReSharper disable once RedundantUsingDirective - keep until we have an analyzer to look out for accidental NUnit asserts +using Assert = Lucene.Net.TestFramework.Assert; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs index 2a6412d172..e54ed5c0b6 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs @@ -12,6 +12,7 @@ using RandomizedTesting.Generators; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; @@ -214,7 +215,7 @@ public override void Run() Console.WriteLine(Thread.CurrentThread.Name + ": TEST: IndexerThread: cycle"); } outerInstance.doFail.Value = this.Instance; - string id = "" + r.Next(50); + string id = r.Next(50).ToString(CultureInfo.InvariantCulture); // LUCENENET: using InvariantCulture ToString overload instead of implicit `"" + r.Next(50)` idField.SetStringValue(id); Term idTerm = new Term("id", id); try @@ -2134,7 +2135,7 @@ public virtual void TestNoLostDeletesOrUpdates() for (int i = 0; i < numDocs; i++) { Document doc = new Document(); - doc.Add(new StringField("id", (docBase + i).ToString(), Field.Store.NO)); + doc.Add(new StringField("id", (docBase + i).ToString(CultureInfo.InvariantCulture), Field.Store.NO)); if (DefaultCodecSupportsDocValues) { doc.Add(new NumericDocValuesField("f", 1L)); @@ -2172,20 +2173,20 @@ public virtual void TestNoLostDeletesOrUpdates() } if (Random.NextBoolean()) // update only numeric field { - w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString()), "f", value); - w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString()), "cf", value * 2); + w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "f", value); + w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "cf", value * 2); } else if (Random.NextBoolean()) { - w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString()), "bf", TestBinaryDocValuesUpdates.ToBytes(value)); - w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString()), "bcf", TestBinaryDocValuesUpdates.ToBytes(value * 2)); + w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "bf", TestBinaryDocValuesUpdates.ToBytes(value)); + w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "bcf", TestBinaryDocValuesUpdates.ToBytes(value * 2)); } else { - w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString()), "f", value); - w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString()), "cf", value * 2); - w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString()), "bf", TestBinaryDocValuesUpdates.ToBytes(value)); - w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString()), "bcf", TestBinaryDocValuesUpdates.ToBytes(value * 2)); + w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "f", value); + w.UpdateNumericDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "cf", value * 2); + w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "bf", TestBinaryDocValuesUpdates.ToBytes(value)); + w.UpdateBinaryDocValue(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture)), "bcf", TestBinaryDocValuesUpdates.ToBytes(value * 2)); } } @@ -2194,10 +2195,10 @@ public virtual void TestNoLostDeletesOrUpdates() { if (Verbose) { - Console.WriteLine(" delete id=" + (docBase + i)); + Console.WriteLine(" delete id=" + (docBase + i).ToString(CultureInfo.InvariantCulture)); } deleteCount++; - w.DeleteDocuments(new Term("id", "" + (docBase + i))); + w.DeleteDocuments(new Term("id", (docBase + i).ToString(CultureInfo.InvariantCulture))); // LUCENENET: using InvariantCulture ToString overload instead of implicit `"" +` conversion } } }