Skip to content

Commit 3d2a263

Browse files
committed
ensure DerivePathInfo is only called once
1 parent 7690137 commit 3d2a263

File tree

7 files changed

+28
-7
lines changed

7 files changed

+28
-7
lines changed

src/Verify.Expecto/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, string typeName, string
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

src/Verify.Fixie/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, Type type, MethodInfo me
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

src/Verify.MSTest/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, Type type, MethodInfo me
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

src/Verify.NUnit/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, Type type, MethodInfo me
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

src/Verify.TUnit/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, Type type, MethodInfo me
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

src/Verify.Xunit/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, Type type, MethodInfo me
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

src/Verify.XunitV3/DerivePaths/Verifier.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ internal static PathInfo GetPathInfo(string sourceFile, Type type, MethodInfo me
1818
/// To move to this approach, any existing `.verified.` files will need to be moved to the new directory
1919
/// </remarks>
2020
/// <param name="derivePathInfo">Custom callback to control the behavior.</param>
21-
public static void DerivePathInfo(DerivePathInfo derivePathInfo) =>
21+
public static void DerivePathInfo(DerivePathInfo derivePathInfo)
22+
{
23+
InnerVerifier.ThrowIfVerifyHasBeenRun();
2224
Verifier.derivePathInfo = derivePathInfo;
25+
}
2326

2427
/// <summary>
2528
/// Use a directory relative to the project directory for storing for `.verified.` files.

0 commit comments

Comments
 (0)