This commit is contained in:
Simon Cropp 2024-10-13 21:49:22 +11:00
Родитель 7ff8382628
Коммит 398a6dbdd0
3 изменённых файлов: 44 добавлений и 28 удалений

Просмотреть файл

@ -80,6 +80,12 @@ snippet: IgnoreParametersForVerifiedCustomParamsFluentNunit
include: hashing-parameters
snippet: UseParametersHashNunit
Note that NUnit can derive the parameters without explicitly passing them.
### Instance
snippet: UseParametersHashInstanceNunit
### Fluent
snippet: UseParametersHashFluentNunit

Просмотреть файл

@ -246,12 +246,12 @@ Hashing parameter is achieved by using `HashParameters`.
[XxHash64](https://learn.microsoft.com/en-us/dotnet/api/system.io.hashing.xxhash64) is used to perform the hash.<!-- endInclude -->
<!-- snippet: UseParametersHashNunit -->
<a id='snippet-UseParametersHashNunit'></a>
### Instance
<!-- snippet: UseParametersHashInstanceNunit -->
<a id='snippet-UseParametersHashInstanceNunit'></a>
```cs
[TestFixture]
public class ParametersHashSample
{
[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsage(string arg)
@ -260,15 +260,21 @@ public class ParametersHashSample
settings.HashParameters();
return Verify(arg, settings);
}
```
<sup><a href='/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs#L4-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-UseParametersHashInstanceNunit' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
### Fluent
<!-- snippet: UseParametersHashFluentNunit -->
<a id='snippet-UseParametersHashFluentNunit'></a>
```cs
[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsageFluent(string arg) =>
Verify(arg)
.HashParameters();
}
```
<sup><a href='/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs#L1-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-UseParametersHashNunit' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs#L17-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-UseParametersHashFluentNunit' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
Note that NUnit can derive the parameters without explicitly passing them.

Просмотреть файл

@ -1,8 +1,8 @@
#region UseParametersHashNunit
[TestFixture]
[TestFixture]
public class ParametersHashSample
{
#region UseParametersHashInstanceNunit
[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsage(string arg)
@ -12,11 +12,15 @@ public class ParametersHashSample
return Verify(arg, settings);
}
#endregion
#region UseParametersHashFluentNunit
[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsageFluent(string arg) =>
Verify(arg)
.HashParameters();
}
#endregion
}