VerifyTests/Verify

Add `AddScrubber` overload to `SettingsTask` which accepts an `Action<StringBuilder,Counter>`

Closed this issue · 3 comments

Is the feature request related to a problem

We want to add our own GUID scrubber which will scrub GUIDs within text/numbers (see #1316).
The scrubber uses the Counter provided by Verify, therefore we need to inject it using the SettingsTask.CurrentSettings.AddScrubber(...) method, rather than the SettingsTask.AddScrubber(...) method,
because the latter does not accept Action<StringBuilder,Counter>.

Describe the solution

Add an overload to the SettingsTask.AddScrubber(...) which accepts the Action<StringBuilder,Counter>.

Describe alternatives considered

The alternative we use currently:

var settingsTask = Verifier.Verify(StuffToBeVerified);
settingsTask.CurrentSettings.AddScrubber(OurScrubber, ...);
await settingsTask;

it works, but it is very clunky compared to the more fluent

await Verifier.Verify(StuffToBeVerified).AddScrubber(OurScrubber, ...);

Additional context

This feature assumes that Scrubbers of the type Action<StringBuilder,Counter> are equivalent to those of type Action<StringBuilder> and therefore the additional complication of using the former seems unnecessary.

If this assumption is wrong, the feature may require some discussion.

you should be able to use Counter.Current

@SimonCropp thanks a lot, we will give it a try

Using Counter.Current works well. Thanks!