blob: cb73b668509475f5c33bd8d6ea2e27572bc3b977 (
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
|
using System;
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}";
}
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");
}
}
}
}
|