You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`VerifierSettings.IgnoreClassArguments()` can be used to globally ignore class constructor arguments from the verified filename. This is useful when infrastructure fixtures (e.g. TUnit's `ClassConstructor` or NUnit's `TestFixtureSource`) are injected via the constructor and should not affect snapshot file names. It must be called before any test runs, typically in a `[ModuleInitializer]`.
4
+
5
+
The received files still contain all class argument values.
6
+
7
+
```cs
8
+
[ModuleInitializer]
9
+
publicstaticvoidInit() =>
10
+
VerifierSettings.IgnoreClassArguments();
11
+
```
12
+
13
+
`IgnoreClassArguments` can also be used at the test level:
Copy file name to clipboardExpand all lines: docs/parameterised-nunit.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -250,6 +250,28 @@ public Task IgnoreParametersForVerifiedFluent(string arg) =>
250
250
<!-- endSnippet -->
251
251
252
252
253
+
## Ignore class arguments for verified filename
254
+
255
+
### Ignore class arguments<!-- include: ignore-class-arguments. path: /docs/mdsource/ignore-class-arguments.include.md -->
256
+
257
+
`VerifierSettings.IgnoreClassArguments()` can be used to globally ignore class constructor arguments from the verified filename. This is useful when infrastructure fixtures (e.g. TUnit's `ClassConstructor` or NUnit's `TestFixtureSource`) are injected via the constructor and should not affect snapshot file names. It must be called before any test runs, typically in a `[ModuleInitializer]`.
258
+
259
+
The received files still contain all class argument values.
260
+
261
+
```cs
262
+
[ModuleInitializer]
263
+
publicstaticvoidInit() =>
264
+
VerifierSettings.IgnoreClassArguments();
265
+
```
266
+
267
+
`IgnoreClassArguments` can also be used at the test level:
268
+
269
+
```cs
270
+
awaitVerify(result).IgnoreClassArguments();
271
+
```
272
+
<!-- endInclude -->
273
+
274
+
253
275
## IgnoreParametersForVerified with override parameters
254
276
255
277
The parameters passed to IgnoreParametersForVerified can be used pass custom parameters to [UseParameters](#UseParameters).
Copy file name to clipboardExpand all lines: docs/parameterised-tunit.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,6 +197,28 @@ public Task IgnoreParametersForVerifiedFluent(string arg) =>
197
197
<!-- endSnippet -->
198
198
199
199
200
+
## Ignore class arguments for verified filename
201
+
202
+
### Ignore class arguments<!-- include: ignore-class-arguments. path: /docs/mdsource/ignore-class-arguments.include.md -->
203
+
204
+
`VerifierSettings.IgnoreClassArguments()` can be used to globally ignore class constructor arguments from the verified filename. This is useful when infrastructure fixtures (e.g. TUnit's `ClassConstructor` or NUnit's `TestFixtureSource`) are injected via the constructor and should not affect snapshot file names. It must be called before any test runs, typically in a `[ModuleInitializer]`.
205
+
206
+
The received files still contain all class argument values.
207
+
208
+
```cs
209
+
[ModuleInitializer]
210
+
publicstaticvoidInit() =>
211
+
VerifierSettings.IgnoreClassArguments();
212
+
```
213
+
214
+
`IgnoreClassArguments` can also be used at the test level:
215
+
216
+
```cs
217
+
awaitVerify(result).IgnoreClassArguments();
218
+
```
219
+
<!-- endInclude -->
220
+
221
+
200
222
## IgnoreParametersForVerified with override parameters
201
223
202
224
The parameters passed to IgnoreParametersForVerified can be used pass custom parameters to [UseParameters](#UseParameters).
0 commit comments