Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Oct 13, 2024
1 parent 7ff8382 commit 398a6db
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
10 changes: 8 additions & 2 deletions docs/mdsource/parameterised-nunit.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 26 additions & 20 deletions docs/parameterised-nunit.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,29 +246,35 @@ 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)
{
[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsage(string arg)
{
var settings = new VerifySettings();
settings.HashParameters();
return Verify(arg, settings);
}

[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsageFluent(string arg) =>
Verify(arg)
.HashParameters();
var settings = new VerifySettings();
settings.HashParameters();
return Verify(arg, settings);
}
```
<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#L4-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-UseParametersHashInstanceNunit' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Note that NUnit can derive the parameters without explicitly passing them.

### 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#L17-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-UseParametersHashFluentNunit' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
14 changes: 9 additions & 5 deletions src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#region UseParametersHashNunit

[TestFixture]
[TestFixture]
public class ParametersHashSample
{
#region UseParametersHashInstanceNunit

[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsage(string arg)
Expand All @@ -12,11 +12,15 @@ public Task HashParametersUsage(string arg)
return Verify(arg, settings);
}

#endregion

#region UseParametersHashFluentNunit

[TestCase("Value1")]
[TestCase("Value2")]
public Task HashParametersUsageFluent(string arg) =>
Verify(arg)
.HashParameters();
}

#endregion
#endregion
}

0 comments on commit 398a6db

Please sign in to comment.