Class LuceneTestCase
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Inheritance
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.TestFramework.dll
Syntax
[LuceneTestCase.TestFixture]
public abstract class LuceneTestCase
Fields
DEFAULT_LINE_DOCS_FILE
TODO: javadoc?
Declaration
public const string DEFAULT_LINE_DOCS_FILE = "europarl.lines.txt.gz"
Field Value
| Type | Description |
|---|---|
| string |
JENKINS_LARGE_LINE_DOCS_FILE
TODO: javadoc?
Declaration
public const string JENKINS_LARGE_LINE_DOCS_FILE = "enwiki.random.lines.txt"
Field Value
| Type | Description |
|---|---|
| string |
SuiteFailureMarker
Suite failure marker (any error in the test or suite scope).
Declaration
public static readonly bool SuiteFailureMarker
Field Value
| Type | Description |
|---|---|
| bool |
TEST_VERSION_CURRENT
Use this constant when creating Analyzers and any other version-dependent stuff.
NOTE: Change this when development starts for new Lucene version:Declaration
public const LuceneVersion TEST_VERSION_CURRENT = LUCENE_48
Field Value
| Type | Description |
|---|---|
| LuceneVersion |
Properties
DefaultCodecSupportsDocValues
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static bool DefaultCodecSupportsDocValues { get; }
Property Value
| Type | Description |
|---|---|
| bool |
DefaultCodecSupportsDocsWithField
Returns true if the codec "supports" docsWithField (other codecs return MatchAllBits, because you couldnt write missing values before)
Declaration
public static bool DefaultCodecSupportsDocsWithField { get; }
Property Value
| Type | Description |
|---|---|
| bool |
DefaultCodecSupportsFieldUpdates
Returns true if the codec "supports" field updates.
Declaration
public static bool DefaultCodecSupportsFieldUpdates { get; }
Property Value
| Type | Description |
|---|---|
| bool |
DefaultCodecSupportsMissingDocValues
Returns true if the default codec supports single valued docvalues with missing values
Declaration
public static bool DefaultCodecSupportsMissingDocValues { get; }
Property Value
| Type | Description |
|---|---|
| bool |
DefaultCodecSupportsSortedSet
Returns true if the default codec supports SORTED_SET docvalues
Declaration
public static bool DefaultCodecSupportsSortedSet { get; }
Property Value
| Type | Description |
|---|---|
| bool |
DoesntSupportOffsets
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
protected static ICollection<string> DoesntSupportOffsets { get; }
Property Value
| Type | Description |
|---|---|
| ICollection<string> |
LeaveTemporary
Leave temporary files on disk, even on successful runs.
Declaration
public static bool LeaveTemporary { get; }
Property Value
| Type | Description |
|---|---|
| bool |
OldFormatImpersonationIsActive
When true, Codecs for old Lucene version will support writing
indexes in that format. Defaults to false, can be disabled by
specific tests on demand.
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public static bool OldFormatImpersonationIsActive { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Random
Access to the current Random instance. It is safe to use this method from multiple threads, etc., but it should be called while within a runner's scope (so no static initializers). The returned Random instance will be different when this method is called inside a BeforeClass() hook (static suite scope) and within NUnit.Framework.SetUpAttribute/ NUnit.Framework.TearDownAttribute hooks or test methods.
The returned instance must not be shared with other threads or cross a single scope's boundary. For example, a Random acquired within a test method shouldn't be reused for another test case. There is an overhead connected with getting the Random for a particular context and thread. It is better to cache the Random locally if tight loops with multiple invocations are present or create a derivative local Random for millions of calls like this:Random random = new J2N.Randomizer(Random.NextInt64());
// tight loop with many invocations.
Declaration
public static Random Random { get; }
Property Value
| Type | Description |
|---|---|
| Random |
RandomMultiplier
A random multiplier which you should use when writing random tests: multiply it by the number of iterations to scale your tests (for nightly builds).
Declaration
public static int RandomMultiplier { get; }
Property Value
| Type | Description |
|---|---|
| int |
TestAwaitsFix
Whether or not LuceneTestCase.AwaitsFixAttribute tests should run.
Declaration
public static bool TestAwaitsFix { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TestCodec
Gets the codec to run tests with.
Declaration
public static string TestCodec { get; }
Property Value
| Type | Description |
|---|---|
| string |
TestDirectory
Gets the directory to run tests with
Declaration
public static string TestDirectory { get; }
Property Value
| Type | Description |
|---|---|
| string |
TestDocValuesFormat
Gets the docValuesFormat to run tests with
Declaration
public static string TestDocValuesFormat { get; }
Property Value
| Type | Description |
|---|---|
| string |
TestLineDocsFile
The line file used by LineFileDocs
Declaration
public static string TestLineDocsFile { get; }
Property Value
| Type | Description |
|---|---|
| string |
TestName
Return the name of the currently executing test case.
Declaration
public virtual string TestName { get; }
Property Value
| Type | Description |
|---|---|
| string |
TestNightly
Whether or not LuceneTestCase.NightlyAttribute tests should run.
Declaration
public static bool TestNightly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TestPostingsFormat
Gets the postingsFormat to run tests with.
Declaration
public static string TestPostingsFormat { get; }
Property Value
| Type | Description |
|---|---|
| string |
TestSlow
Whether or not LuceneTestCase.SlowAttribute tests should run.
Declaration
public static bool TestSlow { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TestType
Gets the current type being tested.
Declaration
public static Type TestType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
TestWeekly
Whether or not LuceneTestCase.WeeklyAttribute tests should run.
Declaration
public static bool TestWeekly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
UseInfoStream
TODO: javadoc?
Declaration
public static bool UseInfoStream { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Verbose
True if and only if tests are run in verbose mode. If this flag is false tests are not expected to print any messages.
Declaration
public static bool Verbose { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
AfterClass()
Tears down random defaults and cleans up temporary files.
If you override this method, be sure to callbase.AfterClass() AFTER
tearing down your test fixture.
Declaration
[OneTimeTearDown]
public virtual void AfterClass()
AsSet(params object[])
Return args as a ISet<T> instance. The order of elements is not
preserved in enumerators.
Declaration
public static ISet<object> AsSet(params object[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | args |
Returns
| Type | Description |
|---|---|
| ISet<object> |
AssertDeletedDocsEquals(string, IndexReader, IndexReader)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public virtual void AssertDeletedDocsEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertDocValuesEquals(string, IndexReader, IndexReader)
Checks that docvalues across all fields are equivalent.
Declaration
public virtual void AssertDocValuesEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertDocValuesEquals(string, int, NumericDocValues, NumericDocValues)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public virtual void AssertDocValuesEquals(string info, int num, NumericDocValues leftDocValues, NumericDocValues rightDocValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| int | num | |
| NumericDocValues | leftDocValues | |
| NumericDocValues | rightDocValues |
AssertDocsAndPositionsEnumEquals(string, DocsAndPositionsEnum, DocsAndPositionsEnum)
Checks docs + freqs + positions + payloads, sequentially.
Declaration
public virtual void AssertDocsAndPositionsEnumEquals(string info, DocsAndPositionsEnum leftDocs, DocsAndPositionsEnum rightDocs)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| DocsAndPositionsEnum | leftDocs | |
| DocsAndPositionsEnum | rightDocs |
AssertDocsEnumEquals(string, DocsEnum, DocsEnum, bool)
Checks docs + freqs, sequentially.
Declaration
public virtual void AssertDocsEnumEquals(string info, DocsEnum leftDocs, DocsEnum rightDocs, bool hasFreqs)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| DocsEnum | leftDocs | |
| DocsEnum | rightDocs | |
| bool | hasFreqs |
AssertDocsSkippingEquals(string, IndexReader, int, DocsEnum, DocsEnum, bool)
Checks advancing docs.
Declaration
public virtual void AssertDocsSkippingEquals(string info, IndexReader leftReader, int docFreq, DocsEnum leftDocs, DocsEnum rightDocs, bool hasFreqs)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| int | docFreq | |
| DocsEnum | leftDocs | |
| DocsEnum | rightDocs | |
| bool | hasFreqs |
AssertFieldInfosEquals(string, IndexReader, IndexReader)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public virtual void AssertFieldInfosEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertFieldStatisticsEquals(string, Fields, Fields)
Checks that top-level statistics on Lucene.Net.Index.Fields are the same.
Declaration
public virtual void AssertFieldStatisticsEquals(string info, Fields leftFields, Fields rightFields)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| Fields | leftFields | |
| Fields | rightFields |
AssertFieldsEquals(string, IndexReader, Fields, Fields, bool)
Fields API equivalency.
Declaration
public virtual void AssertFieldsEquals(string info, IndexReader leftReader, Fields leftFields, Fields rightFields, bool deep)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| Fields | leftFields | |
| Fields | rightFields | |
| bool | deep |
AssertNormsEquals(string, IndexReader, IndexReader)
Checks that norms are the same across all fields.
Declaration
public virtual void AssertNormsEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertPositionsSkippingEquals(string, IndexReader, int, DocsAndPositionsEnum, DocsAndPositionsEnum)
Checks advancing docs + positions.
Declaration
public virtual void AssertPositionsSkippingEquals(string info, IndexReader leftReader, int docFreq, DocsAndPositionsEnum leftDocs, DocsAndPositionsEnum rightDocs)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| int | docFreq | |
| DocsAndPositionsEnum | leftDocs | |
| DocsAndPositionsEnum | rightDocs |
AssertReaderEquals(string, IndexReader, IndexReader)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public virtual void AssertReaderEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertReaderStatisticsEquals(string, IndexReader, IndexReader)
Checks that reader-level statistics are the same.
Declaration
public virtual void AssertReaderStatisticsEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertSaneFieldCaches(string)
Asserts that Lucene.Net.Util.FieldCacheSanityChecker does not detect any problems with Lucene.Net.Search.FieldCache.DEFAULT.
If any problems are found, they are logged to Lucene.Net.Util.SystemConsole.Error (allong with the msg) when the Assertion is thrown.
This method is called by TearDown() after every test method, however Lucene.Net.Index.IndexReaders scoped inside test methods may be garbage collected prior to this method being called, causing errors to be overlooked. Tests are encouraged to keep their Lucene.Net.Index.IndexReaders scoped at the class level, or to explicitly call this method directly in the same scope as the Lucene.Net.Index.IndexReader.
Declaration
protected static void AssertSaneFieldCaches(string msg)
Parameters
| Type | Name | Description |
|---|---|---|
| string | msg |
See Also
AssertStoredFieldEquals(string, IIndexableField, IIndexableField)
Checks that two stored fields are equivalent.
Declaration
public virtual void AssertStoredFieldEquals(string info, IIndexableField leftField, IIndexableField rightField)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IIndexableField | leftField | |
| IIndexableField | rightField |
AssertStoredFieldsEquals(string, IndexReader, IndexReader)
Checks that stored fields of all documents are the same.
Declaration
public virtual void AssertStoredFieldsEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertTermStatsEquals(string, TermsEnum, TermsEnum)
Checks term-level statistics.
Declaration
public virtual void AssertTermStatsEquals(string info, TermsEnum leftTermsEnum, TermsEnum rightTermsEnum)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| TermsEnum | leftTermsEnum | |
| TermsEnum | rightTermsEnum |
AssertTermVectorsEquals(string, IndexReader, IndexReader)
Checks that term vectors across all fields are equivalent.
Declaration
public virtual void AssertTermVectorsEquals(string info, IndexReader leftReader, IndexReader rightReader)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| IndexReader | rightReader |
AssertTermsEnumEquals(string, IndexReader, TermsEnum, TermsEnum, bool)
Checks the terms enum sequentially.
If deep is false, it does a 'shallow' test that doesnt go down to the docsenums.
Declaration
public virtual void AssertTermsEnumEquals(string info, IndexReader leftReader, TermsEnum leftTermsEnum, TermsEnum rightTermsEnum, bool deep)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| TermsEnum | leftTermsEnum | |
| TermsEnum | rightTermsEnum | |
| bool | deep |
AssertTermsEquals(string, IndexReader, Terms, Terms, bool)
Lucene.Net.Index.Terms API equivalency.
Declaration
public virtual void AssertTermsEquals(string info, IndexReader leftReader, Terms leftTerms, Terms rightTerms, bool deep)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| IndexReader | leftReader | |
| Terms | leftTerms | |
| Terms | rightTerms | |
| bool | deep |
AssertTermsStatisticsEquals(string, Terms, Terms)
Checks collection-level statistics on Lucene.Net.Index.Terms.
Declaration
public virtual void AssertTermsStatisticsEquals(string info, Terms leftTerms, Terms rightTerms)
Parameters
| Type | Name | Description |
|---|---|---|
| string | info | |
| Terms | leftTerms | |
| Terms | rightTerms |
AssumeFalse(string, bool)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static void AssumeFalse(string msg, bool condition)
Parameters
| Type | Name | Description |
|---|---|---|
| string | msg | Message to be included in the exception's string. |
| bool | condition | If |
AssumeNoException(string, Exception)
Assume e is null.
Declaration
public static void AssumeNoException(string msg, Exception e)
Parameters
| Type | Name | Description |
|---|---|---|
| string | msg | |
| Exception | e |
AssumeTrue(string, bool)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static void AssumeTrue(string msg, bool condition)
Parameters
| Type | Name | Description |
|---|---|---|
| string | msg | Message to be included in the exception's string. |
| bool | condition | If |
AtLeast(int)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static int AtLeast(int i)
Parameters
| Type | Name | Description |
|---|---|---|
| int | i |
Returns
| Type | Description |
|---|---|
| int |
AtLeast(Random, int)
Returns a number of at least i
Declaration
public static int AtLeast(Random random, int i)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| int | i |
Returns
| Type | Description |
|---|---|
| int |
BeforeClass()
Sets up dependency injection of codec factories for running the test class, and also picks random defaults for culture, time zone, similarity, and default codec.
If you override this method, be sure to callbase.BeforeClass() BEFORE setting
up your test fixture.
Declaration
[OneTimeSetUp]
public virtual void BeforeClass()
CreateTempDir()
Creates an empty, temporary folder (when the name of the folder is of no importance).
Declaration
public static DirectoryInfo CreateTempDir()
Returns
| Type | Description |
|---|---|
| DirectoryInfo |
See Also
CreateTempDir(string)
Creates an empty, temporary folder with the given name prefix under the
system's GetTempPath() or if supplied, the tempDir system property.
Declaration
public static DirectoryInfo CreateTempDir(string prefix)
Parameters
| Type | Name | Description |
|---|---|---|
| string | prefix |
Returns
| Type | Description |
|---|---|
| DirectoryInfo |
CreateTempFile()
Creates an empty temporary file.
The file will be automatically removed after the test class completes successfully. The test should close any file handles that would prevent the file from being removed.Declaration
public static FileInfo CreateTempFile()
Returns
| Type | Description |
|---|---|
| FileInfo |
See Also
CreateTempFile(string, string)
Creates an empty file with the given prefix and suffix under the
system's GetTempPath() or if supplied, the tempDir system property.
Declaration
public static FileInfo CreateTempFile(string prefix, string suffix)
Parameters
| Type | Name | Description |
|---|---|---|
| string | prefix | |
| string | suffix |
Returns
| Type | Description |
|---|---|
| FileInfo |
CultureForName(string)
return a CultureInfo object equivalent to its programmatic name.
Declaration
public static CultureInfo CultureForName(string localeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | localeName |
Returns
| Type | Description |
|---|---|
| CultureInfo |
DumpArray(string, object[], TextWriter)
Convenience method for logging an array. Wraps the array in an enumerator and delegates to DumpEnumerator(string, IEnumerator, TextWriter)
Declaration
public static void DumpArray(string label, object[] objs, TextWriter stream)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | |
| object[] | objs | |
| TextWriter | stream |
See Also
DumpEnumerator(string, IEnumerator, TextWriter)
Convenience method for logging an enumerator.
Declaration
public static void DumpEnumerator(string label, IEnumerator iter, TextWriter stream)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | String logged before/after the items in the enumerator. |
| IEnumerator | iter | Each element is ToString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty enumerator. |
| TextWriter | stream | Stream to log messages to. |
GetDataFile(string)
Gets a resource from the classpath as Stream. This method should only
be used, if a real file is needed. To get a stream, code should prefer
FindAndGetManifestResourceStream(Assembly, Type, string) using
this.GetType().Assembly and this.GetType().
Declaration
protected virtual Stream GetDataFile(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| Stream |
GetFullMethodName(string)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
protected string GetFullMethodName(string memberName = "")
Parameters
| Type | Name | Description |
|---|---|---|
| string | memberName |
Returns
| Type | Description |
|---|---|
| string |
GetOnlySegmentReader(DirectoryReader)
Some tests expect the directory to contain a single segment, and want to do tests on that segment's reader. This is an utility method to help them.
Declaration
public static SegmentReader GetOnlySegmentReader(DirectoryReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| DirectoryReader | reader |
Returns
| Type | Description |
|---|---|
| SegmentReader |
MaybeWrapReader(IndexReader)
Sometimes wrap the Lucene.Net.Index.IndexReader as slow, parallel or filter reader (or combinations of that)
Declaration
public static IndexReader MaybeWrapReader(IndexReader r)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexReader | r |
Returns
| Type | Description |
|---|---|
| IndexReader |
NewAlcoholicMergePolicy()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static AlcoholicMergePolicy NewAlcoholicMergePolicy()
Returns
| Type | Description |
|---|---|
| AlcoholicMergePolicy |
NewAlcoholicMergePolicy(Random, TimeZoneInfo)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static AlcoholicMergePolicy NewAlcoholicMergePolicy(Random random, TimeZoneInfo timeZone)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| TimeZoneInfo | timeZone |
Returns
| Type | Description |
|---|---|
| AlcoholicMergePolicy |
NewDirectory()
Returns a new Lucene.Net.Store.Directory instance. Use this when the test does not care about the specific Lucene.Net.Store.Directory implementation (most tests).
The Lucene.Net.Store.Directory is wrapped with BaseDirectoryWrapper. This means usually it will be picky, such as ensuring that you properly dispose it and close all open files in your test. It will emulate some features of Windows, such as not allowing open files to be overwritten.Declaration
public static BaseDirectoryWrapper NewDirectory()
Returns
| Type | Description |
|---|---|
| BaseDirectoryWrapper |
NewDirectory(Directory)
Returns a new Lucene.Net.Store.Directory instance, with contents copied from the provided directory. See NewDirectory() for more information.
Declaration
public static BaseDirectoryWrapper NewDirectory(Directory d)
Parameters
| Type | Name | Description |
|---|---|---|
| Directory | d |
Returns
| Type | Description |
|---|---|
| BaseDirectoryWrapper |
NewDirectory(Random)
Returns a new Lucene.Net.Store.Directory instance, using the specified random.
See NewDirectory() for more information.
Declaration
public static BaseDirectoryWrapper NewDirectory(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| BaseDirectoryWrapper |
NewDirectory(Random, Directory)
Returns a new Lucene.Net.Store.Directory instance, using the specified random
with contents copied from the provided directory. See
NewDirectory() for more information.
Declaration
public static BaseDirectoryWrapper NewDirectory(Random random, Directory directory)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| Directory | directory |
Returns
| Type | Description |
|---|---|
| BaseDirectoryWrapper |
NewFSDirectory(DirectoryInfo)
Returns a new Lucene.Net.Store.FSDirectory instance over the given file, which must be a folder.
Declaration
public static BaseDirectoryWrapper NewFSDirectory(DirectoryInfo d)
Parameters
| Type | Name | Description |
|---|---|---|
| DirectoryInfo | d |
Returns
| Type | Description |
|---|---|
| BaseDirectoryWrapper |
NewFSDirectory(DirectoryInfo, LockFactory)
Returns a new Lucene.Net.Store.FSDirectory instance over the given file, which must be a folder.
Declaration
public static BaseDirectoryWrapper NewFSDirectory(DirectoryInfo d, LockFactory lf)
Parameters
| Type | Name | Description |
|---|---|---|
| DirectoryInfo | d | |
| LockFactory | lf |
Returns
| Type | Description |
|---|---|
| BaseDirectoryWrapper |
NewField(Random, string, string, FieldType)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static Field NewField(Random random, string name, string value, FieldType type)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| string | name | |
| string | value | |
| FieldType | type |
Returns
| Type | Description |
|---|---|
| Field |
NewField(string, string, FieldType)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static Field NewField(string name, string value, FieldType type)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | value | |
| FieldType | type |
Returns
| Type | Description |
|---|---|
| Field |
NewIOContext(Random)
TODO: javadoc
Declaration
public static IOContext NewIOContext(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| IOContext |
NewIOContext(Random, IOContext)
TODO: javadoc
Declaration
public static IOContext NewIOContext(Random random, IOContext oldContext)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| IOContext | oldContext |
Returns
| Type | Description |
|---|---|
| IOContext |
NewIndexWriterConfig(LuceneVersion, Analyzer)
Create a new Lucene.Net.Index.IndexWriterConfig with random defaults.
Declaration
public static IndexWriterConfig NewIndexWriterConfig(LuceneVersion v, Analyzer a)
Parameters
| Type | Name | Description |
|---|---|---|
| LuceneVersion | v | |
| Analyzer | a |
Returns
| Type | Description |
|---|---|
| IndexWriterConfig |
NewIndexWriterConfig(Random, LuceneVersion, Analyzer)
Create a new Lucene.Net.Index.IndexWriterConfig with random defaults using the specified random.
Declaration
public static IndexWriterConfig NewIndexWriterConfig(Random random, LuceneVersion v, Analyzer a)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | A random instance (usually Random). |
| LuceneVersion | v | |
| Analyzer | a |
Returns
| Type | Description |
|---|---|
| IndexWriterConfig |
NewLogMergePolicy()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static LogMergePolicy NewLogMergePolicy()
Returns
| Type | Description |
|---|---|
| LogMergePolicy |
NewLogMergePolicy(bool)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MergePolicy NewLogMergePolicy(bool useCFS)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | useCFS |
Returns
| Type | Description |
|---|---|
| MergePolicy |
NewLogMergePolicy(bool, int)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MergePolicy NewLogMergePolicy(bool useCFS, int mergeFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | useCFS | |
| int | mergeFactor |
Returns
| Type | Description |
|---|---|
| MergePolicy |
NewLogMergePolicy(int)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MergePolicy NewLogMergePolicy(int mergeFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| int | mergeFactor |
Returns
| Type | Description |
|---|---|
| MergePolicy |
NewLogMergePolicy(Random)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static LogMergePolicy NewLogMergePolicy(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| LogMergePolicy |
NewMergePolicy()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MergePolicy NewMergePolicy()
Returns
| Type | Description |
|---|---|
| MergePolicy |
NewMergePolicy(Random)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MergePolicy NewMergePolicy(Random r)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | r |
Returns
| Type | Description |
|---|---|
| MergePolicy |
NewMockDirectory()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MockDirectoryWrapper NewMockDirectory()
Returns
| Type | Description |
|---|---|
| MockDirectoryWrapper |
NewMockDirectory(Random)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MockDirectoryWrapper NewMockDirectory(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| MockDirectoryWrapper |
NewMockFSDirectory(DirectoryInfo)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static MockDirectoryWrapper NewMockFSDirectory(DirectoryInfo d)
Parameters
| Type | Name | Description |
|---|---|---|
| DirectoryInfo | d |
Returns
| Type | Description |
|---|---|
| MockDirectoryWrapper |
NewSearcher(IndexReader)
Create a new searcher over the reader. this searcher might randomly use threads.
Declaration
public static IndexSearcher NewSearcher(IndexReader r)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexReader | r |
Returns
| Type | Description |
|---|---|
| IndexSearcher |
NewSearcher(IndexReader, bool)
Create a new searcher over the reader. This searcher might randomly use threads.
Declaration
public static IndexSearcher NewSearcher(IndexReader r, bool maybeWrap)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexReader | r | |
| bool | maybeWrap |
Returns
| Type | Description |
|---|---|
| IndexSearcher |
NewSearcher(IndexReader, bool, bool)
Create a new searcher over the reader. This searcher might randomly use
threads. If maybeWrap is true, this searcher might wrap the
reader with one that returns null for Lucene.Net.Index.CompositeReader.GetSequentialSubReaders(). If
wrapWithAssertions is true, this searcher might be an
AssertingIndexSearcher instance.
Declaration
public static IndexSearcher NewSearcher(IndexReader r, bool maybeWrap, bool wrapWithAssertions)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexReader | r | |
| bool | maybeWrap | |
| bool | wrapWithAssertions |
Returns
| Type | Description |
|---|---|
| IndexSearcher |
NewStringField(Random, string, string, Store)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static Field NewStringField(Random random, string name, string value, Field.Store stored)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| string | name | |
| string | value | |
| Field.Store | stored |
Returns
| Type | Description |
|---|---|
| Field |
NewStringField(string, string, Store)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static Field NewStringField(string name, string value, Field.Store stored)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | value | |
| Field.Store | stored |
Returns
| Type | Description |
|---|---|
| Field |
NewTextField(Random, string, string, Store)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static Field NewTextField(Random random, string name, string value, Field.Store stored)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random | |
| string | name | |
| string | value | |
| Field.Store | stored |
Returns
| Type | Description |
|---|---|
| Field |
NewTextField(string, string, Store)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static Field NewTextField(string name, string value, Field.Store stored)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | value | |
| Field.Store | stored |
Returns
| Type | Description |
|---|---|
| Field |
NewTieredMergePolicy()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static TieredMergePolicy NewTieredMergePolicy()
Returns
| Type | Description |
|---|---|
| TieredMergePolicy |
NewTieredMergePolicy(Random)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static TieredMergePolicy NewTieredMergePolicy(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| TieredMergePolicy |
RandomCulture(Random)
Return a random CultureInfo from the available cultures on the system.
See https://issues.apache.org/jira/browse/LUCENE-4020.Declaration
public static CultureInfo RandomCulture(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| CultureInfo |
RandomGaussian()
Returns the next pseudorandom, Gaussian ("normally") distributed
double value with mean 0.0 and standard
deviation 1.0 from this random number generator's sequence.
0.0 and standard deviation
1.0, is pseudorandomly generated and returned.
This uses the polar method of G. E. P. Box, M. E. Muller, and
G. Marsaglia, as described by Donald E. Knuth in The Art of
Computer Programming, Volume 3: Seminumerical Algorithms,
section 3.4.1, subsection C, algorithm P. Note that it generates two
independent values at the cost of only one call to Log(double)
and one call to Sqrt(double).
Declaration
public static double RandomGaussian()
Returns
| Type | Description |
|---|---|
| double | The next pseudorandom, Gaussian ("normally") distributed
double value with mean |
RandomTimeZone(Random)
Return a random TimeZoneInfo from the available timezones on the system
See https://issues.apache.org/jira/browse/LUCENE-4020.Declaration
public static TimeZoneInfo RandomTimeZone(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| TimeZoneInfo |
Rarely()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static bool Rarely()
Returns
| Type | Description |
|---|---|
| bool |
Rarely(Random)
Returns true if something should happen rarely,
The actual number returned will be influenced by whether TestNightly is active and RandomMultiplier.Declaration
public static bool Rarely(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| bool |
SetUp()
For subclasses to override. Overrides must call base.SetUp().
Declaration
[SetUp]
public virtual void SetUp()
SlowFileExists(Directory, string)
Returns true if the file exists (can be opened), false
if it cannot be opened, and (unlike .NET's
Exists(string)) if there's some
unexpected error, returns false.
Declaration
public static bool SlowFileExists(Directory dir, string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| Directory | dir | |
| string | fileName |
Returns
| Type | Description |
|---|---|
| bool |
TearDown()
For subclasses to override. Overrides must call base.TearDown().
Declaration
[TearDown]
public virtual void TearDown()
Usually()
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static bool Usually()
Returns
| Type | Description |
|---|---|
| bool |
Usually(Random)
Base class for all Lucene.Net unit tests.
Class and instance setup.
The preferred way to specify class (suite-level) setup/cleanup is to use static methods annotated with NUnit.Framework.OneTimeSetUpAttribute and NUnit.Framework.OneTimeTearDownAttribute. Any code in these methods is executed within the test framework's control and ensure proper setup has been made. Try not to use static initializers (including complex readonly field initializers). Static initializers are executed before any setup rules are fired and may cause you (or somebody else) headaches.
For instance-level setup, use NUnit.Framework.SetUpAttribute and NUnit.Framework.TearDownAttribute annotated
methods. If you override either SetUp() or TearDown() in
your subclass, make sure you call base.SetUp() and
base.TearDown(). This is detected and enforced.
Specifying test cases
Any test method annotated with NUnit.Framework.TestAttribute is considered a test case.
Randomized execution and test facilities
LuceneTestCase uses a custom LuceneTestCase.TestFixtureAttribute to execute test cases. The custom LuceneTestCase.TestFixtureAttribute has built-in support for test randomization including access to a repeatable Random instance. See Random property. Any test using Random acquired from Random should be fully reproducible (assuming no race conditions between threads etc.). The initial seed for a test case is reported in the failure test message.
The seed can be configured with a RunSettings file, a lucene.testsettings.json JSON file,
an environment variable, or using RandomSeedAttribute at the assembly level.
It is recommended to configure the culture also, since they are randomly picked from a list
of cultures installed on a given machine, so the culture will vary from one machine to the next.
.runsettings File Configuration Example
<RunSettings>
<TestRunParameters>
<Parameter name="tests:seed" value="0x1ffa1d067056b0e6" />
<Parameter name="tests:culture" value="sw-TZ" />
</TestRunParameters>
</RunSettings>See the .runsettings documentation at: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.
Attribute Configuration Example
[assembly: Lucene.Net.Util.RandomSeed("0x1ffa1d067056b0e6")]
[assembly: NUnit.Framework.SetCulture("sw-TZ")]lucene.testsettings.json File Configuration Example
Add a file named lucene.testsettings.json to the executable directory or any directory between the executable and the root of the drive with the following contents.
{
"tests": {
"seed": "0x1ffa1d067056b0e6",
"culture": "sw-TZ"
}
}Environment Variable Configuration Example
| Variable | Value |
|---|---|
| lucene:tests:seed | 0x1ffa1d067056b0e6 |
| lucene:tests:culture | sw-TZ |
Declaration
public static bool Usually(Random random)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | random |
Returns
| Type | Description |
|---|---|
| bool |