blob: 790e41102d97dc1347acb5552bac52e34551188c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using System;
using System.Linq;
using Mono.Linker.Tests.Extensions;
namespace Mono.Linker.Tests.TestCases {
public class TestCase {
public TestCase (NPath sourceFile, NPath rootCasesDirectory, NPath originalTestCaseAssemblyPath)
{
SourceFile = sourceFile;
OriginalTestCaseAssemblyPath = originalTestCaseAssemblyPath;
Name = sourceFile.FileNameWithoutExtension;
DisplayName = $"{sourceFile.RelativeTo (rootCasesDirectory).Parent.ToString (SlashMode.Forward).Replace ('/', '.')}.{sourceFile.FileNameWithoutExtension}";
// A little hacky, but good enough for name. No reason why namespace & type names
// should not follow the directory structure
ReconstructedFullTypeName = $"{sourceFile.Parent.RelativeTo (rootCasesDirectory.Parent).ToString (SlashMode.Forward).Replace ('/', '.')}.{sourceFile.FileNameWithoutExtension}";
var firstParentRelativeToRoot = SourceFile.RelativeTo (rootCasesDirectory).Elements.First ();
TestSuiteDirectory = rootCasesDirectory.Combine (firstParentRelativeToRoot);
}
public string Name { get; }
public string DisplayName { get; }
public NPath SourceFile { get; }
public NPath OriginalTestCaseAssemblyPath { get; }
public string ReconstructedFullTypeName { get; }
public bool HasLinkXmlFile {
get { return SourceFile.ChangeExtension ("xml").FileExists (); }
}
public NPath LinkXmlFile {
get
{
if (!HasLinkXmlFile)
throw new InvalidOperationException ("This test case does not have a link xml file");
return SourceFile.ChangeExtension ("xml");
}
}
public NPath TestSuiteDirectory { get; }
}
}
|