Resolved problem with running tests all together.
This commit is contained in:
1 parent
e4e63715c2
commit
a5a4129f1c
1 file changed
+5
-39
@@ -35,13 +35,6 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<long, IEnumerable<long>>? _testCases = new();
|
|
||||||
|
|
||||||
public RecyclableListTestData()
|
|
||||||
{
|
|
||||||
_testCases ??= new();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<long> DoCreateTestData(long itemsCount)
|
private static IEnumerable<long> DoCreateTestData(long itemsCount)
|
||||||
{
|
{
|
||||||
for (long index = 1; index <= itemsCount; index++)
|
for (long index = 1; index <= itemsCount; index++)
|
||||||
@@ -50,30 +43,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<long> CreateTestData(long itemsCount)
|
public static IEnumerable<long> CreateTestData(long itemsCount) => DoCreateTestData(itemsCount).ToArray();
|
||||||
{
|
|
||||||
if (_testCases!.TryGetValue(itemsCount, out var testCases))
|
|
||||||
{
|
|
||||||
return testCases;
|
|
||||||
}
|
|
||||||
|
|
||||||
testCases = DoCreateTestData(itemsCount).ToArray();
|
|
||||||
_testCases.Add(itemsCount, testCases);
|
|
||||||
return testCases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
DisposeTestData(_testCases?.Values);
|
|
||||||
DisposeTestData(_sourceDataVariants);
|
|
||||||
DisposeTestData(_emptySourceDataVariants);
|
|
||||||
_testCases = null;
|
|
||||||
_sourceDataVariants = null;
|
|
||||||
_targetDataVariants = null;
|
|
||||||
_sourceTargetDataVariants = null;
|
|
||||||
_emptySourceDataVariants = null;
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly IEnumerable<long> ItemsCountVariants = new long[]
|
public static readonly IEnumerable<long> ItemsCountVariants = new long[]
|
||||||
{
|
{
|
||||||
@@ -98,8 +68,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<object[]>? _targetDataVariants;
|
public static IEnumerable<object[]> TargetDataVariants => GetTargetDataVariants().ToArray();
|
||||||
public static IEnumerable<object[]> TargetDataVariants => _targetDataVariants ??= GetTargetDataVariants().ToArray();
|
|
||||||
|
|
||||||
private static IEnumerable<object[]> CreateSourceDataVariants()
|
private static IEnumerable<object[]> CreateSourceDataVariants()
|
||||||
{
|
{
|
||||||
@@ -125,8 +94,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<object[]>? _sourceDataVariants;
|
public static IEnumerable<object[]> SourceDataVariants => CreateSourceDataVariants().ToArray();
|
||||||
public static IEnumerable<object[]> SourceDataVariants => _sourceDataVariants ??= CreateSourceDataVariants().ToArray();
|
|
||||||
|
|
||||||
private static IEnumerable<object[]> CreateSourceEmptyDataVariants() => new[]
|
private static IEnumerable<object[]> CreateSourceEmptyDataVariants() => new[]
|
||||||
{
|
{
|
||||||
@@ -139,8 +107,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
new object[] { "IEnumerable<int> without non-enumerated count", new EnumerableWithoutCount<long>(Array.Empty<long>()) }
|
new object[] { "IEnumerable<int> without non-enumerated count", new EnumerableWithoutCount<long>(Array.Empty<long>()) }
|
||||||
};
|
};
|
||||||
|
|
||||||
private static IEnumerable<object[]>? _emptySourceDataVariants;
|
public static IEnumerable<object[]> EmptySourceDataVariants => CreateSourceEmptyDataVariants().ToArray();
|
||||||
public static IEnumerable<object[]> EmptySourceDataVariants => _emptySourceDataVariants ??= CreateSourceEmptyDataVariants().ToArray();
|
|
||||||
|
|
||||||
private static IEnumerable<object[]> CreateSourceTargetDataVariants()
|
private static IEnumerable<object[]> CreateSourceTargetDataVariants()
|
||||||
{
|
{
|
||||||
@@ -153,7 +120,6 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<object[]>? _sourceTargetDataVariants;
|
public static IEnumerable<object[]> SourceTargetDataVariants => CreateSourceTargetDataVariants().ToArray();
|
||||||
public static IEnumerable<object[]> SourceTargetDataVariants => _sourceTargetDataVariants ??= CreateSourceTargetDataVariants().ToArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user