Skip to content

Commit

Permalink
add missing ThrowIfVerifyHasBeenRun
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jan 9, 2023
1 parent cdbef11 commit 58ee1bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Verify/Callbacks/VerifySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ internal static Task RunOnVerifyMismatch(FilePair item, string? message)
return handleOnVerifyMismatch(item, message);
}

public static void OnVerifyMismatch(VerifyMismatch verifyMismatch) =>
public static void OnVerifyMismatch(VerifyMismatch verifyMismatch)
{
InnerVerifier.ThrowIfVerifyHasBeenRun();
handleOnVerifyMismatch += verifyMismatch;
}

public static void OnVerify(Action before, Action after)
{
Expand Down
1 change: 1 addition & 0 deletions src/Verify/Serialization/VerifierSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public static partial class VerifierSettings
public static void TreatAsString<T>(AsString<T>? toString = null)
where T : notnull
{
InnerVerifier.ThrowIfVerifyHasBeenRun();
toString ??= (target, _) => new(target.ToString()!);
typeToString[typeof(T)] = (target, settings) => toString((T) target, settings);
}
Expand Down

0 comments on commit 58ee1bb

Please sign in to comment.