Skip to content

Commit 86110c1

Browse files
committed
More test refactoring.
1 parent 0945992 commit 86110c1

File tree

106 files changed

+3716
-474368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+3716
-474368
lines changed

ReferenceFinder/ReferenceFinderTool.cs

Lines changed: 184 additions & 185 deletions
Large diffs are not rendered by default.

TestCommon/Context.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using NUnit.Framework;
2+
3+
namespace UnityDataTools.TestCommon;
4+
5+
public class Context
6+
{
7+
public string UnityDataFolder { get; }
8+
public string UnityDataVersion { get; }
9+
public string TestDataFolder { get; }
10+
public string ExpectedDataFolder { get; }
11+
public ExpectedData ExpectedData { get; } = new();
12+
13+
private Context(string folder)
14+
{
15+
var di = new DirectoryInfo(folder);
16+
17+
UnityDataFolder = folder;
18+
UnityDataVersion = di.Name;
19+
TestDataFolder = di.Parent.FullName;
20+
ExpectedDataFolder = Path.Combine(di.Parent.Parent.FullName, "ExpectedData", UnityDataVersion);
21+
22+
ExpectedData.Load(ExpectedDataFolder);
23+
}
24+
25+
public static IEnumerable<Context> GetAll()
26+
{
27+
if (m_Cache.TryGetValue(TestContext.CurrentContext.TestDirectory, out var cases))
28+
{
29+
return cases;
30+
}
31+
32+
cases = new List<Context>();
33+
m_Cache[TestContext.CurrentContext.TestDirectory] = cases;
34+
foreach (var folder in Directory.EnumerateDirectories(Path.Combine(TestContext.CurrentContext.TestDirectory, "Data")))
35+
{
36+
cases.Add(new Context(folder));
37+
}
38+
39+
return cases;
40+
}
41+
42+
private static Dictionary<string, List<Context>> m_Cache = new();
43+
}

0 commit comments

Comments
 (0)