-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathVerifierSettings.cs
30 lines (24 loc) · 1.08 KB
/
VerifierSettings.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
// ReSharper disable UnusedParameter.Local
namespace VerifyExpecto;
public partial class Verifier
{
#region defaultDerivePathInfo
static DerivePathInfo derivePathInfo = (sourceFile, projectDirectory, type, method) =>
new(
directory: Path.GetDirectoryName(sourceFile)!,
typeName: type,
methodName: method);
#endregion
internal static PathInfo GetPathInfo(string sourceFile, string typeName, string methodName) =>
derivePathInfo(sourceFile, TargetAssembly.ProjectDir, typeName, methodName);
/// <summary>
/// Use custom path information for `.verified.` files.
/// </summary>
/// <remarks>
/// This is sometimes needed on CI systems that move/remove the original source.
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
/// </remarks>
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
Verifier.derivePathInfo = derivePathInfo;
}