diff --git a/docs/mdsource/parameterised-nunit.source.md b/docs/mdsource/parameterised-nunit.source.md index 62f24a97fc..9590e81190 100644 --- a/docs/mdsource/parameterised-nunit.source.md +++ b/docs/mdsource/parameterised-nunit.source.md @@ -80,6 +80,12 @@ snippet: IgnoreParametersForVerifiedCustomParamsFluentNunit include: hashing-parameters -snippet: UseParametersHashNunit -Note that NUnit can derive the parameters without explicitly passing them. \ No newline at end of file +### Instance + +snippet: UseParametersHashInstanceNunit + + +### Fluent + +snippet: UseParametersHashFluentNunit \ No newline at end of file diff --git a/docs/parameterised-nunit.md b/docs/parameterised-nunit.md index 8e5e9b0576..0f7092f31b 100644 --- a/docs/parameterised-nunit.md +++ b/docs/parameterised-nunit.md @@ -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. - - + +### Instance + + + ```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); } ``` -snippet source | anchor +snippet source | anchor -Note that NUnit can derive the parameters without explicitly passing them. + +### Fluent + + + +```cs +[TestCase("Value1")] +[TestCase("Value2")] +public Task HashParametersUsageFluent(string arg) => + Verify(arg) + .HashParameters(); +``` +snippet source | anchor + diff --git a/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs b/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs index fd94208729..ade3abb54d 100644 --- a/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs +++ b/src/Verify.NUnit.Tests/Snippets/ParametersHashSample.cs @@ -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 Task HashParametersUsage(string arg) return Verify(arg, settings); } + #endregion + + #region UseParametersHashFluentNunit + [TestCase("Value1")] [TestCase("Value2")] public Task HashParametersUsageFluent(string arg) => Verify(arg) .HashParameters(); -} -#endregion \ No newline at end of file + #endregion +} \ No newline at end of file