-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathPathInfo.cs
46 lines (40 loc) · 1.3 KB
/
PathInfo.cs
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
namespace VerifyTests;
[DebuggerDisplay("Directory = {Directory} | TypeName = {TypeName} | MethodName = {MethodName}")]
public readonly struct PathInfo
{
public string? Directory { get; }
public string? TypeName { get; }
public string? MethodName { get; }
public PathInfo(
string? directory = null,
string? typeName = null,
string? methodName = null)
{
Guards.BadDirectoryName(directory);
Guards.BadFileNameNullable(typeName);
Guards.BadFileNameNullable(methodName);
TypeName = typeName;
MethodName = methodName;
Directory = directory;
}
#region defaultDerivePathInfo
public static PathInfo DeriveDefault(
string sourceFile,
string projectDirectory,
Type type,
MethodInfo method) =>
new(
directory: IoHelpers.ResolveDirectoryFromSourceFile(sourceFile),
typeName: type.NameWithParent(),
methodName: method.Name);
#endregion
internal static PathInfo DeriveDefault(
string sourceFile,
string projectDirectory,
string typeName,
string methodName) =>
new(
directory: IoHelpers.ResolveDirectoryFromSourceFile(sourceFile),
typeName: typeName,
methodName: methodName);
}