diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 29277b1a4..a7ff0118d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,9 +23,9 @@ updates: fallout: patterns: - "Fallout*" - xunit: + tunit: patterns: - - "xunit*" + - "TUnit*" aweXpect: patterns: - "aweXpect*" diff --git a/AGENTS.md b/AGENTS.md index 4de2825d8..a4bd44eea 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,8 +4,8 @@ Mockolate is a source-generated mocking library for .NET. Users write `IFoo.Crea ## SDK and Build -- Use the SDK pinned in `global.json` (.NET 10, `rollForward: latestMinor`). Tests also run on .NET 8, and on .NET Framework 4.8 on Windows only. -- Build from the root with `dotnet build Mockolate.slnx`. Shared settings live in the root `Directory.Build.props` (strong naming, `MinimumRoslynVersion`), `Source/Directory.Build.props` (target frameworks, warnings as errors, AOT and trimming flags) and `Tests/Directory.Build.props` (test frameworks, xUnit, aweXpect). +- Use the SDK pinned in `global.json` (.NET 10, `rollForward: latestPatch`). Tests also run on .NET 8, and on .NET Framework 4.8 on Windows only. +- Build from the root with `dotnet build Mockolate.slnx`. Shared settings live in the root `Directory.Build.props` (strong naming, `MinimumRoslynVersion`), `Source/Directory.Build.props` (target frameworks, warnings as errors, AOT and trimming flags) and `Tests/Directory.Build.props` (test frameworks, TUnit, aweXpect). - Package versions belong only in `Directory.Packages.props`. `VersionOverride` is used only to pin Roslyn packages to `$(MinimumRoslynVersion)`. ## Design Goals @@ -22,7 +22,7 @@ Correctness is a must. The other goals are strong defaults and win in this order - **Performance**: recording, setup matching and verification are hot paths with allocation-free fast paths (`FastMockInteractions`, the `Fast*Buffer` types). Measure hot-path changes with the benchmarks before and after. - **Public API**: every change to the public surface of `Mockolate` shows up in the API snapshots. Document new public members with XML comments. Mark breaking changes with `!` in the PR title (`feat!:`, `refactor!:`). - **Strong naming**: all assemblies are signed with `strongname.snk`; an `InternalsVisibleTo` needs `PublicKey="$(PublicKey)"`. -- **Style**: follow `.editorconfig`: tabs, explicit types instead of `var`, `_camelCase` private fields, no `this.`, `System` usings first. Tests use xUnit with aweXpect (`await That(...)`). +- **Style**: follow `.editorconfig`: tabs, explicit types instead of `var`, `_camelCase` private fields, no `this.`, `System` usings first. Tests use TUnit with aweXpect (`await That(...)`). ## Validation diff --git a/Directory.Packages.props b/Directory.Packages.props index c141a6fae..c968bf725 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -28,12 +28,10 @@ - - - - - + + + diff --git a/Docs/agents/workflows.md b/Docs/agents/workflows.md index 3c8da5c91..ce0782bbe 100644 --- a/Docs/agents/workflows.md +++ b/Docs/agents/workflows.md @@ -12,15 +12,20 @@ The test projects reference the generator as an analyzer through a project refer ## Test +The tests use TUnit on the Microsoft.Testing.Platform, which `global.json` selects as the runner of `dotnet test`. Each test project is an executable, so `dotnet run` works as well. The explicit tests (the snapshot acceptance tests) run only when the filter selects nothing but explicit tests. + ```powershell # One project, all of its target frameworks -dotnet test Tests/Mockolate.Tests +dotnet test --project Tests/Mockolate.Tests + +# One framework and a tree node filter (/assembly/namespace/class/test, nested classes match with a wildcard) +dotnet test --project Tests/Mockolate.Tests -f net10.0 --treenode-filter "/*/*/*IsTrueTests/*" -# One framework and a name filter (VSTest filter syntax) -dotnet test Tests/Mockolate.Tests -f net10.0 --filter "FullyQualifiedName~IsTrueTests" +# The same without dotnet test +dotnet run --project Tests/Mockolate.Tests -f net10.0 -- --treenode-filter "/*/*/*IsTrueTests/*" # Everything in the solution -dotnet test Mockolate.slnx +dotnet test --solution Mockolate.slnx ``` Target frameworks per test project: @@ -52,7 +57,7 @@ A newer language feature can compile for `net10.0` and fail for `net48`; build o After an intended change, overwrite the expected files with the explicit acceptance test and review the diff: ```powershell -dotnet test Tests/Mockolate.SourceGenerators.Tests --filter "FullyQualifiedName~AcceptSnapshotChanges" -- xUnit.Explicit=only +dotnet test --project Tests/Mockolate.SourceGenerators.Tests --treenode-filter "/*/*/*/AcceptSnapshotChanges" git diff -- Tests/Mockolate.SourceGenerators.Tests/Snapshot ``` @@ -67,7 +72,7 @@ To add a scenario, add an entry to `Scenarios` and run the acceptance test. - run the tests with `AWEXPECT_ACCEPT_SNAPSHOTS=all`. ```powershell -dotnet test Tests/Mockolate.Api.Tests --filter "FullyQualifiedName~AcceptApiChanges" -- xUnit.Explicit=only +dotnet test --project Tests/Mockolate.Api.Tests --treenode-filter "/*/*/*/AcceptApiChanges" ``` Commit the updated snapshots with the change; never commit pending files. @@ -96,13 +101,13 @@ CI runs one job per class: `CallbackBenchmarks`, `CompleteEventBenchmarks`, `Com ## Mutation Tests -Stryker mutates `Source/Mockolate` against `Mockolate.Tests` and `Mockolate.Internal.Tests` on `net8.0` with mutation level `Advanced`. Outside `main` it only mutates code changed since `main`. A full run takes long; run it only when asked: +Stryker mutates `Source/Mockolate` against `Mockolate.Tests` and `Mockolate.Internal.Tests` on `net8.0` with mutation level `Advanced`, through its runner for the Microsoft.Testing.Platform (`--test-runner mtp`). The version is the `dotnet-stryker` `PackageDownload` in `Pipeline/Build.csproj`. Outside `main` it only mutates code changed since `main`. A full run takes long; run it only when asked: ```powershell -./build.ps1 MutationTestExecution +./build.ps1 MutationTests ``` -Reports go to `Artifacts/Stryker`. The `MutationTests` target also prepares the PR comment and expects to run in GitHub Actions. +Reports go to `Artifacts/Stryker`, together with the Markdown body of the PR comment. `MutationTestsComment` and `MutationTestsDashboard` post the comment and upload the report, and expect to run in GitHub Actions. ## Build Pipeline (Fallout) @@ -111,14 +116,14 @@ Reports go to `Artifacts/Stryker`. The `MutationTests` target also prepares the | Target | Purpose | |---|---| | `Compile` | Restore and build the solution with the GitVersion-derived version | -| `UnitTests` | Run `Build.Tests`, `Mockolate.Tests`, `Mockolate.Internal.Tests`, `Mockolate.Analyzers.Tests` and `Mockolate.SourceGenerators.Tests` for each framework (`net48` only on Windows) with coverage | -| `CodeCoverage` | `UnitTests` plus a ReportGenerator OpenCover report in `TestResults/reports` | +| `UnitTests` | Run `Build.Tests`, `Mockolate.Tests`, `Mockolate.Internal.Tests`, `Mockolate.Analyzers.Tests` and `Mockolate.SourceGenerators.Tests` for each framework (`net48` only on Windows), with a TRX and a Cobertura coverage file per project and framework in `TestResults` | +| `CodeCoverage` | `UnitTests` plus a ReportGenerator SonarQube report in `TestResults/reports` | | `ApiChecks` | Run `Mockolate.Api.Tests` | | `CodeAnalysis` | SonarCloud analysis (needs `SonarToken`) | | `Pack` | Build the NuGet package into `Artifacts/Packages`, with a release-specific README | | `Benchmarks` | Run the benchmarks (`--benchmark-filter`, default `*`) and print the reports | | `BenchmarkComment`, `PublishBenchmarkReport` | CI only: PR comment and docs site data | -| `MutationTests`, `MutationTestExecution`, `MutationTestComment`, `MutationTestDashboard` | Stryker run, PR comment and dashboard upload | +| `MutationTests`, `MutationTestsComment`, `MutationTestsDashboard` | Stryker run, PR comment and dashboard upload | | `UpdateReadme` | Write the packaged README to `Artifacts/README.md` | ## CI Workflows diff --git a/Pipeline/Build.ApiChecks.cs b/Pipeline/Build.ApiChecks.cs index fee643576..4f6e03e7f 100644 --- a/Pipeline/Build.ApiChecks.cs +++ b/Pipeline/Build.ApiChecks.cs @@ -21,8 +21,9 @@ partial class Build .SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US") .EnableNoBuild() .SetResultsDirectory(TestResultsDirectory) - .CombineWith(cc => cc - .SetProjectFile(project) - .AddLoggers($"trx;LogFileName={project.Name}.trx")), completeOnFailure: true); + .AddProcessAdditionalArguments( + $"--project \"{project.Path}\"", + "--report-trx", + $"--report-trx-filename {project.Name}.trx")); }); } diff --git a/Pipeline/Build.CodeCoverage.cs b/Pipeline/Build.CodeCoverage.cs index 0efea9625..166722774 100644 --- a/Pipeline/Build.CodeCoverage.cs +++ b/Pipeline/Build.CodeCoverage.cs @@ -17,7 +17,7 @@ partial class Build .SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll", framework: "net10.0")) .SetTargetDirectory(TestResultsDirectory / "reports") - .AddReports(TestResultsDirectory / "**/coverage.cobertura.xml") + .AddReports(TestResultsDirectory / "**/*.cobertura.xml") // The generic format of Sonar lists the lines per file. A format that lists them per method leaves out the // lines of a lambda in a generic class, because ReportGenerator keeps them in a class without methods. .AddReportTypes(ReportTypes.SonarQube) diff --git a/Pipeline/Build.MutationTests.cs b/Pipeline/Build.MutationTests.cs index f25b76139..35a250c61 100644 --- a/Pipeline/Build.MutationTests.cs +++ b/Pipeline/Build.MutationTests.cs @@ -92,8 +92,9 @@ partial class Build File.WriteAllText(configFile, configText); Log.Debug($"Created '{configFile}':{Environment.NewLine}{configText}"); + // The unit tests are executables of the Microsoft.Testing.Platform, which the default runner (VSTest) cannot run. string arguments = - $"-f \"{configFile}\" -O \"{strykerOutputDirectory}\" -r \"Markdown\" -r \"cleartext\" -r \"json\""; + $"-f \"{configFile}\" -O \"{strykerOutputDirectory}\" -r \"Markdown\" -r \"cleartext\" -r \"json\" --test-runner mtp"; string executable = EnvironmentInfo.IsWin ? "dotnet-stryker.exe" : "dotnet-stryker"; IProcess process = ProcessTasks.StartProcess( diff --git a/Pipeline/Build.UnitTest.cs b/Pipeline/Build.UnitTest.cs index 6b1533e9e..f5ea539e1 100644 --- a/Pipeline/Build.UnitTest.cs +++ b/Pipeline/Build.UnitTest.cs @@ -36,17 +36,21 @@ partial class Build .SetConfiguration(Configuration) .SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US") .EnableNoBuild() - .SetDataCollector("XPlat Code Coverage") .SetResultsDirectory(TestResultsDirectory) .CombineWith( UnitTestProjects, (settings, project) => settings - .SetProjectFile(project) .CombineWith( project.GetTargetFrameworks()?.Except(excludedFrameworks), (frameworkSettings, framework) => frameworkSettings .SetFramework(framework) - .AddLoggers($"trx;LogFileName={project.Name}_{framework}.trx") + .AddProcessAdditionalArguments( + $"--project \"{project.Path}\"", + "--report-trx", + $"--report-trx-filename {project.Name}_{framework}.trx", + "--coverage", + "--coverage-output-format cobertura", + $"--coverage-output {project.Name}_{framework}.cobertura.xml") ) ), completeOnFailure: true ); diff --git a/Pipeline/Build.csproj b/Pipeline/Build.csproj index 524718798..f0496e9e9 100644 --- a/Pipeline/Build.csproj +++ b/Pipeline/Build.csproj @@ -27,12 +27,10 @@ - - diff --git a/Tests/Build.Tests/BenchmarkReportHelpersTests.cs b/Tests/Build.Tests/BenchmarkReportHelpersTests.cs index 99a711506..e7a7f4ca4 100644 --- a/Tests/Build.Tests/BenchmarkReportHelpersTests.cs +++ b/Tests/Build.Tests/BenchmarkReportHelpersTests.cs @@ -2,7 +2,7 @@ namespace Build.Tests; public sealed class BenchmarkReportHelpersTests { - [Fact] + [Test] public async Task ApplyHeaderAndPrefixStripping_ShouldRemoveCommonPrefixFromDataRow() { TableRow row = new(BenchmarkTableParser.DataRowStartIndex, ["PropRead_Mockolate", "1",]); @@ -12,7 +12,7 @@ public async Task ApplyHeaderAndPrefixStripping_ShouldRemoveCommonPrefixFromData await That(result).IsEqualTo(["Mockolate", "1",]); } - [Fact] + [Test] public async Task ApplyHeaderAndPrefixStripping_ShouldStripTrailingUnderscoreFromHeader() { TableRow header = new(0, ["Method", "Mean",]); @@ -22,7 +22,7 @@ public async Task ApplyHeaderAndPrefixStripping_ShouldStripTrailingUnderscoreFro await That(result).IsEqualTo(["PropRead", "Mean",]); } - [Fact] + [Test] public async Task ApplyHeaderAndPrefixStripping_WhenCommonPrefixIsNull_ShouldReturnTokensUnchanged() { TableRow row = new(BenchmarkTableParser.DataRowStartIndex, ["Foo", "1",]); @@ -32,7 +32,7 @@ public async Task ApplyHeaderAndPrefixStripping_WhenCommonPrefixIsNull_ShouldRet await That(result).IsEqualTo(["Foo", "1",]); } - [Fact] + [Test] public async Task DetermineDroppedColumnIndices_ShouldMatchCaseInsensitivelyAndReturnIndicesInHeaderOrder() { int[] indices = BenchmarkReport.DetermineDroppedColumnIndices( @@ -42,7 +42,7 @@ public async Task DetermineDroppedColumnIndices_ShouldMatchCaseInsensitivelyAndR await That(indices).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task DetermineDroppedColumnIndices_WhenNoColumnsMatch_ShouldReturnEmpty() { int[] indices = BenchmarkReport.DetermineDroppedColumnIndices( @@ -52,7 +52,7 @@ public async Task DetermineDroppedColumnIndices_WhenNoColumnsMatch_ShouldReturnE await That(indices).IsEqualTo(Array.Empty()); } - [Fact] + [Test] public async Task FindColumnIndex_ShouldMatchCaseInsensitively() { int index = BenchmarkReport.FindColumnIndex(["Method", "Mean", "Alloc Ratio",], "alloc ratio"); @@ -60,7 +60,7 @@ public async Task FindColumnIndex_ShouldMatchCaseInsensitively() await That(index).IsEqualTo(2); } - [Fact] + [Test] public async Task FindColumnIndex_WhenColumnNotFound_ShouldReturnMinusOne() { int index = BenchmarkReport.FindColumnIndex(["Method", "Mean",], "Ratio"); @@ -68,7 +68,7 @@ public async Task FindColumnIndex_WhenColumnNotFound_ShouldReturnMinusOne() await That(index).IsEqualTo(-1); } - [Fact] + [Test] public async Task FindCommonRowPrefix_ShouldIgnoreHeaderAndSeparatorRows() { List rows = @@ -82,7 +82,7 @@ public async Task FindCommonRowPrefix_ShouldIgnoreHeaderAndSeparatorRows() await That(prefix).IsNull(); } - [Fact] + [Test] public async Task FindCommonRowPrefix_ShouldSkipBaselineMarkerRow() { List rows = @@ -97,7 +97,7 @@ public async Task FindCommonRowPrefix_ShouldSkipBaselineMarkerRow() await That(prefix).IsEqualTo("Indexer_"); } - [Fact] + [Test] public async Task FindCommonRowPrefix_ShouldSkipEmptyDataRowAndUseRemainingRows() { List rows = @@ -114,7 +114,7 @@ public async Task FindCommonRowPrefix_ShouldSkipEmptyDataRowAndUseRemainingRows( await That(prefix).IsEqualTo("Indexer_"); } - [Fact] + [Test] public async Task FindCommonRowPrefix_WhenADataRowHasNoUnderscore_ShouldReturnNull() { List rows = @@ -127,7 +127,7 @@ public async Task FindCommonRowPrefix_WhenADataRowHasNoUnderscore_ShouldReturnNu await That(prefix).IsNull(); } - [Fact] + [Test] public async Task FindCommonRowPrefix_WhenAllDataRowsShareAPrefix_ShouldReturnPrefixWithTrailingUnderscore() { List rows = @@ -143,7 +143,7 @@ public async Task FindCommonRowPrefix_WhenAllDataRowsShareAPrefix_ShouldReturnPr await That(prefix).IsEqualTo("PropRead_"); } - [Fact] + [Test] public async Task FindCommonRowPrefix_WhenDataRowsDisagree_ShouldReturnNull() { List rows = @@ -157,7 +157,7 @@ public async Task FindCommonRowPrefix_WhenDataRowsDisagree_ShouldReturnNull() await That(prefix).IsNull(); } - [Fact] + [Test] public async Task RecomputeBaselineRatio_ShouldOverwriteRatioWithBaselineDividedByMockolate() { string[] baseline = ["Foo_Mockolate", "206.44 ns", "1.00", "1048 B", "1.00",]; @@ -168,7 +168,7 @@ public async Task RecomputeBaselineRatio_ShouldOverwriteRatioWithBaselineDivided await That(baseline[2]).IsEqualTo("0.95"); } - [Fact] + [Test] public async Task RecomputeBaselineRatio_WhenRatioIndexIsMissing_ShouldNotMutate() { string[] baseline = ["Foo_Mockolate", "206.44 ns",]; @@ -179,7 +179,7 @@ public async Task RecomputeBaselineRatio_WhenRatioIndexIsMissing_ShouldNotMutate await That(baseline).IsEqualTo(["Foo_Mockolate", "206.44 ns",]); } - [Fact] + [Test] public async Task RecomputeBaselineRatio_WhenValueCannotBeParsed_ShouldNotMutate() { string[] baseline = ["Foo_Mockolate", "junk", "1.00",]; @@ -190,7 +190,7 @@ public async Task RecomputeBaselineRatio_WhenValueCannotBeParsed_ShouldNotMutate await That(baseline[2]).IsEqualTo("1.00"); } - [Fact] + [Test] public async Task RemoveColumns_ShouldDropTheGivenIndicesAndPreserveTheRest() { string result = BenchmarkReport.RemoveColumns( @@ -200,7 +200,7 @@ public async Task RemoveColumns_ShouldDropTheGivenIndicesAndPreserveTheRest() await That(result).IsEqualTo("| Method | Mean | Allocated |"); } - [Fact] + [Test] public async Task RemoveColumns_WhenIndicesAreEmpty_ShouldReturnLineUnchanged() { string original = "| Method | Mean |"; @@ -210,7 +210,7 @@ public async Task RemoveColumns_WhenIndicesAreEmpty_ShouldReturnLineUnchanged() await That(result).IsEqualTo(original); } - [Fact] + [Test] public async Task SplitTableRow_ShouldReturnTrimmedInteriorCells() { string[] tokens = BenchmarkReport.SplitTableRow("| Foo | bar baz | 42 |"); @@ -218,7 +218,7 @@ public async Task SplitTableRow_ShouldReturnTrimmedInteriorCells() await That(tokens).IsEqualTo(["Foo", "bar baz", "42",]); } - [Fact] + [Test] public async Task SplitTableRow_WhenLineHasNoPipe_ShouldReturnEmptyArray() { string[] tokens = BenchmarkReport.SplitTableRow("hello world"); @@ -226,11 +226,11 @@ public async Task SplitTableRow_WhenLineHasNoPipe_ShouldReturnEmptyArray() await That(tokens).IsEqualTo(Array.Empty()); } - [Theory] - [InlineData("1048 B", 1048.0)] - [InlineData("1 KB", 1024.0)] - [InlineData("2 MB", 2.0 * 1024 * 1024)] - [InlineData("3 GB", 3.0 * 1024 * 1024 * 1024)] + [Test] + [Arguments("1048 B", 1048.0)] + [Arguments("1 KB", 1024.0)] + [Arguments("2 MB", 2.0 * 1024 * 1024)] + [Arguments("3 GB", 3.0 * 1024 * 1024 * 1024)] public async Task TryParseQuantity_ShouldNormalizeMemoryUnitsToBytes(string value, double expected) { bool ok = BenchmarkReport.TryParseQuantity(value, out double actual); @@ -239,14 +239,14 @@ public async Task TryParseQuantity_ShouldNormalizeMemoryUnitsToBytes(string valu await That(actual).IsEqualTo(expected).Within(0.0001); } - [Theory] - [InlineData("206.44 ns", 206.44)] - [InlineData("1,377.70 ns", 1377.70)] - [InlineData("1.00 μs", 1000.0)] - [InlineData("1.00 us", 1000.0)] - [InlineData("2 ms", 2_000_000.0)] - [InlineData("3 s", 3_000_000_000.0)] - [InlineData("500 ps", 0.5)] + [Test] + [Arguments("206.44 ns", 206.44)] + [Arguments("1,377.70 ns", 1377.70)] + [Arguments("1.00 μs", 1000.0)] + [Arguments("1.00 us", 1000.0)] + [Arguments("2 ms", 2_000_000.0)] + [Arguments("3 s", 3_000_000_000.0)] + [Arguments("500 ps", 0.5)] public async Task TryParseQuantity_ShouldNormalizeTimeUnitsToNanoseconds(string value, double expected) { bool ok = BenchmarkReport.TryParseQuantity(value, out double actual); @@ -255,10 +255,10 @@ public async Task TryParseQuantity_ShouldNormalizeTimeUnitsToNanoseconds(string await That(actual).IsEqualTo(expected).Within(0.0001); } - [Theory] - [InlineData("")] - [InlineData("not a number")] - [InlineData("100 weird")] + [Test] + [Arguments("")] + [Arguments("not a number")] + [Arguments("100 weird")] public async Task TryParseQuantity_WhenInputIsInvalid_ShouldReturnFalse(string value) { bool ok = BenchmarkReport.TryParseQuantity(value, out _); diff --git a/Tests/Build.Tests/BenchmarkTableParserTests.cs b/Tests/Build.Tests/BenchmarkTableParserTests.cs index 509049206..9381ea6bf 100644 --- a/Tests/Build.Tests/BenchmarkTableParserTests.cs +++ b/Tests/Build.Tests/BenchmarkTableParserTests.cs @@ -2,7 +2,7 @@ namespace Build.Tests; public sealed class BenchmarkTableParserTests { - [Fact] + [Test] public async Task Reset_ShouldClearMeanIndexAndAllowFreshTable() { BenchmarkTableParser parser = new([]); @@ -16,7 +16,7 @@ public async Task Reset_ShouldClearMeanIndexAndAllowFreshTable() await That(parser.MeanIndex).IsEqualTo(-1); } - [Fact] + [Test] public async Task TryConsume_ShouldAssignSequentialRowIndicesStartingAtZero() { BenchmarkTableParser parser = new([]); @@ -32,7 +32,7 @@ public async Task TryConsume_ShouldAssignSequentialRowIndicesStartingAtZero() await That(secondData).IsEqualTo(3); } - [Fact] + [Test] public async Task TryConsume_ShouldComputeDroppedIndicesOnceAndReuseThemForLaterRows() { BenchmarkTableParser parser = new(["Gen0",]); @@ -43,7 +43,7 @@ public async Task TryConsume_ShouldComputeDroppedIndicesOnceAndReuseThemForLater await That(filtered).IsEqualTo("| Foo | 1 ns | 100 B |"); } - [Fact] + [Test] public async Task TryConsume_ShouldDetectMeanColumnFromHeader() { BenchmarkTableParser parser = new([]); @@ -53,7 +53,7 @@ public async Task TryConsume_ShouldDetectMeanColumnFromHeader() await That(parser.MeanIndex).IsEqualTo(2); } - [Fact] + [Test] public async Task TryConsume_ShouldDropConfiguredColumnsCaseInsensitively() { BenchmarkTableParser parser = new(["Gen0", "GEN1",]); @@ -68,7 +68,7 @@ public async Task TryConsume_ShouldDropConfiguredColumnsCaseInsensitively() await That(dataTokens).IsEqualTo(["Foo", "1 ns", "100 B",]); } - [Fact] + [Test] public async Task TryConsume_ShouldStripBdnBoldMarkdownFromTokens() { BenchmarkTableParser parser = new([]); @@ -80,7 +80,7 @@ public async Task TryConsume_ShouldStripBdnBoldMarkdownFromTokens() await That(tokens).IsEqualTo(["Indexer_Mockolate", "1", "923 ns",]); } - [Fact] + [Test] public async Task TryConsume_WhenHeaderHasNoMeanColumn_ShouldReportNegativeMeanIndex() { BenchmarkTableParser parser = new([]); @@ -90,7 +90,7 @@ public async Task TryConsume_WhenHeaderHasNoMeanColumn_ShouldReportNegativeMeanI await That(parser.MeanIndex).IsEqualTo(-1); } - [Fact] + [Test] public async Task TryConsume_WhenLineIsNotTableShaped_ShouldReturnFalseAndKeepInitialState() { BenchmarkTableParser parser = new([]); @@ -104,7 +104,7 @@ public async Task TryConsume_WhenLineIsNotTableShaped_ShouldReturnFalseAndKeepIn await That(tokens).IsNull(); } - [Fact] + [Test] public async Task TryConsume_WhenNonTableLineFollowsTable_ShouldAutoResetSoNextTableStartsAtZero() { BenchmarkTableParser parser = new([]); diff --git a/Tests/Build.Tests/BuildBodyTests.cs b/Tests/Build.Tests/BuildBodyTests.cs index 183abfff2..e55e6b0e9 100644 --- a/Tests/Build.Tests/BuildBodyTests.cs +++ b/Tests/Build.Tests/BuildBodyTests.cs @@ -2,7 +2,7 @@ namespace Build.Tests; public sealed class BuildBodyTests { - [Fact] + [Test] public async Task BuildBody_BaselineKeyShouldUseTokensUpToTheMeanColumn() { string[] report = @@ -24,7 +24,7 @@ public async Task BuildBody_BaselineKeyShouldUseTokensUpToTheMeanColumn() await That(body).DoesNotContain("baseline*"); } - [Fact] + [Test] public async Task BuildBody_ShouldDropConfiguredColumnsFromHeaderAndDataRows() { string[] withGen2 = @@ -43,7 +43,7 @@ public async Task BuildBody_ShouldDropConfiguredColumnsFromHeaderAndDataRows() await That(body).DoesNotContain("0.2"); } - [Fact] + [Test] public async Task BuildBody_WhenBaselineHasNoMatchingKey_ShouldOmitInjectionAndOmitNote() { string[] baseline = @@ -59,7 +59,7 @@ public async Task BuildBody_WhenBaselineHasNoMatchingKey_ShouldOmitInjectionAndO await That(body).DoesNotContain("baseline*"); } - [Fact] + [Test] public async Task BuildBody_WhenBdnPreBoldsBaselineFile_ShouldEmitItalicBaselineWithoutEmbeddedBold() { string[] report = @@ -83,7 +83,7 @@ public async Task BuildBody_WhenBdnPreBoldsBaselineFile_ShouldEmitItalicBaseline await That(body).DoesNotContain("**_"); } - [Fact] + [Test] public async Task BuildBody_WhenBdnPreBoldsTheBaselineRow_ShouldNotEmitDoubleBoldOrBreakPrefix() { string[] report = @@ -105,7 +105,7 @@ public async Task BuildBody_WhenBdnPreBoldsTheBaselineRow_ShouldNotEmitDoubleBol await That(lines).Contains("| Moq | 1 | 212 ns | 20.37 KB |"); } - [Fact] + [Test] public async Task BuildBody_WhenInvocationCountAndMeanMatch_ShouldInjectBaseline() { string[] report = @@ -128,7 +128,7 @@ public async Task BuildBody_WhenInvocationCountAndMeanMatch_ShouldInjectBaseline await That(body).Contains("_95 ns_"); } - [Fact] + [Test] public async Task BuildBody_WhenTableHasEmptyRowSeparatingParameterGroups_ShouldEmitEmptyRowMatchingHeaderColumnCount() { string[] report = @@ -153,7 +153,7 @@ public async Task BuildBody_WhenTableHasEmptyRowSeparatingParameterGroups_Should await That(lines[firstGroupLast + 1]).IsEqualTo("| | | | |"); } - [Fact] + [Test] public async Task BuildBody_WhenTableHasEmptyRowSeparatingParameterGroups_ShouldNotEmitBareSeparator() { string[] report = @@ -173,7 +173,7 @@ public async Task BuildBody_WhenTableHasEmptyRowSeparatingParameterGroups_Should await That(body).DoesNotContain($"{Environment.NewLine}|{Environment.NewLine}"); } - [Fact] + [Test] public async Task BuildBody_WhenTableHasEmptyRowSeparatingParameterGroups_ShouldStillStripCommonPrefix() { string[] report = @@ -198,7 +198,7 @@ public async Task BuildBody_WhenTableHasEmptyRowSeparatingParameterGroups_Should await That(lines).Contains("| Moq | 10 | 2000 ns | 20 KB |"); } - [Fact] + [Test] public async Task BuildBody_WithBaseline_ShouldInjectItalicBaselineRowBeforeMockolateRow() { string[] baseline = @@ -220,7 +220,7 @@ await That(body).Contains( "`baseline*` rows show the corresponding Mockolate benchmark"); } - [Fact] + [Test] public async Task BuildBody_WithBaseline_ShouldNormalizeUnitDifferencesWhenComputingRatio() { string[] report = @@ -242,7 +242,7 @@ public async Task BuildBody_WithBaseline_ShouldNormalizeUnitDifferencesWhenCompu await That(body).Contains("| _baseline*_ | _1.00 μs_ | _2.00_ | _2048 B_ | _2.00_ |"); } - [Fact] + [Test] public async Task BuildBody_WithBaseline_ShouldRecomputeAllocRatioRelativeToCurrentMockolate() { string[] report = @@ -264,7 +264,7 @@ public async Task BuildBody_WithBaseline_ShouldRecomputeAllocRatioRelativeToCurr await That(body).Contains("| _baseline*_ | _100 ns_ | _1.00_ | _1024 B_ | _0.50_ |"); } - [Fact] + [Test] public async Task BuildBody_WithBaseline_ShouldRecomputeRatioRelativeToCurrentMockolate() { string[] report = @@ -287,7 +287,7 @@ public async Task BuildBody_WithBaseline_ShouldRecomputeRatioRelativeToCurrentMo await That(body).Contains("| _baseline*_ | _206.44 ns_ | _0.95_ | _1048 B_ | _1.00_ |"); } - [Fact] + [Test] public async Task BuildBody_WithoutBaseline_ShouldNotEmitBaselineNote() { BenchmarkReportFile file = new(_reportLines, null); @@ -297,7 +297,7 @@ public async Task BuildBody_WithoutBaseline_ShouldNotEmitBaselineNote() await That(body).DoesNotContain("baseline*"); } - [Fact] + [Test] public async Task BuildBody_WithoutBaseline_ShouldRenderHeaderAndStripCommonPrefix() { BenchmarkReportFile file = new(_reportLines, null); diff --git a/Tests/Build.Tests/Usings.cs b/Tests/Build.Tests/Usings.cs index 52cb76276..e340341f7 100644 --- a/Tests/Build.Tests/Usings.cs +++ b/Tests/Build.Tests/Usings.cs @@ -2,6 +2,5 @@ global using System.Collections.Generic; global using System.Threading.Tasks; global using Build; -global using Xunit; global using aweXpect; global using static aweXpect.Expect; diff --git a/Tests/Directory.Build.props b/Tests/Directory.Build.props index 9867a05b3..1c3c25905 100644 --- a/Tests/Directory.Build.props +++ b/Tests/Directory.Build.props @@ -16,30 +16,33 @@ 701;1702;CA1845 - - exe + + + Exe + false + false + + false - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + + + + + + + + + + diff --git a/Tests/Mockolate.Analyzers.Tests/AnalyzerHelpersTests.cs b/Tests/Mockolate.Analyzers.Tests/AnalyzerHelpersTests.cs index a0215a91d..c925303c6 100644 --- a/Tests/Mockolate.Analyzers.Tests/AnalyzerHelpersTests.cs +++ b/Tests/Mockolate.Analyzers.Tests/AnalyzerHelpersTests.cs @@ -4,14 +4,13 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Xunit; using static aweXpect.Expect; namespace Mockolate.Analyzers.Tests; public class AnalyzerHelpersTests { - [Fact] + [Test] public async Task WhenInvocationHasGenericNameSyntax_ShouldReturnTypeArgumentLocation() { const string source = """ @@ -39,7 +38,7 @@ public class C await That(result).IsNotNull(); } - [Fact] + [Test] public async Task WhenInvokedMethodIsGeneric_ShouldReturnFirstTypeArgument() { const string source = """ @@ -57,7 +56,7 @@ public class C await That(result!.SpecialType).IsEqualTo(SpecialType.System_Int32); } - [Fact] + [Test] public async Task WhenInvokedMethodIsNotGeneric_ShouldNotReturnAnyTypeArgument() { const string source = """ @@ -74,7 +73,7 @@ public void Foo() { } await That(result).IsNull(); } - [Fact] + [Test] public async Task WhenSyntaxIsNotInvocationExpression_ShouldNotReturnAnyLocation() { const string source = """ diff --git a/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerAccessibilityTests.cs b/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerAccessibilityTests.cs index cd7c08a95..edecaa905 100644 --- a/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerAccessibilityTests.cs +++ b/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerAccessibilityTests.cs @@ -1,16 +1,15 @@ using System.Threading.Tasks; -using Xunit; using Verifier = Mockolate.Analyzers.Tests.Verifiers.CSharpAnalyzerVerifier; namespace Mockolate.Analyzers.Tests; public class MockabilityAnalyzerAccessibilityTests { - [Theory] - [InlineData("internal abstract void MyMember();", "Ext.MyExternalType.MyMember()")] - [InlineData("internal abstract int MyMember { get; set; }", "Ext.MyExternalType.MyMember.get")] - [InlineData("internal abstract event System.EventHandler MyMember;", "Ext.MyExternalType.MyMember")] - [InlineData("public abstract string MyMember { get; internal set; }", "Ext.MyExternalType.MyMember.set")] + [Test] + [Arguments("internal abstract void MyMember();", "Ext.MyExternalType.MyMember()")] + [Arguments("internal abstract int MyMember { get; set; }", "Ext.MyExternalType.MyMember.get")] + [Arguments("internal abstract event System.EventHandler MyMember;", "Ext.MyExternalType.MyMember")] + [Arguments("public abstract string MyMember { get; internal set; }", "Ext.MyExternalType.MyMember.set")] public async Task WhenAbstractMemberOfReferencedAssemblyIsNotAccessible_ShouldBeFlagged( string member, string reportedMember) => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( @@ -22,7 +21,7 @@ public async Task WhenAbstractMemberOfReferencedAssemblyIsNotAccessible_ShouldBe $"the member '{reportedMember}' must be implemented, but it is not accessible from this assembly") ); - [Fact] + [Test] public async Task WhenInterfaceAccessorOfReferencedAssemblyIsNotAccessible_ShouldBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, @@ -33,7 +32,7 @@ public async Task WhenInterfaceAccessorOfReferencedAssemblyIsNotAccessible_Shoul "the member 'Ext.MyExternalType.MyMember.set' must be implemented, but it is not accessible from this assembly") ); - [Fact] + [Test] public async Task WhenInaccessibleAbstractMemberIsInheritedFromABaseType_ShouldBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, @@ -56,16 +55,16 @@ public abstract class MyExternalType : MyBaseType "the member 'Ext.MyBaseType.MyMember()' must be implemented, but it is not accessible from this assembly") ); - [Theory] - [InlineData("internal abstract void MyMember();", "internal override void MyMember() { }")] - [InlineData("internal abstract int MyMember { get; set; }", "internal override int MyMember { get; set; }")] - [InlineData("internal abstract event System.EventHandler MyMember;", + [Test] + [Arguments("internal abstract void MyMember();", "internal override void MyMember() { }")] + [Arguments("internal abstract int MyMember { get; set; }", "internal override int MyMember { get; set; }")] + [Arguments("internal abstract event System.EventHandler MyMember;", "internal override event System.EventHandler MyMember;")] - [InlineData("public abstract string MyMember { get; internal set; }", + [Arguments("public abstract string MyMember { get; internal set; }", "public override string MyMember { get => null!; internal set { } }")] - [InlineData("public abstract string MyMember { internal get; set; }", + [Arguments("public abstract string MyMember { internal get; set; }", "public override string MyMember { internal get => null!; set { } }")] - [InlineData("private protected abstract int MyMember { get; set; }", + [Arguments("private protected abstract int MyMember { get; set; }", "private protected override int MyMember { get; set; }")] public async Task WhenInaccessibleAbstractMemberIsAlreadyOverridden_ShouldNotBeFlagged( string baseMember, string derivedOverride) => await Verifier @@ -86,7 +85,7 @@ public abstract class MyExternalType : MyBaseType } """); - [Fact] + [Test] public async Task WhenInaccessibleInterfaceMemberHasADefaultImplementation_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, @@ -105,7 +104,7 @@ void IMyBaseType.MyMember() { } } """); - [Fact] + [Test] public async Task WhenInaccessibleAbstractMemberIsReDeclaredAsAbstract_ShouldBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, @@ -129,38 +128,38 @@ public abstract class MyExternalType : MyBaseType "the member 'Ext.MyExternalType.MyMember()' must be implemented, but it is not accessible from this assembly") ); - [Theory] - [InlineData("internal abstract void MyMember();")] - [InlineData("public abstract string MyMember { get; internal set; }")] + [Test] + [Arguments("internal abstract void MyMember();")] + [Arguments("public abstract string MyMember { get; internal set; }")] public async Task WhenInternalsAreVisibleToTheMockAssembly_ShouldNotBeFlagged(string member) => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, ExternalType("abstract class", member, internalsVisibleToTestProject: true)); - [Theory] - [InlineData("internal virtual void MyMember() { }")] - [InlineData("internal virtual int MyMember { get; set; }")] + [Test] + [Arguments("internal virtual void MyMember() { }")] + [Arguments("internal virtual int MyMember { get; set; }")] public async Task WhenInaccessibleMemberIsOnlyVirtual_ShouldNotBeFlagged(string member) => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, ExternalType("class", member)); - [Fact] + [Test] public async Task WhenProtectedInternalAbstractMember_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, ExternalType("abstract class", "protected internal abstract void MyMember();")); - [Theory] - [InlineData("protected abstract void MyMember(MyConfiguration configuration);", + [Test] + [Arguments("protected abstract void MyMember(MyConfiguration configuration);", "Ext.MyExternalType.MyMember(Ext.MyExternalType.MyConfiguration)", "Ext.MyExternalType.MyConfiguration")] - [InlineData("protected abstract MyConfiguration MyMember();", "Ext.MyExternalType.MyMember()", + [Arguments("protected abstract MyConfiguration MyMember();", "Ext.MyExternalType.MyMember()", "Ext.MyExternalType.MyConfiguration")] - [InlineData("protected abstract MyConfiguration MyMember { get; set; }", "Ext.MyExternalType.MyMember", + [Arguments("protected abstract MyConfiguration MyMember { get; set; }", "Ext.MyExternalType.MyMember", "Ext.MyExternalType.MyConfiguration")] - [InlineData("protected abstract void MyMember() where T : MyConfiguration;", + [Arguments("protected abstract void MyMember() where T : MyConfiguration;", "Ext.MyExternalType.MyMember()", "Ext.MyExternalType.MyConfiguration")] - [InlineData("protected abstract System.Collections.Generic.List MyMember();", + [Arguments("protected abstract System.Collections.Generic.List MyMember();", "Ext.MyExternalType.MyMember()", "System.Collections.Generic.List")] public async Task WhenAbstractMemberSignatureUsesAnInaccessibleType_ShouldBeFlagged( string member, string reportedMember, string reportedType) => await Verifier @@ -176,7 +175,7 @@ protected internal class MyConfiguration { } $"the member '{reportedMember}' must be implemented, but its signature uses the type '{reportedType}', which is not accessible from this assembly") ); - [Fact] + [Test] public async Task WhenAbstractMemberSignatureUsesATypeVisibleToTheMockAssembly_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, @@ -185,10 +184,10 @@ public async Task WhenAbstractMemberSignatureUsesATypeVisibleToTheMockAssembly_S protected internal class MyConfiguration { } """, internalsVisibleToTestProject: true)); - [Theory] - [InlineData("protected abstract void MyMember(MyConfiguration configuration);", + [Test] + [Arguments("protected abstract void MyMember(MyConfiguration configuration);", "protected override void MyMember(MyConfiguration configuration) { }")] - [InlineData("protected abstract MyConfiguration MyMember { get; set; }", + [Arguments("protected abstract MyConfiguration MyMember { get; set; }", "protected override MyConfiguration MyMember { get; set; }")] public async Task WhenAbstractMemberWithInaccessibleSignatureIsAlreadyOverridden_ShouldNotBeFlagged( string baseMember, string derivedOverride) => await Verifier @@ -210,11 +209,11 @@ public class MyExternalType : MyBaseType } """); - [Theory] - [InlineData("private protected abstract void MyMember();", "Ext.MyExternalType.MyMember()")] - [InlineData("private protected abstract int MyMember { get; set; }", "Ext.MyExternalType.MyMember.get")] - [InlineData("private protected abstract event System.EventHandler MyMember;", "Ext.MyExternalType.MyMember")] - [InlineData("public abstract string MyMember { get; private protected set; }", "Ext.MyExternalType.MyMember.set")] + [Test] + [Arguments("private protected abstract void MyMember();", "Ext.MyExternalType.MyMember()")] + [Arguments("private protected abstract int MyMember { get; set; }", "Ext.MyExternalType.MyMember.get")] + [Arguments("private protected abstract event System.EventHandler MyMember;", "Ext.MyExternalType.MyMember")] + [Arguments("public abstract string MyMember { get; private protected set; }", "Ext.MyExternalType.MyMember.set")] public async Task WhenPrivateProtectedAbstractMemberIsNotAccessible_ShouldBeFlagged( string member, string reportedMember) => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( @@ -226,17 +225,17 @@ public async Task WhenPrivateProtectedAbstractMemberIsNotAccessible_ShouldBeFlag $"the member '{reportedMember}' must be implemented, but it is not accessible from this assembly") ); - [Theory] - [InlineData("private protected abstract void MyMember();")] - [InlineData("private protected abstract event System.EventHandler MyMember;")] - [InlineData("public abstract string MyMember { get; private protected set; }")] + [Test] + [Arguments("private protected abstract void MyMember();")] + [Arguments("private protected abstract event System.EventHandler MyMember;")] + [Arguments("public abstract string MyMember { get; private protected set; }")] public async Task WhenPrivateProtectedAbstractMemberIsVisibleToTheMockAssembly_ShouldNotBeFlagged(string member) => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( MockCreation, ExternalType("abstract class", member, internalsVisibleToTestProject: true)); - [Fact] + [Test] public async Task WhenAdditionalInterfaceHasAnInaccessibleMember_ShouldBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( ImplementingMockCreation, @@ -247,7 +246,7 @@ public async Task WhenAdditionalInterfaceHasAnInaccessibleMember_ShouldBeFlagged "the member 'Ext.MyExternalType.MyMember()' must be implemented, but it is not accessible from this assembly") ); - [Fact] + [Test] public async Task WhenAdditionalInterfaceMemberIsVisibleToTheMockAssembly_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerWithReferencedProjectAsync( ImplementingMockCreation, diff --git a/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerRefStructTests.cs b/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerRefStructTests.cs index b319b66fe..16a930fc4 100644 --- a/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerRefStructTests.cs +++ b/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerRefStructTests.cs @@ -2,7 +2,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Testing; -using Xunit; using Verifier = Mockolate.Analyzers.Tests.Verifiers.CSharpAnalyzerVerifier; namespace Mockolate.Analyzers.Tests; @@ -21,7 +20,7 @@ namespace Mockolate.Analyzers.Tests; /// public class MockabilityAnalyzerRefStructTests { - [Fact] + [Test] public async Task WhenLanguageVersionBelowCSharp13_RefReadonlySpanParameterMethod_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -53,7 +52,7 @@ public void MyTest() "ref-struct parameter mocking requires C# 13 or later (uses the 'allows ref struct' anti-constraint; current LangVersion is 12.0)") ); - [Fact] + [Test] public async Task WhenLanguageVersionBelowCSharp13_RefStructKeyedIndexer_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -84,7 +83,7 @@ public void MyTest() "ref-struct-keyed indexers require C# 13 or later (uses the 'allows ref struct' anti-constraint; current LangVersion is 12.0)") ); - [Fact] + [Test] public async Task WhenLanguageVersionBelowCSharp13_RefStructParameterMethod_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -115,7 +114,7 @@ public void MyTest() "ref-struct parameter mocking requires C# 13 or later (uses the 'allows ref struct' anti-constraint; current LangVersion is 12.0)") ); - [Fact] + [Test] public async Task WhenMockingAbstractClassWithInheritedRefStructOutParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -147,7 +146,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingAbstractClassWithRefStructProperty_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -177,7 +176,7 @@ public void MyTest() "properties of a non-span ref struct type are not supported") ); - [Fact] + [Test] public async Task WhenMockingClassWithVirtualInitOnlyRefStructProperty_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -215,7 +214,7 @@ public void MyTest() "properties of a non-span ref struct type are not supported") ); - [Fact] + [Test] public async Task WhenMockingClassWithVirtualRefReturningRefStructMethod_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -247,7 +246,7 @@ public void MyTest() "methods returning a non-span ref struct are not supported") ); - [Fact] + [Test] public async Task WhenMockingClassWithVirtualRefStructIndexer_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -273,7 +272,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingClassWithVirtualRefStructProperty_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -301,7 +300,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingClassWithVirtualRefStructReturnAndParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -329,7 +328,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingClassWithVirtualRefStructReturningMethod_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -355,7 +354,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingDelegateReturningNonSpanRefStruct_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -384,7 +383,7 @@ public void MyTest() "methods returning a non-span ref struct are not supported") ); - [Fact] + [Test] public async Task WhenMockingDelegateWithOutRefStructParameter_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -414,7 +413,7 @@ public void MyTest() "ref-struct parameters are not supported on delegate types") ); - [Fact] + [Test] public async Task WhenMockingDelegateWithPlainRefStructParameter_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -444,7 +443,7 @@ public void MyTest() "ref-struct parameters are not supported on delegate types") ); - [Fact] + [Test] public async Task WhenMockingDelegateWithRefReadonlySpanParameter_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -471,7 +470,7 @@ public void MyTest() "ref-struct parameters are not supported on delegate types") ); - [Fact] + [Test] public async Task WhenMockingDelegateWithSpanParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -494,7 +493,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceInheritingRefStructOutMethod_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -525,7 +524,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceReturningNonSpanRefStruct_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -555,7 +554,7 @@ public void MyTest() "methods returning a non-span ref struct are not supported") ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithOutRefStructParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -581,7 +580,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefStructOutAndPlainOverloads_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -610,7 +609,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithPlainRefStructParameter_ShouldNotFlag() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -636,7 +635,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefReadonlyRefStructParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -662,7 +661,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefReadonlySpanParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -688,7 +687,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefRefStructParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -714,7 +713,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefStructIndexerKey_GetterOnly_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -741,7 +740,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefStructIndexerKeyAndSetter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -769,7 +768,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithSpanParameter_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -795,7 +794,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithSpanReturn_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -821,7 +820,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefStructProperty_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -851,7 +850,7 @@ public void MyTest() "properties of a non-span ref struct type are not supported") ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithSpanProperty_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -875,7 +874,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithSpanValuedIndexer_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -900,7 +899,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefStructValuedIndexer_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -930,7 +929,7 @@ public void MyTest() "indexers returning a non-span ref struct are not supported") ); - [Fact] + [Test] public async Task WhenMockingInterfaceWithRefStructEventArgument_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" diff --git a/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs b/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs index 7cfca2b6a..e3fa5ebea 100644 --- a/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs +++ b/Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs @@ -1,12 +1,11 @@ using System.Threading.Tasks; -using Xunit; using Verifier = Mockolate.Analyzers.Tests.Verifiers.CSharpAnalyzerVerifier; namespace Mockolate.Analyzers.Tests; public class MockabilityAnalyzerTests { - [Fact] + [Test] public async Task WhenCreateMockIsNotInMockolateNamespace_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -37,7 +36,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenImplementingAClass_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -66,7 +65,7 @@ public void MyTest() .WithArguments("MyNamespace.MyImplementingClass", "You can only implement additional interfaces") ); - [Fact] + [Test] public async Task WhenInvocationIsNotMemberAccess_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -84,7 +83,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMethodNameIsUnrelated_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -103,7 +102,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingADelegate_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -122,7 +121,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingArray_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -148,7 +147,7 @@ public void MyTest() .WithArguments("MyNamespace.IMyInterface[]", "type kind 'Array' is not supported") ); - [Fact] + [Test] public async Task WhenMockingClass_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -172,7 +171,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingDelegate_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -193,7 +192,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingEnum_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -221,7 +220,7 @@ public void MyTest() .WithArguments("MyNamespace.MyEnum", "type is an enum") ); - [Fact] + [Test] public async Task WhenMockingGlobalNamespaceType_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -248,7 +247,7 @@ public void MyTest() .WithArguments("IGlobalInterface", "type is declared in the global namespace") ); - [Fact] + [Test] public async Task WhenMockingInterface_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -272,7 +271,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingOpenGenericClass_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -304,7 +303,7 @@ public void MyTest() """ ); - [Fact] + [Test] public async Task WhenMockingRecord_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -328,7 +327,7 @@ public void MyTest() .WithArguments("MyNamespace.MyRecord", "type is a record") ); - [Fact] + [Test] public async Task WhenMockingSealedClass_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" @@ -355,7 +354,7 @@ public void MyTest() .WithArguments("MyNamespace.MySealedClass", "type is sealed") ); - [Fact] + [Test] public async Task WhenMockingStruct_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( $$""" diff --git a/Tests/Mockolate.Analyzers.Tests/UseVerificationAnalyzerTests.cs b/Tests/Mockolate.Analyzers.Tests/UseVerificationAnalyzerTests.cs index de634c27f..d17f448ae 100644 --- a/Tests/Mockolate.Analyzers.Tests/UseVerificationAnalyzerTests.cs +++ b/Tests/Mockolate.Analyzers.Tests/UseVerificationAnalyzerTests.cs @@ -1,12 +1,11 @@ using System.Threading.Tasks; -using Xunit; using Verifier = Mockolate.Analyzers.Tests.Verifiers.CSharpAnalyzerVerifier; namespace Mockolate.Analyzers.Tests; public class UseVerificationAnalyzerTests { - [Fact] + [Test] public async Task WhenAssigned_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -26,7 +25,7 @@ public static VerificationResult>> VerifySomething() """ ); - [Fact] + [Test] public async Task WhenNotUsed_ShouldBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -48,7 +47,7 @@ public static VerificationResult>> VerifySomething() .WithLocation(0) ); - [Fact] + [Test] public async Task WhenPassedAsArgument_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -71,7 +70,7 @@ public static VerificationResult>> VerifySomething() """ ); - [Fact] + [Test] public async Task WhenReturnedFromMethod_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -91,7 +90,7 @@ public static VerificationResult>> VerifySomething() """ ); - [Fact] + [Test] public async Task WhenUsedAsVariableInitializer_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -112,7 +111,7 @@ public static VerificationResult>> VerifySomething() """ ); - [Fact] + [Test] public async Task WhenUsedInConditional_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ @@ -132,7 +131,7 @@ public static VerificationResult>> VerifySomething() """ ); - [Fact] + [Test] public async Task WhenUsedInMethod_ShouldNotBeFlagged() => await Verifier .VerifyAnalyzerAsync( """ diff --git a/Tests/Mockolate.Analyzers.Tests/UseVerificationCodeFixProviderTests.cs b/Tests/Mockolate.Analyzers.Tests/UseVerificationCodeFixProviderTests.cs index a5edd34cf..97e4366fa 100644 --- a/Tests/Mockolate.Analyzers.Tests/UseVerificationCodeFixProviderTests.cs +++ b/Tests/Mockolate.Analyzers.Tests/UseVerificationCodeFixProviderTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Xunit; using Verifier = Mockolate.Analyzers.Tests.Verifiers.CSharpCodeFixVerifier; @@ -7,7 +6,7 @@ namespace Mockolate.Analyzers.Tests; public class UseVerificationCodeFixProviderTests { - [Fact] + [Test] public async Task ShouldApplyCodeFix() => await Verifier.VerifyCodeFixAsync( """ using Mockolate; diff --git a/Tests/Mockolate.Api.Tests/ApiApprovalTests.cs b/Tests/Mockolate.Api.Tests/ApiApprovalTests.cs index 0094f6dec..7b67dfd26 100644 --- a/Tests/Mockolate.Api.Tests/ApiApprovalTests.cs +++ b/Tests/Mockolate.Api.Tests/ApiApprovalTests.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Linq; using aweXpect.Core; using aweXpect.Results; @@ -21,15 +22,16 @@ public sealed class ApiApprovalTests "Mockolate", ]; - [Theory] - [MemberData(nameof(Builds))] + [Test] + [MethodDataSource(nameof(Builds))] public async Task VerifyPublicApi(string assemblyName, string framework) => await MatchesPublicApiSnapshot(assemblyName, framework); /// /// Execute this test to update the expected public API to the current API surface. /// - [Fact(Explicit = true)] + [Test] + [Explicit] public async Task AcceptApiChanges() { foreach ((string assemblyName, string framework) in AllBuilds()) @@ -45,8 +47,8 @@ public async Task AcceptApiChanges() } } - public static TheoryData Builds() - => new(AllBuilds()); + public static IEnumerable<(string, string)> Builds() + => AllBuilds(); /// /// The snapshot is named after the assembly and the target framework, so that both tests use the same one. diff --git a/Tests/Mockolate.Api.Tests/Mockolate.Api.Tests.csproj b/Tests/Mockolate.Api.Tests/Mockolate.Api.Tests.csproj index f011f51cd..f82bb7d7e 100644 --- a/Tests/Mockolate.Api.Tests/Mockolate.Api.Tests.csproj +++ b/Tests/Mockolate.Api.Tests/Mockolate.Api.Tests.csproj @@ -2,7 +2,6 @@ net8.0 - exe @@ -10,8 +9,6 @@ - - diff --git a/Tests/Mockolate.Api.Tests/Usings.cs b/Tests/Mockolate.Api.Tests/Usings.cs index 1990b88b3..3dfd9d39f 100644 --- a/Tests/Mockolate.Api.Tests/Usings.cs +++ b/Tests/Mockolate.Api.Tests/Usings.cs @@ -1,5 +1,4 @@ global using System; global using System.Threading.Tasks; -global using Xunit; global using aweXpect; global using static aweXpect.Expect; diff --git a/Tests/Mockolate.ExampleTests/ExampleTests.cs b/Tests/Mockolate.ExampleTests/ExampleTests.cs index 3b8ddb8c4..1ba985212 100644 --- a/Tests/Mockolate.ExampleTests/ExampleTests.cs +++ b/Tests/Mockolate.ExampleTests/ExampleTests.cs @@ -20,7 +20,7 @@ namespace Mockolate.ExampleTests; public class ExampleTests { - [Fact] + [Test] public async Task Any_ShouldAlwaysMatch() { Guid id = Guid.NewGuid(); @@ -42,7 +42,7 @@ public async Task Any_ShouldAlwaysMatch() } #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task Azure_ShouldBeMockable() { Response response = Response.CreateMock(); @@ -64,7 +64,7 @@ public async Task Azure_ShouldBeMockable() } #endif - [Fact] + [Test] public async Task BaseClassWithConstructorParameters() { MyClass sut = MyClass.CreateMock(3); @@ -79,10 +79,10 @@ public async Task BaseClassWithConstructorParameters() } #if NET8_0_OR_GREATER - [Theory] - [InlineData(HttpStatusCode.OK)] - [InlineData(HttpStatusCode.NotFound)] - [InlineData(HttpStatusCode.ServiceUnavailable)] + [Test] + [Arguments(HttpStatusCode.OK)] + [Arguments(HttpStatusCode.NotFound)] + [Arguments(HttpStatusCode.ServiceUnavailable)] public async Task HttpClientTest(HttpStatusCode statusCode) { HttpClient httpClient = HttpClient.CreateMock(); @@ -94,7 +94,7 @@ public async Task HttpClientTest(HttpStatusCode statusCode) await That(result.StatusCode).IsEqualTo(statusCode); } - [Fact] + [Test] public async Task IHttpClientFactory_SharedHandler_PreservesInvocationsAcrossDisposes() { HttpMessageHandler handler = HttpMessageHandler.CreateMock(); @@ -119,7 +119,7 @@ public async Task IHttpClientFactory_SharedHandler_PreservesInvocationsAcrossDis } #endif - [Fact] + [Test] public async Task MockIFileSystem_ShouldWork() { IFileSystem sut = IFileSystem.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -132,7 +132,7 @@ public async Task MockIFileSystem_ShouldWork() await That(result).IsEqualTo('a'); } - [Fact] + [Test] public async Task SimpleInterfaceMock() { Guid id = Guid.NewGuid(); @@ -144,7 +144,7 @@ public async Task SimpleInterfaceMock() sut.Mock.Verify.AddUser(It.IsAny()).Once(); } - [Fact] + [Test] public async Task WithAdditionalInterface_ShouldWork() { Guid id = Guid.NewGuid(); @@ -160,7 +160,7 @@ public async Task WithAdditionalInterface_ShouldWork() await That(sut).Is(); } - [Fact] + [Test] public async Task WithAdditionalInterfaceInOtherOrder_ShouldWork() { Guid id = Guid.NewGuid(); @@ -172,7 +172,7 @@ public async Task WithAdditionalInterfaceInOtherOrder_ShouldWork() sut.Mock.As().Verify.AddUser(It.IsAny()).Once(); } - [Fact] + [Test] public async Task WithEvent_ShouldSupportRaisingEvent() { EventArgs eventArgs = EventArgs.Empty; @@ -197,7 +197,7 @@ void Register(object? sender, EventArgs e) } } - [Fact] + [Test] public async Task WithExplicitCastToAdditionalInterfaceSetup_ShouldWork() { Guid id = Guid.NewGuid(); @@ -213,7 +213,7 @@ public async Task WithExplicitCastToAdditionalInterfaceSetup_ShouldWork() await That(sut).Is(); } - [Fact] + [Test] public async Task WithExplicitCastToAdditionalInterfaceVerify_ShouldWork() { Guid id = Guid.NewGuid(); @@ -230,9 +230,9 @@ public async Task WithExplicitCastToAdditionalInterfaceVerify_ShouldWork() await That(sut).Is(); } - [Theory] - [InlineData("Alice", true)] - [InlineData("Bob", false)] + [Test] + [Arguments("Alice", true)] + [Arguments("Bob", false)] public async Task WithMatching_ShouldAlwaysMatch(string name, bool expectResult) { Guid id = Guid.NewGuid(); @@ -248,9 +248,9 @@ public async Task WithMatching_ShouldAlwaysMatch(string name, bool expectResult) sut.Mock.Verify.AddUser(It.Is(name)).Once(); } - [Theory] - [InlineData(false)] - [InlineData(true)] + [Test] + [Arguments(false)] + [Arguments(true)] public async Task WithOut_ShouldSupportOutParameter(bool returnValue) { Guid id = Guid.NewGuid(); @@ -268,7 +268,7 @@ public async Task WithOut_ShouldSupportOutParameter(bool returnValue) sut.Mock.Verify.TryDelete(It.Is(id), It.IsOut()).Once(); } - [Fact] + [Test] public async Task Wrapping_HiddenMember_ShouldForwardToDeclaringInterface() { User alice = new(Guid.NewGuid(), "Alice"); diff --git a/Tests/Mockolate.ExampleTests/Usings.cs b/Tests/Mockolate.ExampleTests/Usings.cs index ac90007f3..b95ed5935 100644 --- a/Tests/Mockolate.ExampleTests/Usings.cs +++ b/Tests/Mockolate.ExampleTests/Usings.cs @@ -1,3 +1,2 @@ -global using Xunit; -global using aweXpect; +global using aweXpect; global using static aweXpect.Expect; diff --git a/Tests/Mockolate.Internal.Tests/Interactions/ChunkedSlotStorageTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/ChunkedSlotStorageTests.cs index c37e02dcf..a3a12e22d 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/ChunkedSlotStorageTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/ChunkedSlotStorageTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class ChunkedSlotStorageTests { - [Fact] + [Test] public async Task Clear_AfterMultipleChunks_ResetsCountAndAllowsRefill() { const int total = (ChunkedSlotStorage.ChunkSize * 2) + 5; @@ -28,7 +28,7 @@ public async Task Clear_AfterMultipleChunks_ResetsCountAndAllowsRefill() await That(((MethodInvocation)store.Single()).Parameter1).IsEqualTo(99); } - [Fact] + [Test] public async Task SlotForWrite_AcrossMultipleChunks_PreservesAllRecords() { const int total = ChunkedSlotStorage.ChunkSize * 3; @@ -50,7 +50,7 @@ public async Task SlotForWrite_AcrossMultipleChunks_PreservesAllRecords() } } - [Fact] + [Test] public async Task SlotForWrite_BeyondInitialChunksArrayLength_ExpandsArrayUnderLock() { const int total = (ChunkedSlotStorage.ChunkSize * 4) + 1; diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastBufferBoxingAndUnverifiedTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastBufferBoxingAndUnverifiedTests.cs index ca80889d6..9208cc33b 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastBufferBoxingAndUnverifiedTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastBufferBoxingAndUnverifiedTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastBufferBoxingAndUnverifiedTests { - [Fact] + [Test] public async Task FastEventBuffer_AppendBoxed_KindMatters() { FastMockInteractions subscribeStore = new(1); @@ -23,7 +23,7 @@ public async Task FastEventBuffer_AppendBoxed_KindMatters() await That(unsubscribeStore.Single()).IsExactly(); } - [Fact] + [Test] public async Task FastEventBuffer_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -47,7 +47,7 @@ public async Task FastEventBuffer_AppendBoxedUnverified_ShouldSkipMatchedSlots() await That(dest[0].Interaction).IsExactly(); } - [Fact] + [Test] public async Task FastEventBuffer_Subscribe_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new EventSubscription(...)` cache in AppendBoxed. With the @@ -66,7 +66,7 @@ public async Task FastEventBuffer_Subscribe_AppendBoxed_CachesAndReusesAlreadyBo await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastEventBuffer_Subscribe_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new EventSubscription(...)` cache in AppendBoxedUnverified. @@ -84,7 +84,7 @@ public async Task FastEventBuffer_Subscribe_AppendBoxedUnverified_CachesAndReuse await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastEventBuffer_SubscribeAppend_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -92,7 +92,7 @@ public async Task FastEventBuffer_SubscribeAppend_ShouldRaiseInteractionAdded() return () => buffer.Append("E", this, SampleMethod); }); - [Fact] + [Test] public async Task FastEventBuffer_Unsubscribe_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -109,7 +109,7 @@ public async Task FastEventBuffer_Unsubscribe_AppendBoxed_CachesAndReusesAlready await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastEventBuffer_Unsubscribe_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -126,7 +126,7 @@ public async Task FastEventBuffer_Unsubscribe_AppendBoxedUnverified_CachesAndReu await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastEventBuffer_Unsubscribe_AppendBoxedUnverified_ShouldBoxAsEventUnsubscription() { FastMockInteractions store = new(1); @@ -142,7 +142,7 @@ await That(dest[0].Interaction).IsExactly() "the `_kind == FastEventBufferKind.Subscribe` ternary in AppendBoxedUnverified must pick the record type from the buffer kind, so an unsubscribe buffer never surfaces EventSubscription"); } - [Fact] + [Test] public async Task FastEventBuffer_UnsubscribeAppend_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -150,7 +150,7 @@ public async Task FastEventBuffer_UnsubscribeAppend_ShouldRaiseInteractionAdded( return () => buffer.Append("E", this, SampleMethod); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer1_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -158,7 +158,7 @@ public async Task FastIndexerGetterBuffer1_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer1_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -176,7 +176,7 @@ public async Task FastIndexerGetterBuffer1_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer1_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -194,7 +194,7 @@ public async Task FastIndexerGetterBuffer1_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer1_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -203,7 +203,7 @@ public async Task FastIndexerGetterBuffer1_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer2_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -211,7 +211,7 @@ public async Task FastIndexerGetterBuffer2_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a"); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer2_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -229,7 +229,7 @@ public async Task FastIndexerGetterBuffer2_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer2_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -247,7 +247,7 @@ public async Task FastIndexerGetterBuffer2_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer2_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -256,7 +256,7 @@ public async Task FastIndexerGetterBuffer2_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer3_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -265,7 +265,7 @@ public async Task FastIndexerGetterBuffer3_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a", true); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer3_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -284,7 +284,7 @@ public async Task FastIndexerGetterBuffer3_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer3_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -303,7 +303,7 @@ public async Task FastIndexerGetterBuffer3_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer3_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -313,7 +313,7 @@ public async Task FastIndexerGetterBuffer3_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer4_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -322,7 +322,7 @@ public async Task FastIndexerGetterBuffer4_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a", true, 1.0); }); - [Fact] + [Test] public async Task FastIndexerGetterBuffer4_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -341,7 +341,7 @@ public async Task FastIndexerGetterBuffer4_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer4_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -360,7 +360,7 @@ public async Task FastIndexerGetterBuffer4_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer4_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -370,7 +370,7 @@ public async Task FastIndexerGetterBuffer4_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer1_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -378,7 +378,7 @@ public async Task FastIndexerSetterBuffer1_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a"); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer1_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -396,7 +396,7 @@ public async Task FastIndexerSetterBuffer1_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer1_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -414,7 +414,7 @@ public async Task FastIndexerSetterBuffer1_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer1_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -423,7 +423,7 @@ public async Task FastIndexerSetterBuffer1_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer2_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -432,7 +432,7 @@ public async Task FastIndexerSetterBuffer2_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a", true); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer2_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -451,7 +451,7 @@ public async Task FastIndexerSetterBuffer2_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer2_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -470,7 +470,7 @@ public async Task FastIndexerSetterBuffer2_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer2_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -480,7 +480,7 @@ public async Task FastIndexerSetterBuffer2_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer3_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -489,7 +489,7 @@ public async Task FastIndexerSetterBuffer3_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a", true, 1.0); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer3_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -508,7 +508,7 @@ public async Task FastIndexerSetterBuffer3_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer3_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -527,7 +527,7 @@ public async Task FastIndexerSetterBuffer3_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer3_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -537,7 +537,7 @@ public async Task FastIndexerSetterBuffer3_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer4_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -546,7 +546,7 @@ public async Task FastIndexerSetterBuffer4_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(1, "a", true, 1.0, 'x'); }); - [Fact] + [Test] public async Task FastIndexerSetterBuffer4_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -565,7 +565,7 @@ public async Task FastIndexerSetterBuffer4_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer4_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -584,7 +584,7 @@ public async Task FastIndexerSetterBuffer4_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer4_AppendWithAccess_ShouldPublishAndRaiseInteractionAdded() => await VerifyAppendWithAccessPublishesAndRaises(store => { @@ -594,7 +594,7 @@ public async Task FastIndexerSetterBuffer4_AppendWithAccess_ShouldPublishAndRais return (() => buffer.Append(access), () => buffer.Count); }); - [Fact] + [Test] public async Task FastMethod0Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new MethodInvocation(r.Name)` cache in Method0 AppendBoxed. @@ -614,7 +614,7 @@ public async Task FastMethod0Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecor await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastMethod1Buffer_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -623,7 +623,7 @@ public async Task FastMethod1Buffer_Append_ShouldRaiseInteractionAdded() return () => buffer.Append("M", 1); }); - [Fact] + [Test] public async Task FastMethod1Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -642,7 +642,7 @@ public async Task FastMethod1Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecor await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastMethod2Buffer_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -651,7 +651,7 @@ public async Task FastMethod2Buffer_Append_ShouldRaiseInteractionAdded() return () => buffer.Append("M", 1, "a"); }); - [Fact] + [Test] public async Task FastMethod3Buffer_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -659,7 +659,7 @@ public async Task FastMethod3Buffer_Append_ShouldRaiseInteractionAdded() return () => buffer.Append("M", 1, "a", true); }); - [Fact] + [Test] public async Task FastMethod3Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new MethodInvocation(...)` cache in Method3 AppendBoxed. @@ -678,7 +678,7 @@ public async Task FastMethod3Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecor await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastMethod3Buffer_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new MethodInvocation(...)` cache in Method3 AppendBoxedUnverified. @@ -697,7 +697,7 @@ public async Task FastMethod3Buffer_AppendBoxedUnverified_CachesAndReusesAlready await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastMethod3Buffer_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -719,7 +719,7 @@ public async Task FastMethod3Buffer_AppendBoxedUnverified_ShouldSkipMatchedSlots await That(((MethodInvocation)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task FastMethod4Buffer_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -728,7 +728,7 @@ public async Task FastMethod4Buffer_Append_ShouldRaiseInteractionAdded() return () => buffer.Append("M", 1, "a", true, 1.0); }); - [Fact] + [Test] public async Task FastMethod4Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new MethodInvocation(...)` cache in Method4 AppendBoxed. @@ -748,7 +748,7 @@ public async Task FastMethod4Buffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecor await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastMethod4Buffer_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { // Pins the `r.Boxed ??= new MethodInvocation(...)` cache in Method4 AppendBoxedUnverified. @@ -768,7 +768,7 @@ public async Task FastMethod4Buffer_AppendBoxedUnverified_CachesAndReusesAlready await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastMethod4Buffer_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -792,7 +792,7 @@ public async Task FastMethod4Buffer_AppendBoxedUnverified_ShouldSkipMatchedSlots await That(((MethodInvocation)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task FastPropertyGetterBuffer_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -800,7 +800,7 @@ public async Task FastPropertyGetterBuffer_Append_ShouldRaiseInteractionAdded() return () => buffer.Append(); }); - [Fact] + [Test] public async Task FastPropertyGetterBuffer_AppendBoxed_RepeatedCallsReturnSameSingleton() { FastMockInteractions store = new(1); @@ -818,7 +818,7 @@ public async Task FastPropertyGetterBuffer_AppendBoxed_RepeatedCallsReturnSameSi await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastPropertyGetterBuffer_AppendBoxed_SharesSingletonAcrossRecords() { // All recorded getter accesses for the same property surface as one PropertyGetterAccess @@ -840,7 +840,7 @@ public async Task FastPropertyGetterBuffer_AppendBoxed_SharesSingletonAcrossReco await That(dest[0].Interaction).IsSameAs(dest[1].Interaction); } - [Fact] + [Test] public async Task FastPropertyGetterBuffer_AppendString_LazyInitsAccessOnce() { FastMockInteractions store = new(1); @@ -860,7 +860,7 @@ public async Task FastPropertyGetterBuffer_AppendString_LazyInitsAccessOnce() await That(secondSnapshot[1].Interaction).IsSameAs(firstSnapshot[0].Interaction); } - [Fact] + [Test] public async Task FastPropertySetterBuffer_Append_ShouldRaiseInteractionAdded() => await VerifyRaisesInteractionAdded(store => { @@ -868,7 +868,7 @@ public async Task FastPropertySetterBuffer_Append_ShouldRaiseInteractionAdded() return () => buffer.Append("P", 1); }); - [Fact] + [Test] public async Task FastPropertySetterBuffer_AppendBoxed_CachesAndReusesAlreadyBoxedRecord() { FastMockInteractions store = new(1); @@ -886,7 +886,7 @@ public async Task FastPropertySetterBuffer_AppendBoxed_CachesAndReusesAlreadyBox await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastPropertySetterBuffer_AppendBoxedUnverified_CachesAndReusesAlreadyBoxedRecord() { // Mirrors the AppendBoxed caching test for the Unverified path so the `r.Boxed ??= new @@ -906,7 +906,7 @@ public async Task FastPropertySetterBuffer_AppendBoxedUnverified_CachesAndReuses await That(second[0].Interaction).IsSameAs(first[0].Interaction); } - [Fact] + [Test] public async Task FastPropertySetterBuffer_AppendBoxedUnverified_ShouldSkipMatchedSlots() { // Covers the AppendBoxedUnverified branch on the setter buffer (NoCoverage cluster). @@ -926,7 +926,7 @@ public async Task FastPropertySetterBuffer_AppendBoxedUnverified_ShouldSkipMatch await That(((PropertySetterAccess)dest[1].Interaction).Value).IsEqualTo(3); } - [Fact] + [Test] public async Task FastPropertySetterBuffer_ConsumeMatching_ShouldMarkSlotsVerified() { FastMockInteractions store = new(1); @@ -945,7 +945,7 @@ await That(dest).IsEmpty() "ConsumeMatching must write `_storage.VerifiedUnderLock(slot) = true`, otherwise the matched slots stay unverified and a second call would re-count the same records"); } - [Fact] + [Test] public async Task IndexerGetterBuffer1_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -964,7 +964,7 @@ public async Task IndexerGetterBuffer1_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerGetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerGetterBuffer2_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -985,7 +985,7 @@ public async Task IndexerGetterBuffer2_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerGetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerGetterBuffer3_AppendBoxed_BoxesAsIndexerGetterAccess() { FastMockInteractions store = new(1); @@ -1001,7 +1001,7 @@ public async Task IndexerGetterBuffer3_AppendBoxed_BoxesAsIndexerGetterAccess() await That(boxed.Parameter3).IsTrue(); } - [Fact] + [Test] public async Task IndexerGetterBuffer3_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -1024,7 +1024,7 @@ public async Task IndexerGetterBuffer3_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerGetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerGetterBuffer4_AppendBoxed_BoxesAsIndexerGetterAccess() { FastMockInteractions store = new(1); @@ -1041,7 +1041,7 @@ public async Task IndexerGetterBuffer4_AppendBoxed_BoxesAsIndexerGetterAccess() await That(boxed.Parameter4).IsEqualTo(3.14); } - [Fact] + [Test] public async Task IndexerGetterBuffer4_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -1065,7 +1065,7 @@ public async Task IndexerGetterBuffer4_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerGetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerSetterBuffer1_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -1086,7 +1086,7 @@ public async Task IndexerSetterBuffer1_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerSetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerSetterBuffer2_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -1109,7 +1109,7 @@ public async Task IndexerSetterBuffer2_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerSetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerSetterBuffer3_AppendBoxed_BoxesAsIndexerSetterAccess() { FastMockInteractions store = new(1); @@ -1126,7 +1126,7 @@ public async Task IndexerSetterBuffer3_AppendBoxed_BoxesAsIndexerSetterAccess() await That(boxed.TypedValue).IsEqualTo(3.14); } - [Fact] + [Test] public async Task IndexerSetterBuffer3_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); @@ -1150,7 +1150,7 @@ public async Task IndexerSetterBuffer3_AppendBoxedUnverified_ShouldSkipMatchedSl await That(((IndexerSetterAccess)dest[1].Interaction).Parameter1).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerSetterBuffer4_AppendBoxed_BoxesAsIndexerSetterAccess() { FastMockInteractions store = new(1); @@ -1168,7 +1168,7 @@ public async Task IndexerSetterBuffer4_AppendBoxed_BoxesAsIndexerSetterAccess() await That(boxed.TypedValue).IsEqualTo('z'); } - [Fact] + [Test] public async Task IndexerSetterBuffer4_AppendBoxedUnverified_ShouldSkipMatchedSlots() { FastMockInteractions store = new(1); diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConcurrencyTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConcurrencyTests.cs index c97bf0a44..5dc36e5af 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConcurrencyTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConcurrencyTests.cs @@ -6,8 +6,8 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastBufferConcurrencyTests { - [Fact] - public async Task FastMethod1Buffer_ConcurrentAppend_ShouldRecordAllInteractions() + [Test] + public async Task FastMethod1Buffer_ConcurrentAppend_ShouldRecordAllInteractions(CancellationToken cancellationToken) { const int writerCount = 8; const int appendsPerWriter = 1000; @@ -15,11 +15,6 @@ public async Task FastMethod1Buffer_ConcurrentAppend_ShouldRecordAllInteractions FastMockInteractions store = new(1); FastMethod1Buffer buffer = store.GetOrCreateBuffer>(0, static f => new FastMethod1Buffer(f)); -#if NET48 - CancellationToken cancellationToken = TestContext.Current.CancellationToken; -#else - CancellationToken cancellationToken = CancellationToken.None; -#endif Task[] writers = new Task[writerCount]; for (int w = 0; w < writerCount; w++) @@ -41,7 +36,7 @@ await That(buffer.ConsumeMatching((IParameterMatch)It.IsAny())) .IsEqualTo(writerCount * appendsPerWriter); } - [Fact] + [Test] public async Task FastMethod1Buffer_InteractionAdded_ShouldFireWhenSubscribed() { FastMockInteractions store = new(1); diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConsumeMatchingTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConsumeMatchingTests.cs index 271e577dc..c0cc884a4 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConsumeMatchingTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastBufferConsumeMatchingTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastBufferConsumeMatchingTests { - [Fact] + [Test] public async Task FastEventBuffer_ConsumeMatching_ShouldReturnCount() { FastMockInteractions store = new(1); @@ -23,7 +23,7 @@ public async Task FastEventBuffer_ConsumeMatching_ShouldReturnCount() await That(buffer.ConsumeMatching()).IsEqualTo(2); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer1_ConsumeMatching_ShouldHonorMatcher() { FastMockInteractions store = new(1); @@ -39,7 +39,7 @@ public async Task FastIndexerGetterBuffer1_ConsumeMatching_ShouldHonorMatcher() await That(buffer.ConsumeMatching((IParameterMatch)It.Is(99))).IsEqualTo(0); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer2_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -58,7 +58,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.Is("a"))).IsEqualTo(1); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer3_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -84,7 +84,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.Is(false))).IsEqualTo(0); } - [Fact] + [Test] public async Task FastIndexerGetterBuffer4_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -113,7 +113,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.IsAny())).IsEqualTo(0); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer1_ConsumeMatching_ShouldHonorMatchers() { FastMockInteractions store = new(1); @@ -135,7 +135,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.IsAny())).IsEqualTo(0); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer2_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -161,7 +161,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.IsAny())).IsEqualTo(0); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer3_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -190,7 +190,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.IsAny())).IsEqualTo(0); } - [Fact] + [Test] public async Task FastIndexerSetterBuffer4_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -222,7 +222,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.IsAny())).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod0Buffer_ConsumeMatching_ShouldReturnCount() { FastMockInteractions store = new(1); @@ -238,7 +238,7 @@ public async Task FastMethod0Buffer_ConsumeMatching_ShouldReturnCount() await That(buffer.ConsumeMatching()).IsEqualTo(3); } - [Fact] + [Test] public async Task FastMethod1Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWithoutThrowing() { FastMockInteractions store = new(1); @@ -252,7 +252,7 @@ await That(consumed).IsEqualTo(0) "the `slot < n` loop bound in Method1 ConsumeAll must keep an empty buffer out of the loop; entering it at slot 0 would dereference the not-yet-allocated VerifiedChunks[0]"); } - [Fact] + [Test] public async Task FastMethod1Buffer_ConsumeMatching_ShouldHonorMatcher() { FastMockInteractions store = new(1); @@ -268,7 +268,7 @@ public async Task FastMethod1Buffer_ConsumeMatching_ShouldHonorMatcher() await That(buffer.ConsumeMatching((IParameterMatch)It.Is(99))).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod2Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWithoutThrowing() { FastMockInteractions store = new(1); @@ -280,7 +280,7 @@ public async Task FastMethod2Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWit await That(consumed).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod2Buffer_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -305,7 +305,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.IsAny())).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod3Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWithoutThrowing() { FastMockInteractions store = new(1); @@ -317,7 +317,7 @@ public async Task FastMethod3Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWit await That(consumed).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod3Buffer_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -346,7 +346,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.Is(false))).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod4Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWithoutThrowing() { FastMockInteractions store = new(1); @@ -359,7 +359,7 @@ public async Task FastMethod4Buffer_ConsumeAll_OnEmptyBuffer_ShouldReturnZeroWit await That(consumed).IsEqualTo(0); } - [Fact] + [Test] public async Task FastMethod4Buffer_ConsumeMatching_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -398,7 +398,7 @@ await That(buffer.ConsumeMatching( (IParameterMatch)It.Is(99.0))).IsEqualTo(0); } - [Fact] + [Test] public async Task FastPropertyGetterBuffer_ConsumeMatching_ShouldReturnCount() { FastMockInteractions store = new(1); @@ -413,7 +413,7 @@ public async Task FastPropertyGetterBuffer_ConsumeMatching_ShouldReturnCount() await That(buffer.ConsumeMatching()).IsEqualTo(2); } - [Fact] + [Test] public async Task FastPropertySetterBuffer_ConsumeMatching_ShouldHonorMatcher() { FastMockInteractions store = new(1); diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastEventBufferTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastEventBufferTests.cs index a13b06180..544416ff9 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastEventBufferTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastEventBufferTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastEventBufferTests { - [Fact] + [Test] public async Task EventSubscribe_RoutesThroughTypedBuffer() { IFastEventService sut = IFastEventService.CreateMock(); @@ -19,7 +19,7 @@ public async Task EventSubscribe_RoutesThroughTypedBuffer() await That(buffer!.Count).IsEqualTo(2); } - [Fact] + [Test] public async Task EventUnsubscribe_RoutesThroughTypedBuffer() { IFastEventService sut = IFastEventService.CreateMock(); diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastIndexerBufferTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastIndexerBufferTests.cs index 17930e83f..25bf2e652 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastIndexerBufferTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastIndexerBufferTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastIndexerBufferTests { - [Fact] + [Test] public async Task IndexerGet_RoutesThroughTypedBuffer() { IFastIndexerService sut = IFastIndexerService.CreateMock(); @@ -19,7 +19,7 @@ public async Task IndexerGet_RoutesThroughTypedBuffer() await That(buffer!.Count).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerSet_RoutesThroughTypedBuffer() { IFastIndexerService sut = IFastIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastMockInteractionsTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastMockInteractionsTests.cs index 5caff892d..d89608667 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastMockInteractionsTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastMockInteractionsTests.cs @@ -9,7 +9,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastMockInteractionsTests { - [Fact] + [Test] public async Task Append_ShouldRaiseInteractionAdded() { FastMockInteractions sut = new(1); @@ -31,7 +31,7 @@ void Handler(object? sender, EventArgs e) } } - [Fact] + [Test] public async Task Buffers_ShouldExposeInstalledBuffersByMemberId() { FastMockInteractions sut = new(3); @@ -46,7 +46,7 @@ public async Task Buffers_ShouldExposeInstalledBuffersByMemberId() await That(sut.Buffers[2]).IsSameAs(subscribe); } - [Fact] + [Test] public async Task Clear_FallbackPath_ShouldClearStrongReferencesInRecordsArray() { // Pins the `Array.Clear(_records, 0, _count);` call inside FallbackBuffer.Clear. With @@ -79,7 +79,7 @@ public async Task Clear_FallbackPath_ShouldClearStrongReferencesInRecordsArray() } } - [Fact] + [Test] public async Task Clear_FallbackPath_ShouldNotResurfaceOldRecordsAfterRefill() { IMockInteractions sut = new FastMockInteractions(0); @@ -106,7 +106,7 @@ public async Task Clear_FallbackPath_ShouldNotResurfaceOldRecordsAfterRefill() await That(ordered[1]).IsSameAs(fourth); } - [Fact] + [Test] public async Task Clear_ShouldFireOnClearing() { FastMockInteractions sut = new(1); @@ -126,7 +126,7 @@ void Handler(object? sender, EventArgs e) } } - [Fact] + [Test] public async Task Clear_ShouldResetAllBuffersAndCount() { FastMockInteractions sut = new(2); @@ -144,7 +144,7 @@ public async Task Clear_ShouldResetAllBuffersAndCount() await That(sut.ToList()).IsEmpty(); } - [Fact] + [Test] public async Task Clear_ShouldResetPerBufferVerifiedTracking() { FastMockInteractions sut = new(2); @@ -164,7 +164,7 @@ public async Task Clear_ShouldResetPerBufferVerifiedTracking() await That(sut.GetUnverifiedInteractions()).HasCount(2); } - [Fact] + [Test] public async Task Clear_ShouldResetVerifiedBookkeeping() { FastMockInteractions sut = new(1); @@ -181,7 +181,7 @@ public async Task Clear_ShouldResetVerifiedBookkeeping() await That(unverified).HasCount(1); } - [Fact] + [Test] public async Task Clear_WithSharedSingletonInVerifiedSet_ShouldResurfaceItAsUnverifiedAfterReAppend() { // Pins the `_verified = null;` reset inside Clear. FastPropertyGetterBuffer reuses a @@ -203,7 +203,7 @@ public async Task Clear_WithSharedSingletonInVerifiedSet_ShouldResurfaceItAsUnve await That(unverified).HasCount(1); } - [Fact] + [Test] public async Task Count_ShouldReflectAppendsAcrossBuffers() { FastMockInteractions sut = new(2); @@ -219,7 +219,7 @@ public async Task Count_ShouldReflectAppendsAcrossBuffers() await That(getterBuffer.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task GetEnumerator_ShouldReturnInteractionsInRegistrationOrder() { FastMockInteractions sut = new(2); @@ -245,8 +245,8 @@ public async Task GetEnumerator_ShouldReturnInteractionsInRegistrationOrder() await That(((PropertySetterAccess)ordered[3]).Value).IsEqualTo("y"); } - [Fact] - public async Task GetOrCreateFallbackBuffer_BarrierSynchronizedRace_AllCallersResolveToTheSameInstalledBuffer() + [Test] + public async Task GetOrCreateFallbackBuffer_BarrierSynchronizedRace_AllCallersResolveToTheSameInstalledBuffer(CancellationToken cancellationToken) { // Pins the `existing ?? created` null-coalesce in GetOrCreateFallbackBuffer. With the // left side removed (`existing ?? created` → `created`), CompareExchange losers return @@ -286,12 +286,6 @@ public async Task GetOrCreateFallbackBuffer_BarrierSynchronizedRace_AllCallersRe }, TaskCreationOptions.LongRunning); } -#if NET48 - CancellationToken cancellationToken = TestContext.Current.CancellationToken; -#else - CancellationToken cancellationToken = CancellationToken.None; -#endif - for (int round = 0; round < rounds; round++) { fallbackField.SetValue(sut, null); @@ -309,7 +303,7 @@ public async Task GetOrCreateFallbackBuffer_BarrierSynchronizedRace_AllCallersRe await Task.WhenAll(tasks); } - [Fact] + [Test] public async Task GetOrCreateFallbackBuffer_ConcurrentRace_RecordsAllInteractions() { const int threads = 8; @@ -340,7 +334,7 @@ public async Task GetOrCreateFallbackBuffer_ConcurrentRace_RecordsAllInteraction await That(sut.ToList()).HasCount(threads * callsPerThread); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_AcrossBuffersWithInterleavedAppends_ReturnsInSequenceOrder() { // Pins the `unverified.Count > 1` boundary that gates the defensive Sort by Seq inside @@ -366,7 +360,7 @@ public async Task GetUnverifiedInteractions_AcrossBuffersWithInterleavedAppends_ await That(((MethodInvocation)unverified[3]).Parameter1).IsEqualTo(3); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_AcrossMultipleBuffers_ShouldUnionFastAndSlowVerifications() { FastMockInteractions sut = new(2); @@ -382,7 +376,7 @@ public async Task GetUnverifiedInteractions_AcrossMultipleBuffers_ShouldUnionFas await That(sut.GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_AfterMatcherLessConsumeMatching_ShouldDropMarkedSlots() { FastMockInteractions sut = new(1); @@ -401,7 +395,7 @@ public async Task GetUnverifiedInteractions_AfterMatcherLessConsumeMatching_Shou await That(((MethodInvocation)unverified.Single()).Name).IsEqualTo("third"); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_AfterTypedConsumeMatching_ShouldDropOnlyMatchedSlots() { FastMockInteractions sut = new(1); @@ -420,7 +414,7 @@ public async Task GetUnverifiedInteractions_AfterTypedConsumeMatching_ShouldDrop await That(sut.GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_FastPathPlusSlowPath_ShouldFilterByBoth() { FastMockInteractions sut = new(1); @@ -439,7 +433,7 @@ public async Task GetUnverifiedInteractions_FastPathPlusSlowPath_ShouldFilterByB await That(((MethodInvocation)unverified.Single()).Parameter1).IsEqualTo(3); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_ShouldRespectVerifiedSet() { FastMockInteractions sut = new(1); @@ -457,7 +451,7 @@ public async Task GetUnverifiedInteractions_ShouldRespectVerifiedSet() await That(unverified.Contains(all[1])).IsTrue(); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_WhenNothingRecorded_ShouldReturnArrayEmptySingleton() { FastMockInteractions sut = new(1); @@ -470,7 +464,7 @@ await That(result).IsSameAs(Array.Empty()) "the empty path must take the `return Array.Empty();` early-return rather than fall through and allocate a fresh zero-length array"); } - [Fact] + [Test] public async Task GetUnverifiedInteractions_WhenNothingVerified_ShouldReturnEverything() { FastMockInteractions sut = new(1); @@ -482,7 +476,7 @@ public async Task GetUnverifiedInteractions_WhenNothingVerified_ShouldReturnEver await That(unverified).HasCount(1); } - [Fact] + [Test] public async Task NextSequence_ShouldReturnZeroBasedMonotonicValues() { FastMockInteractions sut = new(0); @@ -496,7 +490,7 @@ public async Task NextSequence_ShouldReturnZeroBasedMonotonicValues() await That(third).IsEqualTo(2L); } - [Fact] + [Test] public async Task RegisterInteraction_FallbackPath_GetUnverifiedInteractions_ShouldRespectVerifiedSet() { IMockInteractions sut = new FastMockInteractions(0); @@ -514,7 +508,7 @@ public async Task RegisterInteraction_FallbackPath_GetUnverifiedInteractions_Sho await That(unverified.Contains(second)).IsTrue(); } - [Fact] + [Test] public async Task RegisterInteraction_FallbackPath_OnClearing_ShouldFireWhenClearIsInvoked() { int invocations = 0; @@ -535,7 +529,7 @@ void Handler(object? sender, EventArgs e) } } - [Fact] + [Test] public async Task RegisterInteraction_FallbackPath_ShouldEnumerateMultipleInRegistrationOrder() { IMockInteractions sut = new FastMockInteractions(0); @@ -553,7 +547,7 @@ public async Task RegisterInteraction_FallbackPath_ShouldEnumerateMultipleInRegi await That(enumerated[1]).IsSameAs(second); } - [Fact] + [Test] public async Task RegisterInteraction_FallbackPath_ShouldFireInteractionAddedPerCall() { int invocations = 0; @@ -573,7 +567,7 @@ void Handler(object? sender, EventArgs e) } } - [Fact] + [Test] public async Task RegisterInteraction_FallbackPath_ShouldRecordAndEnumerate() { IMockInteractions sut = new FastMockInteractions(0); @@ -586,7 +580,7 @@ public async Task RegisterInteraction_FallbackPath_ShouldRecordAndEnumerate() await That(sut.ToList()[0]).IsSameAs(interaction); } - [Fact] + [Test] public async Task RegisterInteraction_WhenSkipInteractionRecording_ShouldNotRecord() { IMockInteractions sut = new FastMockInteractions(0, true); @@ -596,7 +590,7 @@ public async Task RegisterInteraction_WhenSkipInteractionRecording_ShouldNotReco await That(sut.Count).IsEqualTo(0); } - [Fact] + [Test] public async Task SkipInteractionRecording_ShouldReflectConstructionValue() { FastMockInteractions skipping = new(0, true); @@ -606,7 +600,7 @@ public async Task SkipInteractionRecording_ShouldReflectConstructionValue() await That(recording.SkipInteractionRecording).IsFalse(); } - [Fact] + [Test] public async Task Verified_BeforeAnyAppend_OnSecondCallAddsToExistingSet() { FastMockInteractions sut = new(1); @@ -621,7 +615,7 @@ public async Task Verified_BeforeAnyAppend_OnSecondCallAddsToExistingSet() await That(sut.GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task Verified_OnSecondCallWithDifferentItems_PreservesPreviouslyVerifiedItems() { // Pins the `_verified ??= []` lazy-init in Verified(). With the assignment turned into a @@ -639,7 +633,7 @@ public async Task Verified_OnSecondCallWithDifferentItems_PreservesPreviouslyVer await That(sut.GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task Verified_WithMultipleInteractions_AddsAllToInternalSet() { FastMockInteractions sut = new(1); @@ -665,7 +659,7 @@ private static FastPropertyGetterBuffer InstallPropertyGetter(FastMockInteractio public sealed class MethodBufferTests { - [Fact] + [Test] public async Task Method0_BoxesAsMethodInvocation() { FastMockInteractions store = new(1); @@ -677,7 +671,7 @@ public async Task Method0_BoxesAsMethodInvocation() await That(boxed.Name).IsEqualTo("Foo"); } - [Fact] + [Test] public async Task Method1_BoxesAsMethodInvocationT1() { FastMockInteractions store = new(1); @@ -690,7 +684,7 @@ public async Task Method1_BoxesAsMethodInvocationT1() await That(boxed.Parameter1).IsEqualTo(42); } - [Fact] + [Test] public async Task Method2_BoxesAsMethodInvocationT1T2() { FastMockInteractions store = new(1); @@ -704,7 +698,7 @@ public async Task Method2_BoxesAsMethodInvocationT1T2() await That(boxed.Parameter2).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Method3_BoxesAsMethodInvocationT1T2T3() { FastMockInteractions store = new(1); @@ -719,7 +713,7 @@ public async Task Method3_BoxesAsMethodInvocationT1T2T3() await That(boxed.Parameter3).IsTrue(); } - [Fact] + [Test] public async Task Method4_BoxesAsMethodInvocationT1T2T3T4() { FastMockInteractions store = new(1); @@ -734,7 +728,7 @@ public async Task Method4_BoxesAsMethodInvocationT1T2T3T4() await That(boxed.Parameter4).IsEqualTo(3.14); } - [Fact] + [Test] public async Task ResizesAndPreservesOrder() { FastMockInteractions store = new(1); @@ -756,7 +750,7 @@ public async Task ResizesAndPreservesOrder() public sealed class PropertyBufferTests { - [Fact] + [Test] public async Task Getter_BoxesAsPropertyGetterAccess() { FastMockInteractions store = new(1); @@ -769,7 +763,7 @@ public async Task Getter_BoxesAsPropertyGetterAccess() await That(boxed.Name).IsEqualTo("Foo"); } - [Fact] + [Test] public async Task Setter_BoxesAsPropertySetterAccessT() { FastMockInteractions store = new(1); @@ -786,7 +780,7 @@ public async Task Setter_BoxesAsPropertySetterAccessT() public sealed class IndexerBufferTests { - [Fact] + [Test] public async Task Getter1_BoxesAsIndexerGetterAccess() { FastMockInteractions store = new(1); @@ -799,7 +793,7 @@ public async Task Getter1_BoxesAsIndexerGetterAccess() await That(boxed.Parameter1).IsEqualTo("k"); } - [Fact] + [Test] public async Task Getter2_BoxesAsIndexerGetterAccess() { FastMockInteractions store = new(1); @@ -813,7 +807,7 @@ public async Task Getter2_BoxesAsIndexerGetterAccess() await That(boxed.Parameter2).IsEqualTo(1); } - [Fact] + [Test] public async Task Setter1_BoxesAsIndexerSetterAccess() { FastMockInteractions store = new(1); @@ -827,7 +821,7 @@ public async Task Setter1_BoxesAsIndexerSetterAccess() await That(boxed.TypedValue).IsTrue(); } - [Fact] + [Test] public async Task Setter2_BoxesAsIndexerSetterAccess() { FastMockInteractions store = new(1); @@ -844,7 +838,7 @@ public async Task Setter2_BoxesAsIndexerSetterAccess() public sealed class EventBufferTests { - [Fact] + [Test] public async Task Subscribe_BoxesAsEventSubscription() { FastMockInteractions store = new(1); @@ -860,7 +854,7 @@ public async Task Subscribe_BoxesAsEventSubscription() await That(boxed.Method).IsSameAs(method); } - [Fact] + [Test] public async Task Unsubscribe_BoxesAsEventUnsubscription() { FastMockInteractions store = new(1); @@ -877,7 +871,7 @@ public async Task Unsubscribe_BoxesAsEventUnsubscription() public sealed class ConcurrencyTests { - [Fact] + [Test] public async Task ConcurrentAppendsAcrossMembers_ShouldPreserveTotalCount() { const int threads = 8; diff --git a/Tests/Mockolate.Internal.Tests/Interactions/FastPropertyBufferTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/FastPropertyBufferTests.cs index 71d810e53..e1b236be2 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/FastPropertyBufferTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/FastPropertyBufferTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Internal.Tests.Interactions; public class FastPropertyBufferTests { - [Fact] + [Test] public async Task PropertyGet_BufferRecordsArePreservedOnEnumeration() { IFastPropertyService sut = IFastPropertyService.CreateMock(); @@ -22,7 +22,7 @@ public async Task PropertyGet_BufferRecordsArePreservedOnEnumeration() await That(all[2]).IsExactly(); } - [Fact] + [Test] public async Task PropertyGet_RoutesThroughTypedBuffer() { IFastPropertyService sut = IFastPropertyService.CreateMock(); @@ -39,7 +39,7 @@ public async Task PropertyGet_RoutesThroughTypedBuffer() await That(fast.Count).IsEqualTo(2); } - [Fact] + [Test] public async Task PropertySet_RoutesThroughTypedBuffer() { IFastPropertyService sut = IFastPropertyService.CreateMock(); @@ -55,7 +55,7 @@ public async Task PropertySet_RoutesThroughTypedBuffer() await That(buffer!.Count).IsEqualTo(3); } - [Fact] + [Test] public async Task SkipInteractionRecording_DoesNotAppendToBuffer() { MockBehavior behavior = MockBehavior.Default with diff --git a/Tests/Mockolate.Internal.Tests/Interactions/IndexerAccessTests.cs b/Tests/Mockolate.Internal.Tests/Interactions/IndexerAccessTests.cs index fb50f4671..010c1270c 100644 --- a/Tests/Mockolate.Internal.Tests/Interactions/IndexerAccessTests.cs +++ b/Tests/Mockolate.Internal.Tests/Interactions/IndexerAccessTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Internal.Tests.Interactions; public sealed class IndexerAccessTests { - [Fact] + [Test] public async Task StoreValue_OnIndexerGetterAccess1_UsesGetOrAddChildDispatch() { RecordingStorage storage = new(); @@ -20,7 +20,7 @@ public async Task StoreValue_OnIndexerGetterAccess1_UsesGetOrAddChildDispatch() await That(storage.Calls).IsEqualTo(["GetOrAdd(42)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerGetterAccess2_UsesGetOrAddChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -34,7 +34,7 @@ public async Task StoreValue_OnIndexerGetterAccess2_UsesGetOrAddChildDispatchFor await That(storage.Calls).IsEqualTo(["GetOrAdd(1)", "GetOrAdd(2)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerGetterAccess3_UsesGetOrAddChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -48,7 +48,7 @@ public async Task StoreValue_OnIndexerGetterAccess3_UsesGetOrAddChildDispatchFor await That(storage.Calls).IsEqualTo(["GetOrAdd(1)", "GetOrAdd(2)", "GetOrAdd(3)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerGetterAccess4_UsesGetOrAddChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -63,7 +63,7 @@ public async Task StoreValue_OnIndexerGetterAccess4_UsesGetOrAddChildDispatchFor await That(storage.Calls).IsEqualTo(["GetOrAdd(1)", "GetOrAdd(2)", "GetOrAdd(3)", "GetOrAdd(4)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerSetterAccess1_UsesGetOrAddChildDispatch() { RecordingStorage storage = new(); @@ -77,7 +77,7 @@ public async Task StoreValue_OnIndexerSetterAccess1_UsesGetOrAddChildDispatch() await That(storage.Calls).IsEqualTo(["GetOrAdd(42)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerSetterAccess2_UsesGetOrAddChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -92,7 +92,7 @@ public async Task StoreValue_OnIndexerSetterAccess2_UsesGetOrAddChildDispatchFor await That(storage.Calls).IsEqualTo(["GetOrAdd(1)", "GetOrAdd(2)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerSetterAccess3_UsesGetOrAddChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -107,7 +107,7 @@ public async Task StoreValue_OnIndexerSetterAccess3_UsesGetOrAddChildDispatchFor await That(storage.Calls).IsEqualTo(["GetOrAdd(1)", "GetOrAdd(2)", "GetOrAdd(3)",]); } - [Fact] + [Test] public async Task StoreValue_OnIndexerSetterAccess4_UsesGetOrAddChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -122,7 +122,7 @@ public async Task StoreValue_OnIndexerSetterAccess4_UsesGetOrAddChildDispatchFor await That(storage.Calls).IsEqualTo(["GetOrAdd(1)", "GetOrAdd(2)", "GetOrAdd(3)", "GetOrAdd(4)",]); } - [Fact] + [Test] public async Task ToString_OnIndexerGetterAccess3_FormatsEachNullParameterAsNullLiteral() { IndexerGetterAccess access = new(null, null, null); @@ -132,7 +132,7 @@ await That(access.ToString()).IsEqualTo("get indexer [null, null, null]") "each `?? \"null\"` literal in IndexerGetterAccess.ToString must render a null parameter as `null` rather than as an empty slot like \"[, ...]\""); } - [Fact] + [Test] public async Task ToString_OnIndexerGetterAccess4_FormatsEachNullParameterAsNullLiteral() { IndexerGetterAccess access = @@ -141,7 +141,7 @@ public async Task ToString_OnIndexerGetterAccess4_FormatsEachNullParameterAsNull await That(access.ToString()).IsEqualTo("get indexer [null, null, null, null]"); } - [Fact] + [Test] public async Task ToString_OnIndexerSetterAccess3_FormatsEachNullParameterAsNullLiteral() { IndexerSetterAccess access = new(null, null, null, null); @@ -149,7 +149,7 @@ public async Task ToString_OnIndexerSetterAccess3_FormatsEachNullParameterAsNull await That(access.ToString()).IsEqualTo("set indexer [null, null, null] to null"); } - [Fact] + [Test] public async Task ToString_OnIndexerSetterAccess4_FormatsEachNullParameterAsNullLiteral() { IndexerSetterAccess access = @@ -158,7 +158,7 @@ public async Task ToString_OnIndexerSetterAccess4_FormatsEachNullParameterAsNull await That(access.ToString()).IsEqualTo("set indexer [null, null, null, null] to null"); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess1_UsesGetChildDispatch() { RecordingStorage storage = new(); @@ -172,7 +172,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess1_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(42)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess1_WithoutStorage_ShouldReturnFalse() { IndexerGetterAccess access = new(42); @@ -184,7 +184,7 @@ await That(found).IsFalse() "the first `if (s is null) { return null; }` guard in IndexerGetterAccess.TraverseStorage must short-circuit instead of dereferencing null to call GetChildDispatch"); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess2_UsesGetChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -198,7 +198,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess2_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(1)", "Get(2)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess2_WithoutStorage_ShouldReturnFalse() { IndexerGetterAccess access = new(1, 2); @@ -208,7 +208,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess2_WithoutStorage_Shoul await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess3_UsesGetChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -222,7 +222,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess3_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(1)", "Get(2)", "Get(3)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess3_WithoutStorage_ShouldReturnFalse() { IndexerGetterAccess access = new(1, 2, 3); @@ -232,7 +232,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess3_WithoutStorage_Shoul await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess4_UsesGetChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -247,7 +247,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess4_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(1)", "Get(2)", "Get(3)", "Get(4)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerGetterAccess4_WithoutStorage_ShouldReturnFalse() { IndexerGetterAccess access = new(1, 2, 3, 4); @@ -257,7 +257,7 @@ public async Task TryFindStoredValue_OnIndexerGetterAccess4_WithoutStorage_Shoul await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess1_UsesGetChildDispatch() { RecordingStorage storage = new(); @@ -271,7 +271,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess1_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(42)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess1_WithoutStorage_ShouldReturnFalse() { IndexerSetterAccess access = new(42, "v"); @@ -281,7 +281,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess1_WithoutStorage_Shoul await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess2_UsesGetChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -296,7 +296,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess2_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(1)", "Get(2)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess2_WhenFirstDispatchReturnsNull_ShouldReturnFalse() { // Pins the second `if (s is null) { return null; }` guard inside @@ -314,7 +314,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess2_WhenFirstDispatchRet await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess2_WithoutStorage_ShouldReturnFalse() { IndexerSetterAccess access = new(1, 2, "v"); @@ -324,7 +324,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess2_WithoutStorage_Shoul await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess3_UsesGetChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -339,7 +339,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess3_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(1)", "Get(2)", "Get(3)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess3_WhenFirstDispatchReturnsNull_ShouldReturnFalse() { NullAfterStorage storage = new(1); @@ -353,7 +353,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess3_WhenFirstDispatchRet await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess3_WhenSecondDispatchReturnsNull_ShouldReturnFalse() { NullAfterStorage storage = new(2); @@ -367,7 +367,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess3_WhenSecondDispatchRe await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess3_WithoutStorage_ShouldReturnFalse() { IndexerSetterAccess access = new(1, 2, 3, "v"); @@ -377,7 +377,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess3_WithoutStorage_Shoul await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess4_UsesGetChildDispatchForEachParameter() { RecordingStorage storage = new(); @@ -392,7 +392,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess4_UsesGetChildDispatch await That(storage.Calls).IsEqualTo(["Get(1)", "Get(2)", "Get(3)", "Get(4)",]); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess4_WhenFirstDispatchReturnsNull_ShouldReturnFalse() { NullAfterStorage storage = new(1); @@ -406,7 +406,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess4_WhenFirstDispatchRet await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess4_WhenSecondDispatchReturnsNull_ShouldReturnFalse() { NullAfterStorage storage = new(2); @@ -420,7 +420,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess4_WhenSecondDispatchRe await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess4_WhenThirdDispatchReturnsNull_ShouldReturnFalse() { NullAfterStorage storage = new(3); @@ -434,7 +434,7 @@ public async Task TryFindStoredValue_OnIndexerSetterAccess4_WhenThirdDispatchRet await That(found).IsFalse(); } - [Fact] + [Test] public async Task TryFindStoredValue_OnIndexerSetterAccess4_WithoutStorage_ShouldReturnFalse() { IndexerSetterAccess access = new(1, 2, 3, 4, "v"); diff --git a/Tests/Mockolate.Internal.Tests/Internals/StringExtensionsTests.cs b/Tests/Mockolate.Internal.Tests/Internals/StringExtensionsTests.cs index 005a46591..78a51cf56 100644 --- a/Tests/Mockolate.Internal.Tests/Internals/StringExtensionsTests.cs +++ b/Tests/Mockolate.Internal.Tests/Internals/StringExtensionsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Internal.Tests.Internals; public sealed class StringExtensionsTests { - [Fact] + [Test] public async Task SubstringAfterLast_WhenNameContainsMultipleDots_ShouldUseLastOccurrence() { string value = "foo.bar.baz"; @@ -14,7 +14,7 @@ public async Task SubstringAfterLast_WhenNameContainsMultipleDots_ShouldUseLastO await That(result).IsEqualTo("baz"); } - [Fact] + [Test] public async Task SubstringAfterLast_WhenNameDoesNotContainAnyDots_ShouldReturnFullString() { string value = "foo-bar"; @@ -24,7 +24,7 @@ public async Task SubstringAfterLast_WhenNameDoesNotContainAnyDots_ShouldReturnF await That(result).IsEqualTo("foo-bar"); } - [Fact] + [Test] public async Task SubstringAfterLast_WhenNameEndsWithDot_ShouldReturnEmptyString() { string value = "foo."; @@ -34,7 +34,7 @@ public async Task SubstringAfterLast_WhenNameEndsWithDot_ShouldReturnEmptyString await That(result).IsEqualTo(""); } - [Fact] + [Test] public async Task SubstringUntilFirst_WhenNameContainsMultipleDots_ShouldUseFirstOccurrence() { string value = "foo.bar.baz"; @@ -44,7 +44,7 @@ public async Task SubstringUntilFirst_WhenNameContainsMultipleDots_ShouldUseFirs await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task SubstringUntilFirst_WhenNameDoesNotContainAnyDots_ShouldReturnFullString() { string value = "foo-bar"; @@ -54,7 +54,7 @@ public async Task SubstringUntilFirst_WhenNameDoesNotContainAnyDots_ShouldReturn await That(result).IsEqualTo("foo-bar"); } - [Fact] + [Test] public async Task SubstringUntilFirst_WhenNameStartsWithDot_ShouldReturnEmptyString() { string value = ".foo"; diff --git a/Tests/Mockolate.Internal.Tests/Internals/TypeFormatterTests.cs b/Tests/Mockolate.Internal.Tests/Internals/TypeFormatterTests.cs index 313ee16f8..e4d0b8159 100644 --- a/Tests/Mockolate.Internal.Tests/Internals/TypeFormatterTests.cs +++ b/Tests/Mockolate.Internal.Tests/Internals/TypeFormatterTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Internal.Tests.Internals; public sealed class TypeFormatterTests { - [Fact] + [Test] public async Task GenericArguments_ShouldFormatToName() { MethodInfo methodInfo = GetType().GetMethod(nameof(MyMethod), BindingFlags.NonPublic | BindingFlags.Static)!; @@ -17,7 +17,7 @@ public async Task GenericArguments_ShouldFormatToName() await That(result).IsEqualTo("T"); } - [Fact] + [Test] public async Task NestedType_ShouldIncludeDeclaringType() { Type type = typeof(MyType); @@ -27,7 +27,7 @@ public async Task NestedType_ShouldIncludeDeclaringType() await That(result).IsEqualTo("TypeFormatterTests.MyType"); } - [Fact] + [Test] public async Task ShouldFormatVoid() { MethodInfo methodInfo = GetType().GetMethod(nameof(MyMethod), BindingFlags.NonPublic | BindingFlags.Static)!; diff --git a/Tests/Mockolate.Internal.Tests/Internals/WildcardTests.cs b/Tests/Mockolate.Internal.Tests/Internals/WildcardTests.cs index 05a793c3b..239b57292 100644 --- a/Tests/Mockolate.Internal.Tests/Internals/WildcardTests.cs +++ b/Tests/Mockolate.Internal.Tests/Internals/WildcardTests.cs @@ -4,10 +4,10 @@ namespace Mockolate.Internal.Tests.Internals; public class WildcardTests { - [Theory] - [InlineData("\r\n")] - [InlineData("\r")] - [InlineData("\n")] + [Test] + [Arguments("\r\n")] + [Arguments("\r")] + [Arguments("\n")] public async Task ShouldSupportMultilineStrings(string newlineSeparator) { Wildcard wildcard = Wildcard.Pattern("fo*az", false); diff --git a/Tests/Mockolate.Internal.Tests/Parameters/ParameterMatchAdapterTests.cs b/Tests/Mockolate.Internal.Tests/Parameters/ParameterMatchAdapterTests.cs index 7b1108f3e..4d2fd5c5b 100644 --- a/Tests/Mockolate.Internal.Tests/Parameters/ParameterMatchAdapterTests.cs +++ b/Tests/Mockolate.Internal.Tests/Parameters/ParameterMatchAdapterTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Internal.Tests.Parameters; public class ParameterMatchAdapterTests { - [Fact] + [Test] public async Task ParameterMatch_FallsBackToBoxedMatchesCall() { IParameter match = IParameter.CreateMock(); @@ -20,7 +20,7 @@ void Act() await That(Act).Throws().WithMessage("Matches(object) is called"); } - [Fact] + [Test] public async Task ParameterMatch_PrefersUnboxedMatchesCall() { IParameter match = IParameter.CreateMock().Implementing>(); diff --git a/Tests/Mockolate.Internal.Tests/RefStructProjectionStorageTests.cs b/Tests/Mockolate.Internal.Tests/RefStructProjectionStorageTests.cs index b9694e492..8487d4b69 100644 --- a/Tests/Mockolate.Internal.Tests/RefStructProjectionStorageTests.cs +++ b/Tests/Mockolate.Internal.Tests/RefStructProjectionStorageTests.cs @@ -22,7 +22,7 @@ private readonly ref struct Key(int id) public int Id { get; } = id; } - [Fact] + [Test] public async Task GetterSetup_WithProjection_StoreAndTryGet_RoundTrip() { IParameter matcher = It.IsRefStructBy(k => k.Id); @@ -37,7 +37,7 @@ public async Task GetterSetup_WithProjection_StoreAndTryGet_RoundTrip() await That(value).IsEqualTo("forty-two"); } - [Fact] + [Test] public async Task GetterSetup_WithoutProjection_StoreIsNoOp_TryGetReturnsFalse() { IParameter matcher = It.IsAnyRefStruct(); @@ -51,7 +51,7 @@ public async Task GetterSetup_WithoutProjection_StoreIsNoOp_TryGetReturnsFalse() await That(found).IsFalse(); } - [Fact] + [Test] public async Task GetterSetup_NullMatcher_HasNoStorage() { RefStructIndexerGetterSetup getter = new("get_Item", null); @@ -63,7 +63,7 @@ public async Task GetterSetup_NullMatcher_HasNoStorage() await That(found).IsFalse(); } - [Fact] + [Test] public async Task GetterSetup_WithProjectionAndPredicate_StoreSkipsNonMatchingKey() { IParameter matcher = It.IsRefStructBy(k => k.Id, id => id > 10); @@ -81,7 +81,7 @@ public async Task GetterSetup_WithProjectionAndPredicate_StoreSkipsNonMatchingKe await That(bigValue).IsEqualTo("big"); } - [Fact] + [Test] public async Task GetterSetup_WithProjection_Invoke_ReturnsStoredValue_BeforeReturnFactory() { IRefStructIndexerGetterSetup setup; @@ -98,7 +98,7 @@ public async Task GetterSetup_WithProjection_Invoke_ReturnsStoredValue_BeforeRet await That(read).IsEqualTo("stored"); } - [Fact] + [Test] public async Task GetterSetup_WithProjection_EmptyBucket_Invoke_FallsBackToReturns() { IRefStructIndexerGetterSetup setup; @@ -113,7 +113,7 @@ public async Task GetterSetup_WithProjection_EmptyBucket_Invoke_FallsBackToRetur await That(read).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task GetterSetup_WithProjection_HasReturnValue_IsTrueEvenWithoutReturnFactory() { RefStructIndexerGetterSetup getter = new( @@ -125,7 +125,7 @@ await That(getter.HasReturnValue).IsTrue() "activating the storage dictionary must flip HasReturnValue, so that the generator's emitted getter body takes the return path and serves stored values"); } - [Fact] + [Test] public async Task GetterSetup_WithoutProjection_HasReturnValue_IsFalse_UntilReturnsConfigured() { RefStructIndexerGetterSetup getter = new( @@ -138,7 +138,7 @@ public async Task GetterSetup_WithoutProjection_HasReturnValue_IsFalse_UntilRetu await That(getter.HasReturnValue).IsTrue(); } - [Fact] + [Test] public async Task CombinedSetup_Constructor_WiresSetterBoundGetter() { IParameter matcher = It.IsRefStructBy(k => k.Id); @@ -148,7 +148,7 @@ public async Task CombinedSetup_Constructor_WiresSetterBoundGetter() await That(setup.Setter.BoundGetter).IsSameAs(setup.Getter); } - [Fact] + [Test] public async Task CombinedSetup_WithProjection_SetterInvoke_StoresIntoGetter() { IParameter matcher = It.IsRefStructBy(k => k.Id); @@ -163,7 +163,7 @@ public async Task CombinedSetup_WithProjection_SetterInvoke_StoresIntoGetter() await That(value).IsEqualTo("seven"); } - [Fact] + [Test] public async Task SetterOnlySetup_BoundGetter_DefaultsToNull_InvokeIsStorageNoOp() { IParameter matcher = It.IsRefStructBy(k => k.Id); @@ -177,7 +177,7 @@ public async Task SetterOnlySetup_BoundGetter_DefaultsToNull_InvokeIsStorageNoOp setter.Invoke(new Key(7), "seven"); } - [Fact] + [Test] public async Task CombinedSetup_WithoutProjection_NoStorageActivated() { IParameter matcher = It.IsAnyRefStruct(); @@ -196,7 +196,7 @@ await That(found).IsFalse() public sealed class Arity2Tests { - [Fact] + [Test] public async Task AllProjections_StoreAndTryGet_RoundTrip() { IParameter p1 = It.IsRefStructBy(k => k.Id); @@ -214,7 +214,7 @@ public async Task AllProjections_StoreAndTryGet_RoundTrip() await That(miss).IsFalse(); } - [Fact] + [Test] public async Task MixedNormalAndProjection_StoreAndTryGet_RoundTrip() { IParameter normal = It.IsAny(); @@ -234,7 +234,7 @@ public async Task MixedNormalAndProjection_StoreAndTryGet_RoundTrip() await That(missOnSecond).IsFalse(); } - [Fact] + [Test] public async Task OneRefStructWithoutProjection_StorageInactive() { IParameter normal = It.IsAny(); @@ -250,7 +250,7 @@ public async Task OneRefStructWithoutProjection_StorageInactive() await That(getter.HasReturnValue).IsFalse(); } - [Fact] + [Test] public async Task CombinedSetup_WiresBoundGetter_SetterWrite_FeedsGetterRead() { IParameter normal = It.IsAny(); @@ -271,7 +271,7 @@ public async Task CombinedSetup_WiresBoundGetter_SetterWrite_FeedsGetterRead() public sealed class Arity3Tests { - [Fact] + [Test] public async Task MixedProjectionAndNormal_RoundTrip() { IParameter p1 = It.IsAny(); @@ -293,7 +293,7 @@ public async Task MixedProjectionAndNormal_RoundTrip() public sealed class Arity4Tests { - [Fact] + [Test] public async Task AllRefStructWithProjection_RoundTrip() { IParameter p = It.IsRefStructBy(k => k.Id); diff --git a/Tests/Mockolate.Internal.Tests/Registry/MockRegistryScenarioTests.cs b/Tests/Mockolate.Internal.Tests/Registry/MockRegistryScenarioTests.cs index 7c7efa5e2..17e161bb1 100644 --- a/Tests/Mockolate.Internal.Tests/Registry/MockRegistryScenarioTests.cs +++ b/Tests/Mockolate.Internal.Tests/Registry/MockRegistryScenarioTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Internal.Tests.Registry; public sealed class MockRegistryScenarioTests { - [Fact] + [Test] public async Task ApplyIndexerGetter_WithLazyDefault_AndNonNullSetup_DispatchesToSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -23,7 +23,7 @@ await That(result).IsEqualTo(1) await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task GetIndexerSetup_ByAccess_WithActiveScenarioAndScopedMatching_ReturnsScoped() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -39,7 +39,7 @@ public async Task GetIndexerSetup_ByAccess_WithActiveScenarioAndScopedMatching_R await That(result).IsSameAs(scoped); } - [Fact] + [Test] public async Task GetIndexerSetup_ByAccess_WithActiveScenarioButScopedDoesNotMatchAccess_FallsBackToGlobal() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -55,7 +55,7 @@ public async Task GetIndexerSetup_ByAccess_WithActiveScenarioButScopedDoesNotMat await That(result).IsSameAs(global); } - [Fact] + [Test] public async Task GetIndexerSetup_ByPredicate_WithActiveScenarioButPredicateRejectsScoped_FallsBackToGlobal() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -71,7 +71,7 @@ public async Task GetIndexerSetup_ByPredicate_WithActiveScenarioButPredicateReje await That(result).IsSameAs(global); } - [Fact] + [Test] public async Task GetMethodSetups_WithActiveScenarioAndScopedSetup_YieldsScopedThenGlobal() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -89,7 +89,7 @@ public async Task GetMethodSetups_WithActiveScenarioAndScopedSetup_YieldsScopedT await That(setups[1]).IsSameAs(global); } - [Fact] + [Test] public async Task GetMethodSetups_WithActiveScenarioButNoScopedBucket_FallsBackToGlobal() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); diff --git a/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySetupSnapshotTests.cs b/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySetupSnapshotTests.cs index 1179dc977..6b532ca2d 100644 --- a/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySetupSnapshotTests.cs +++ b/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySetupSnapshotTests.cs @@ -16,7 +16,7 @@ public sealed class MockRegistrySetupSnapshotTests public sealed class MethodTests { - [Fact] + [Test] public async Task SetupMethod_WithIncreasingMemberIds_GrowsTableLazily() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -39,7 +39,7 @@ public async Task SetupMethod_WithIncreasingMemberIds_GrowsTableLazily() await That(snapshot3![0]).IsSameAs(setup3); } - [Fact] + [Test] public async Task SetupMethod_WithMemberId_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -53,7 +53,7 @@ public async Task SetupMethod_WithMemberId_PublishesToSnapshot() await That(snapshot[0]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupMethod_WithMemberIdAndDefaultScenario_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -67,7 +67,7 @@ public async Task SetupMethod_WithMemberIdAndDefaultScenario_PublishesToSnapshot await That(snapshot[0]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupMethod_WithMemberIdAndNamedScenario_DoesNotPublishToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -78,7 +78,7 @@ public async Task SetupMethod_WithMemberIdAndNamedScenario_DoesNotPublishToSnaps await That(registry.GetMethodSetupSnapshot(5)).IsNull(); } - [Fact] + [Test] public async Task SetupMethod_WithMemberIdAndNamedScenario_PreservesScenarioBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -91,7 +91,7 @@ public async Task SetupMethod_WithMemberIdAndNamedScenario_PreservesScenarioBuck await That(scoped!.Methods.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task SetupMethod_WithSameMemberIdTwice_AppendsToBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -111,7 +111,7 @@ public async Task SetupMethod_WithSameMemberIdTwice_AppendsToBucket() public sealed class PropertyTests { - [Fact] + [Test] public async Task PublishPropertyToMemberIdBucket_WhenResized_PreservesEarlierEntries() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -127,7 +127,7 @@ public async Task PublishPropertyToMemberIdBucket_WhenResized_PreservesEarlierEn await That(registry.GetPropertySetupSnapshot(10)).IsSameAs(setupHigh); } - [Fact] + [Test] public async Task PublishPropertyToMemberIdBucket_WithDefaultThenDefault_OverwritesInSnapshotTable() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -141,7 +141,7 @@ public async Task PublishPropertyToMemberIdBucket_WithDefaultThenDefault_Overwri await That(snapshot).IsSameAs(defaultB); } - [Fact] + [Test] public async Task PublishPropertyToMemberIdBucket_WithDefaultThenUserSetup_RetainsUserSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -157,7 +157,7 @@ public async Task PublishPropertyToMemberIdBucket_WithDefaultThenUserSetup_Retai await That(observed).IsEqualTo(99); } - [Fact] + [Test] public async Task PublishPropertyToMemberIdBucket_WithUserThenDefault_RetainsUserSetupInSnapshotTable() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -171,7 +171,7 @@ public async Task PublishPropertyToMemberIdBucket_WithUserThenDefault_RetainsUse await That(snapshot).IsSameAs(userSetup); } - [Fact] + [Test] public async Task PublishPropertyToMemberIdBucket_WithUserThenDefaultSetup_RetainsUserSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -185,7 +185,7 @@ public async Task PublishPropertyToMemberIdBucket_WithUserThenDefaultSetup_Retai await That(observed).IsEqualTo(99); } - [Fact] + [Test] public async Task SetupProperty_DefaultDoesNotOverwriteUserSetupAtSameMemberIdInSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -200,7 +200,7 @@ public async Task SetupProperty_DefaultDoesNotOverwriteUserSetupAtSameMemberIdIn await That(table![1]).IsSameAs(userSetup); } - [Fact] + [Test] public async Task SetupProperty_UserSetupDoesOverwriteDefaultAtSameMemberIdInSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -216,7 +216,7 @@ public async Task SetupProperty_UserSetupDoesOverwriteDefaultAtSameMemberIdInSna await That(table![1]).IsSameAs(userSetup); } - [Fact] + [Test] public async Task SetupProperty_WithGrowingMemberIds_PreservesEarlierEntriesViaArrayCopy() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -235,7 +235,7 @@ public async Task SetupProperty_WithGrowingMemberIds_PreservesEarlierEntriesViaA await That(table[5]).IsSameAs(setupB); } - [Fact] + [Test] public async Task SetupProperty_WithIncreasingMemberIds_GrowsTableLazily() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -255,7 +255,7 @@ public async Task SetupProperty_WithIncreasingMemberIds_GrowsTableLazily() await That(registry.GetPropertyFast(3, new PropertyGetterAccess("P3"), _ => -1)).IsEqualTo(30); } - [Fact] + [Test] public async Task SetupProperty_WithMemberId_PopulatesSnapshotSlot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -270,7 +270,7 @@ public async Task SetupProperty_WithMemberId_PopulatesSnapshotSlot() await That(table[3]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupProperty_WithMemberId_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -283,7 +283,7 @@ public async Task SetupProperty_WithMemberId_PublishesToSnapshot() await That(observed).IsEqualTo(50); } - [Fact] + [Test] public async Task SetupProperty_WithMemberId_PublishesUserSetupToSnapshotTable() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -296,7 +296,7 @@ public async Task SetupProperty_WithMemberId_PublishesUserSetupToSnapshotTable() await That(snapshot).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupProperty_WithMemberIdAndDefaultScenario_PopulatesSnapshotSlot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -310,7 +310,7 @@ public async Task SetupProperty_WithMemberIdAndDefaultScenario_PopulatesSnapshot await That(table![3]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupProperty_WithMemberIdAndDefaultScenario_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -323,7 +323,7 @@ public async Task SetupProperty_WithMemberIdAndDefaultScenario_PublishesToSnapsh await That(observed).IsEqualTo(50); } - [Fact] + [Test] public async Task SetupProperty_WithMemberIdAndDefaultScenario_PublishesUserSetupToSnapshotTable() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -336,7 +336,7 @@ public async Task SetupProperty_WithMemberIdAndDefaultScenario_PublishesUserSetu await That(snapshot).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupProperty_WithMemberIdAndNamedScenario_DoesNotPublishToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -349,7 +349,7 @@ public async Task SetupProperty_WithMemberIdAndNamedScenario_DoesNotPublishToSna await That(observed).IsEqualTo(-1); } - [Fact] + [Test] public async Task SetupProperty_WithMemberIdAndNamedScenario_LeavesSnapshotUnpublished() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -362,7 +362,7 @@ public async Task SetupProperty_WithMemberIdAndNamedScenario_LeavesSnapshotUnpub await That(table).IsNull(); } - [Fact] + [Test] public async Task SetupProperty_WithMemberIdAndNamedScenario_PreservesScenarioBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -375,7 +375,7 @@ public async Task SetupProperty_WithMemberIdAndNamedScenario_PreservesScenarioBu await That(scopedSetup).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupProperty_WithSameMemberIdTwice_RetainsLatestUserSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -394,7 +394,7 @@ public async Task SetupProperty_WithSameMemberIdTwice_RetainsLatestUserSetup() public sealed class IndexerTests { - [Fact] + [Test] public async Task SetupIndexer_WithIncreasingMemberIds_GrowsTableLazily() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -417,7 +417,7 @@ public async Task SetupIndexer_WithIncreasingMemberIds_GrowsTableLazily() await That(snapshot3![0]).IsSameAs(setup3); } - [Fact] + [Test] public async Task SetupIndexer_WithMemberId_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -431,7 +431,7 @@ public async Task SetupIndexer_WithMemberId_PublishesToSnapshot() await That(snapshot[0]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupIndexer_WithMemberIdAndDefaultScenario_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -445,7 +445,7 @@ public async Task SetupIndexer_WithMemberIdAndDefaultScenario_PublishesToSnapsho await That(snapshot[0]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupIndexer_WithMemberIdAndNamedScenario_DoesNotPublishToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -456,7 +456,7 @@ public async Task SetupIndexer_WithMemberIdAndNamedScenario_DoesNotPublishToSnap await That(registry.GetIndexerSetupSnapshot(5)).IsNull(); } - [Fact] + [Test] public async Task SetupIndexer_WithMemberIdAndNamedScenario_PreservesScenarioBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -469,7 +469,7 @@ public async Task SetupIndexer_WithMemberIdAndNamedScenario_PreservesScenarioBuc await That(scoped!.Indexers.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task SetupIndexer_WithSameMemberIdTwice_AppendsToBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -489,7 +489,7 @@ public async Task SetupIndexer_WithSameMemberIdTwice_AppendsToBucket() public sealed class EventTests { - [Fact] + [Test] public async Task SetupEvent_WithIncreasingMemberIds_GrowsTableLazily() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -512,7 +512,7 @@ public async Task SetupEvent_WithIncreasingMemberIds_GrowsTableLazily() await That(snapshot3![0]).IsSameAs(setup3); } - [Fact] + [Test] public async Task SetupEvent_WithMemberId_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -526,7 +526,7 @@ public async Task SetupEvent_WithMemberId_PublishesToSnapshot() await That(snapshot[0]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupEvent_WithMemberIdAndDefaultScenario_PublishesToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -540,7 +540,7 @@ public async Task SetupEvent_WithMemberIdAndDefaultScenario_PublishesToSnapshot( await That(snapshot[0]).IsSameAs(setup); } - [Fact] + [Test] public async Task SetupEvent_WithMemberIdAndNamedScenario_DoesNotPublishToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -551,7 +551,7 @@ public async Task SetupEvent_WithMemberIdAndNamedScenario_DoesNotPublishToSnapsh await That(registry.GetEventSetupSnapshot(5)).IsNull(); } - [Fact] + [Test] public async Task SetupEvent_WithMemberIdAndNamedScenario_PreservesScenarioBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -564,7 +564,7 @@ public async Task SetupEvent_WithMemberIdAndNamedScenario_PreservesScenarioBucke await That(scoped!.Events.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task SetupEvent_WithSameMemberIdTwice_AppendsToBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); diff --git a/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySnapshotRetrievalTests.cs b/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySnapshotRetrievalTests.cs index 20df9ed79..4d1728575 100644 --- a/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySnapshotRetrievalTests.cs +++ b/Tests/Mockolate.Internal.Tests/Registry/MockRegistrySnapshotRetrievalTests.cs @@ -15,7 +15,7 @@ private static MethodInfo GetMethodInfo() public sealed class GetMethodSetupsTests { - [Fact] + [Test] public async Task WithActiveScenarioAndScopedSetup_YieldsScopedThenSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -33,7 +33,7 @@ public async Task WithActiveScenarioAndScopedSetup_YieldsScopedThenSnapshot() await That(setups[1]).IsSameAs(snapshotSetup); } - [Fact] + [Test] public async Task WithActiveScenarioButNoScopedBucket_FallsBackToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -48,7 +48,7 @@ public async Task WithActiveScenarioButNoScopedBucket_FallsBackToSnapshot() await That(setups[0]).IsSameAs(snapshotSetup); } - [Fact] + [Test] public async Task WithSnapshotAndGlobalDictSetups_YieldsSnapshotBeforeGlobalDict() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -65,7 +65,7 @@ public async Task WithSnapshotAndGlobalDictSetups_YieldsSnapshotBeforeGlobalDict await That(setups[1]).IsSameAs(globalDictSetup); } - [Fact] + [Test] public async Task WithSnapshotSetupOnly_YieldsSnapshotSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -82,7 +82,7 @@ public async Task WithSnapshotSetupOnly_YieldsSnapshotSetup() public sealed class GetIndexerSetupTests { - [Fact] + [Test] public async Task ByAccess_WithActiveScenarioAndScopedDoesNotMatch_FallsBackToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -98,7 +98,7 @@ public async Task ByAccess_WithActiveScenarioAndScopedDoesNotMatch_FallsBackToSn await That(result).IsSameAs(snapshotSetup); } - [Fact] + [Test] public async Task ByAccess_WithSnapshotSetupOnly_ReturnsSnapshotSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -111,7 +111,7 @@ public async Task ByAccess_WithSnapshotSetupOnly_ReturnsSnapshotSetup() await That(result).IsSameAs(setup); } - [Fact] + [Test] public async Task ByPredicate_WithActiveScenarioAndPredicateRejectsScoped_FallsBackToSnapshot() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -127,7 +127,7 @@ public async Task ByPredicate_WithActiveScenarioAndPredicateRejectsScoped_FallsB await That(result).IsSameAs(snapshotSetup); } - [Fact] + [Test] public async Task ByPredicate_WithSnapshotSetupOnly_ReturnsSnapshotSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -143,7 +143,7 @@ public async Task ByPredicate_WithSnapshotSetupOnly_ReturnsSnapshotSetup() public sealed class RemoveEventSnapshotByNameTests { - [Fact] + [Test] public async Task RemoveEvent_WhenUnsubscribeMemberIdDiffersFromSubscribe_FiresUnsubscribedCallbackViaNameScan() { // The source generator mints separate subscribe and unsubscribe member ids and registers the @@ -167,7 +167,7 @@ public async Task RemoveEvent_WhenUnsubscribeMemberIdDiffersFromSubscribe_FiresU public sealed class GetUnusedSetupsTests { - [Fact] + [Test] public async Task IncludesIndexerSnapshotSetup_WhenNoInteractionsMatch() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -180,7 +180,7 @@ public async Task IncludesIndexerSnapshotSetup_WhenNoInteractionsMatch() await That(unused).Contains(setup); } - [Fact] + [Test] public async Task IncludesMethodSnapshotSetup_WhenNoInteractionsMatch() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); diff --git a/Tests/Mockolate.Internal.Tests/Registry/MockRegistryTests.cs b/Tests/Mockolate.Internal.Tests/Registry/MockRegistryTests.cs index 8255ede7e..a6e2be493 100644 --- a/Tests/Mockolate.Internal.Tests/Registry/MockRegistryTests.cs +++ b/Tests/Mockolate.Internal.Tests/Registry/MockRegistryTests.cs @@ -19,7 +19,7 @@ private static MethodInfo GetMethodInfo() public sealed class ConstructorSkipFlagAgreementTests { - [Fact] + [Test] public async Task BehaviorAndInteractions_WhenSkipFlagsDisagree_Throws() { MockBehavior recordingBehavior = MockBehavior.Default; @@ -34,7 +34,7 @@ await That(Act).Throws() .WithMessage("*SkipInteractionRecording*").AsWildcard(); } - [Fact] + [Test] public async Task BehaviorAndInteractions_WhenSkippingBehaviorMeetsRecordingInteractions_Throws() { MockBehavior skippingBehavior = MockBehavior.Default.SkippingInteractionRecording(); @@ -49,7 +49,7 @@ await That(Act).Throws() .WithMessage("*SkipInteractionRecording*").AsWildcard(); } - [Fact] + [Test] public async Task RegistryAndInteractions_WhenSkipFlagsDisagree_Throws() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -64,7 +64,7 @@ await That(Act).Throws() .WithMessage("*SkipInteractionRecording*").AsWildcard(); } - [Fact] + [Test] public async Task RegistryAndInteractions_WhenSkippingRegistryMeetsRecordingInteractions_Throws() { MockBehavior skippingBehavior = MockBehavior.Default.SkippingInteractionRecording(); @@ -83,7 +83,7 @@ await That(Act).Throws() public sealed class GetIndexerSetupScenarioScopingTests { - [Fact] + [Test] public async Task WithActiveScenario_ShouldReturnScopedSetupOverGlobalSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -98,7 +98,7 @@ public async Task WithActiveScenario_ShouldReturnScopedSetupOverGlobalSetup() await That(result).IsSameAs(scopedSetup); } - [Fact] + [Test] public async Task WithoutActiveScenario_ShouldFallBackToGlobalSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -115,7 +115,7 @@ public async Task WithoutActiveScenario_ShouldFallBackToGlobalSetup() public sealed class IndexerFallbackStoresValueTests { - [Fact] + [Test] public async Task ApplyIndexerGetter_WithNullSetup_ShouldStoreBaseValueForLaterLookup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -129,7 +129,7 @@ public async Task ApplyIndexerGetter_WithNullSetup_ShouldStoreBaseValueForLaterL await That(second).IsEqualTo(42); } - [Fact] + [Test] public async Task GetIndexerFallback_ShouldStoreDefaultForLaterLookup() { int counter = 0; @@ -148,7 +148,7 @@ public async Task GetIndexerFallback_ShouldStoreDefaultForLaterLookup() public sealed class ApplyIndexerGetterLazyGeneratorTests { - [Fact] + [Test] public async Task WithNullSetup_LooseMode_NoStoredValue_ShouldInvokeGeneratorAndStore() { int callCount = 0; @@ -164,7 +164,7 @@ public async Task WithNullSetup_LooseMode_NoStoredValue_ShouldInvokeGeneratorAnd await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task WithNullSetup_StrictMode_NoStoredValue_ShouldThrow() { MockBehavior behavior = MockBehavior.Default.ThrowingWhenNotSetup(); @@ -180,7 +180,7 @@ await That(Act).Throws() .WithMessage("*was accessed without prior setup*").AsWildcard(); } - [Fact] + [Test] public async Task WithNullSetup_StrictMode_WhenValueWasPreviouslyStored_ShouldReturnStored() { MockBehavior behavior = MockBehavior.Default.ThrowingWhenNotSetup(); @@ -197,7 +197,7 @@ public async Task WithNullSetup_StrictMode_WhenValueWasPreviouslyStored_ShouldRe public sealed class GetIndexerFallbackTests { - [Fact] + [Test] public async Task StrictMode_NoStoredValue_ShouldThrow() { MockBehavior behavior = MockBehavior.Default.ThrowingWhenNotSetup(); @@ -213,7 +213,7 @@ await That(Act).Throws() .WithMessage("*was accessed without prior setup*").AsWildcard(); } - [Fact] + [Test] public async Task WhenValueWasPreviouslyStored_ShouldReturnStoredWithoutGeneratingDefault() { int counter = 0; @@ -232,7 +232,7 @@ public async Task WhenValueWasPreviouslyStored_ShouldReturnStoredWithoutGenerati public sealed class WrapConstructorTests { - [Fact] + [Test] public async Task WhenBehaviorSkipsInteractionRecording_WrappedRegistryAlsoSkipsRecording() { MockBehavior behavior = MockBehavior.Default.SkippingInteractionRecording(); @@ -250,7 +250,7 @@ public async Task WhenBehaviorSkipsInteractionRecording_WrappedRegistryAlsoSkips public sealed class VerifyPropertyStringKeyedTests { - [Fact] + [Test] public async Task MockGot_WhenNameDoesNotMatch_ShouldReturnNever() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -261,7 +261,7 @@ public async Task MockGot_WhenNameDoesNotMatch_ShouldReturnNever() await That(result).Never(); } - [Fact] + [Test] public async Task MockGot_WhenNameMatches_ShouldReturnOnce() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -272,7 +272,7 @@ public async Task MockGot_WhenNameMatches_ShouldReturnOnce() await That(result).Once(); } - [Fact] + [Test] public async Task MockGot_WithoutInteractions_ShouldReturnNeverResultWithExpectation() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -283,7 +283,7 @@ public async Task MockGot_WithoutInteractions_ShouldReturnNeverResultWithExpecta await That(((IVerificationResult)result).Expectation).IsEqualTo("got property bar"); } - [Fact] + [Test] public async Task MockSet_WhenNameAndValueMatches_ShouldReturnOnce() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -295,7 +295,7 @@ public async Task MockSet_WhenNameAndValueMatches_ShouldReturnOnce() await That(result).Once(); } - [Fact] + [Test] public async Task MockSet_WhenOnlyNameMatches_ShouldReturnNever() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -307,7 +307,7 @@ public async Task MockSet_WhenOnlyNameMatches_ShouldReturnNever() await That(result).Never(); } - [Fact] + [Test] public async Task MockSet_WhenOnlyValueMatches_ShouldReturnNever() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -319,7 +319,7 @@ public async Task MockSet_WhenOnlyValueMatches_ShouldReturnNever() await That(result).Never(); } - [Fact] + [Test] public async Task MockSet_WithoutInteractions_ShouldReturnNeverResultWithExpectation() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -331,7 +331,7 @@ public async Task MockSet_WithoutInteractions_ShouldReturnNeverResultWithExpecta await That(((IVerificationResult)result).Expectation).IsEqualTo("set property bar to It.IsAny()"); } - [Fact] + [Test] public async Task VerifyProperty_WhenNameContainsNoDot_ShouldIncludeFullNameInExpectation() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -342,7 +342,7 @@ public async Task VerifyProperty_WhenNameContainsNoDot_ShouldIncludeFullNameInEx await That(((IVerificationResult)result).Expectation).IsEqualTo("got property SomeNameWithoutADot"); } - [Fact] + [Test] public async Task VerifyProperty_WhenNameStartsWithDot_ShouldOmitDotInExpectation() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -356,7 +356,7 @@ public async Task VerifyProperty_WhenNameStartsWithDot_ShouldOmitDotInExpectatio public sealed class SubscribedToStringKeyedTests { - [Fact] + [Test] public async Task Subscribed_WhenNameDoesNotMatch_ShouldReturnNever() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -367,7 +367,7 @@ public async Task Subscribed_WhenNameDoesNotMatch_ShouldReturnNever() await That(result).Never(); } - [Fact] + [Test] public async Task Subscribed_WhenNameMatches_ShouldReturnOnce() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -378,7 +378,7 @@ public async Task Subscribed_WhenNameMatches_ShouldReturnOnce() await That(result).Once(); } - [Fact] + [Test] public async Task Subscribed_WithoutInteractions_ShouldReturnNeverResultWithExpectation() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -392,7 +392,7 @@ public async Task Subscribed_WithoutInteractions_ShouldReturnNeverResultWithExpe public sealed class UnsubscribedFromStringKeyedTests { - [Fact] + [Test] public async Task Unsubscribed_WhenNameDoesNotMatch_ShouldReturnNever() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -403,7 +403,7 @@ public async Task Unsubscribed_WhenNameDoesNotMatch_ShouldReturnNever() await That(result).Never(); } - [Fact] + [Test] public async Task Unsubscribed_WhenNameMatches_ShouldReturnOnce() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -414,7 +414,7 @@ public async Task Unsubscribed_WhenNameMatches_ShouldReturnOnce() await That(result).Once(); } - [Fact] + [Test] public async Task Unsubscribed_WithoutInteractions_ShouldReturnNeverResultWithExpectation() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -428,7 +428,7 @@ public async Task Unsubscribed_WithoutInteractions_ShouldReturnNeverResultWithEx public sealed class GetMethodSetupSnapshotTests { - [Fact] + [Test] public async Task WithEmptyTable_ShouldReturnNull() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -438,7 +438,7 @@ public async Task WithEmptyTable_ShouldReturnNull() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithMemberIdAtBoundary_ShouldReturnTheBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -452,7 +452,7 @@ public async Task WithMemberIdAtBoundary_ShouldReturnTheBucket() await That(result!).Contains(setup); } - [Fact] + [Test] public async Task WithMemberIdBeyondTable_ShouldReturnNull() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -468,7 +468,7 @@ public async Task WithMemberIdBeyondTable_ShouldReturnNull() public sealed class GetIndexerSetupSnapshotTests { - [Fact] + [Test] public async Task WithEmptyTable_ShouldReturnNull() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -478,7 +478,7 @@ public async Task WithEmptyTable_ShouldReturnNull() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithMemberIdAtBoundary_ShouldReturnTheBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -491,7 +491,7 @@ public async Task WithMemberIdAtBoundary_ShouldReturnTheBucket() await That(result!).Contains(setup); } - [Fact] + [Test] public async Task WithMemberIdBeyondTable_ShouldReturnNull() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -506,7 +506,7 @@ public async Task WithMemberIdBeyondTable_ShouldReturnNull() public sealed class GetEventSetupSnapshotTests { - [Fact] + [Test] public async Task WithEmptyTable_ShouldReturnNull() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -516,7 +516,7 @@ public async Task WithEmptyTable_ShouldReturnNull() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithMemberIdAtBoundary_ShouldReturnTheBucket() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -529,7 +529,7 @@ public async Task WithMemberIdAtBoundary_ShouldReturnTheBucket() await That(result!).Contains(setup); } - [Fact] + [Test] public async Task WithMemberIdBeyondTable_ShouldReturnNull() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -544,7 +544,7 @@ public async Task WithMemberIdBeyondTable_ShouldReturnNull() public sealed class GetPropertyFastTests { - [Fact] + [Test] public async Task WithActiveScenario_ShouldAlwaysTakeColdPath() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -562,7 +562,7 @@ public async Task WithActiveScenario_ShouldAlwaysTakeColdPath() await That(result).IsEqualTo(99); } - [Fact] + [Test] public async Task WithBaseValueAccessor_ShouldAlwaysTakeColdPath() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -583,7 +583,7 @@ int Base() await That(result).IsEqualTo(99); } - [Fact] + [Test] public async Task WithNullSnapshotAtMemberIdSlot_ShouldFallBackToColdPathWithoutThrowing() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -598,7 +598,7 @@ await That(result).IsEqualTo(7) "registering at index 5 sizes the member-id table to 6 and leaves indices 0..4 null, and reading such a slot must fall through to the cold path rather than dereference the null PropertySetup"); } - [Fact] + [Test] public async Task WithoutSnapshotSetup_ShouldFallBackToColdPath() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -608,7 +608,7 @@ public async Task WithoutSnapshotSetup_ShouldFallBackToColdPath() await That(result).IsEqualTo(7); } - [Fact] + [Test] public async Task WithSnapshotSetup_ShouldBypassSlowResolverAndReturnSetupValue() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -635,7 +635,7 @@ int Generator(MockBehavior _) public sealed class SetPropertyFastTests { - [Fact] + [Test] public async Task WhenMemberIdSetupDiffersFromDictSetup_ShouldUseMemberIdSetupInDefaultScope() { // Pins the member-id-table lookup block inside SetPropertyFast. The first registration goes @@ -659,7 +659,7 @@ public async Task WhenMemberIdSetupDiffersFromDictSetup_ShouldUseMemberIdSetupIn await That(skipBase).IsTrue(); } - [Fact] + [Test] public async Task WithActiveScenario_ShouldRouteToScenarioSetupOverMemberIdTableSetup() { // Pins the IsNullOrEmpty(Scenario) guard at the top of SetPropertyFast: when a scenario is @@ -684,7 +684,7 @@ public async Task WithActiveScenario_ShouldRouteToScenarioSetupOverMemberIdTable await That(skipBase).IsTrue(); } - [Fact] + [Test] public async Task WithoutSnapshotSetup_ShouldFallBackToResolveSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -699,7 +699,7 @@ public async Task WithoutSnapshotSetup_ShouldFallBackToResolveSetup() await That(after).IsEqualTo(42); } - [Fact] + [Test] public async Task WithSnapshotSetup_ShouldInvokeSetterAndStoreValue() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -717,7 +717,7 @@ public async Task WithSnapshotSetup_ShouldInvokeSetterAndStoreValue() public sealed class AddEventMemberIdTests { - [Fact] + [Test] public async Task AddEvent_WithMemberId_ShouldRecordAsEventSubscription() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -728,7 +728,7 @@ public async Task AddEvent_WithMemberId_ShouldRecordAsEventSubscription() await That(recorded).IsExactly(); } - [Fact] + [Test] public async Task AddEvent_WithMemberIdAndMatchingSnapshot_ShouldInvokeSubscribedCallback() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -742,7 +742,7 @@ public async Task AddEvent_WithMemberIdAndMatchingSnapshot_ShouldInvokeSubscribe await That(subscribedCount).IsEqualTo(1); } - [Fact] + [Test] public async Task AddEvent_WithNullMethod_ShouldThrowMockException() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -758,7 +758,7 @@ void Act() public sealed class RemoveEventMemberIdTests { - [Fact] + [Test] public async Task RemoveEvent_WithMemberId_ShouldRecordAsEventUnsubscription() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -769,7 +769,7 @@ public async Task RemoveEvent_WithMemberId_ShouldRecordAsEventUnsubscription() await That(recorded).IsExactly(); } - [Fact] + [Test] public async Task RemoveEvent_WithMemberIdAndMatchingSnapshot_ShouldInvokeUnsubscribedCallback() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -783,7 +783,7 @@ public async Task RemoveEvent_WithMemberIdAndMatchingSnapshot_ShouldInvokeUnsubs await That(unsubscribedCount).IsEqualTo(1); } - [Fact] + [Test] public async Task RemoveEvent_WithNullMethod_ShouldThrowMockException() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -799,7 +799,7 @@ void Act() public sealed class SetPropertyFallbackBehaviorTests { - [Fact] + [Test] public async Task SetProperty_WithoutSnapshot_ShouldReturnBehaviorSkipBaseClassWhenSetupAllowsBase() { MockBehavior behavior = MockBehavior.Default.SkippingBaseClass(); @@ -810,7 +810,7 @@ public async Task SetProperty_WithoutSnapshot_ShouldReturnBehaviorSkipBaseClassW await That(result).IsTrue(); } - [Fact] + [Test] public async Task SetProperty_WithoutSnapshot_ShouldReturnFalseWhenBehaviorDoesNotSkip() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -823,7 +823,7 @@ public async Task SetProperty_WithoutSnapshot_ShouldReturnFalseWhenBehaviorDoesN public sealed class TryGetBufferTests { - [Fact] + [Test] public async Task VerifyMethodTyped_WithNonFastInteractions_ShouldFallToSlowPath() { // Pins the `Interactions is FastMockInteractions` type-pattern guard at the top of @@ -884,7 +884,7 @@ void IMockInteractions.Verified(IEnumerable interactions) { } public sealed class GetIndexerSetupSnapshotBoundaryTests { - [Fact] + [Test] public async Task WithMemberIdEqualToTableLength_ShouldReturnNullWithoutThrowing() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -899,7 +899,7 @@ public async Task WithMemberIdEqualToTableLength_ShouldReturnNullWithoutThrowing public sealed class GetPropertyFastSnapshotNullSlotTests { - [Fact] + [Test] public async Task GetPropertyFast_WhenSnapshotTableHasNullEntryAtMemberId_ShouldFallToColdPath() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -917,7 +917,7 @@ await That(result).IsEqualTo(7) public sealed class SetPropertyFastScenarioRoutingTests { - [Fact] + [Test] public async Task SetPropertyFast_WithActiveScenario_ShouldUseColdPathAndWriteToScenarioSetup() { // Pins the `string.IsNullOrEmpty(Scenario)` scenario guard around the int-keyed @@ -946,7 +946,7 @@ public async Task SetPropertyFast_WithActiveScenario_ShouldUseColdPathAndWriteTo public sealed class SetPropertyFastSnapshotInTableOnlyTests { - [Fact] + [Test] public async Task SetPropertyFast_WithSnapshotOnlyInIntKeyedTable_ShouldHonorHotPath() { // Pins the `matchingSetup = table[memberId];` assignment inside SetPropertyFast's @@ -978,7 +978,7 @@ void Act() public sealed class GetPropertyFastInteractionRecordingTests { - [Fact] + [Test] public async Task WithSharedAccessSingleton_AndMatchingFastBuffer_ShouldAppendToBuffer() { FastMockInteractions store = new(1); @@ -993,7 +993,7 @@ public async Task WithSharedAccessSingleton_AndMatchingFastBuffer_ShouldAppendTo await That(result).IsEqualTo(7); } - [Fact] + [Test] public async Task WithSharedAccessSingleton_WithoutMatchingBuffer_ShouldRegisterTheSingleton() { FastMockInteractions store = new(0); @@ -1006,7 +1006,7 @@ public async Task WithSharedAccessSingleton_WithoutMatchingBuffer_ShouldRegister await That(recorded).IsSameAs(access); } - [Fact] + [Test] public async Task WithStringName_AndMatchingFastBuffer_ShouldAppendToBuffer() { FastMockInteractions store = new(1); @@ -1021,7 +1021,7 @@ public async Task WithStringName_AndMatchingFastBuffer_ShouldAppendToBuffer() await That(result).IsEqualTo(7); } - [Fact] + [Test] public async Task WithStringName_AtBufferLengthBoundary_ShouldFallBackWithoutThrowing() { FastMockInteractions store = new(1); @@ -1033,7 +1033,7 @@ public async Task WithStringName_AtBufferLengthBoundary_ShouldFallBackWithoutThr await That(registry.Interactions.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task WithStringName_AtTableLengthBoundary_ShouldFallToColdPathWithoutThrowing() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1046,7 +1046,7 @@ public async Task WithStringName_AtTableLengthBoundary_ShouldFallToColdPathWitho await That(result).IsEqualTo(7); } - [Fact] + [Test] public async Task WithStringName_WhenBehaviorSkipsInteractionRecording_ShouldNotRecord() { MockBehavior behavior = MockBehavior.Default.SkippingInteractionRecording(); @@ -1062,7 +1062,7 @@ public async Task WithStringName_WhenBehaviorSkipsInteractionRecording_ShouldNot await That(registry.Interactions.Count).IsEqualTo(0); } - [Fact] + [Test] public async Task WithStringName_WithoutMatchingBuffer_ShouldFallBackToRegisterPropertyGetterAccess() { FastMockInteractions store = new(0); @@ -1078,7 +1078,7 @@ await That(recorded).IsExactly() public sealed class SetPropertyMemberIdTests { - [Fact] + [Test] public async Task SetProperty_WithMemberId_AndSetupOverridesSkipBaseClass_ShouldReturnSetupOverride() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1092,7 +1092,7 @@ public async Task SetProperty_WithMemberId_AndSetupOverridesSkipBaseClass_Should await That(skipBase).IsTrue(); } - [Fact] + [Test] public async Task SetProperty_WithMemberId_AtBufferLengthBoundary_ShouldFallBackWithoutThrowing() { FastMockInteractions store = new(1); @@ -1107,7 +1107,7 @@ public async Task SetProperty_WithMemberId_AtBufferLengthBoundary_ShouldFallBack await That(recorded).IsExactly>(); } - [Fact] + [Test] public async Task SetProperty_WithMemberId_ShouldInvokeSetterAndStoreValue() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1121,7 +1121,7 @@ public async Task SetProperty_WithMemberId_ShouldInvokeSetterAndStoreValue() await That(after).IsEqualTo(42); } - [Fact] + [Test] public async Task SetProperty_WithoutMemberId_AndSetupOverridesSkipBaseClass_ShouldReturnSetupOverride() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1138,7 +1138,7 @@ public async Task SetProperty_WithoutMemberId_AndSetupOverridesSkipBaseClass_Sho public sealed class SetPropertyFastTableBoundaryTests { - [Fact] + [Test] public async Task SetPropertyFast_AtTableLengthBoundary_ShouldFallToColdPathWithoutThrowing() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1154,7 +1154,7 @@ public async Task SetPropertyFast_AtTableLengthBoundary_ShouldFallToColdPathWith public sealed class AddRemoveEventErrorMessageTests { - [Fact] + [Test] public async Task AddEvent_WithMemberId_AndNullMethod_ShouldThrowSubscriptionMessage() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1168,7 +1168,7 @@ await That(Act).Throws() .WithMessage("The method of an event subscription may not be null."); } - [Fact] + [Test] public async Task AddEvent_WithStringName_AndNullMethod_ShouldThrowSubscriptionMessage() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1182,7 +1182,7 @@ await That(Act).Throws() .WithMessage("The method of an event subscription may not be null."); } - [Fact] + [Test] public async Task RemoveEvent_WithMemberId_AndNullMethod_ShouldThrowUnsubscriptionMessage() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1196,7 +1196,7 @@ await That(Act).Throws() .WithMessage("The method of an event unsubscription may not be null."); } - [Fact] + [Test] public async Task RemoveEvent_WithStringName_AndNullMethod_ShouldThrowUnsubscriptionMessage() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1213,7 +1213,7 @@ await That(Act).Throws() public sealed class RemoveEventScenarioRoutingTests { - [Fact] + [Test] public async Task AddEvent_WithMemberId_AndActiveScenario_ShouldRouteToScenarioSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -1231,7 +1231,7 @@ public async Task AddEvent_WithMemberId_AndActiveScenario_ShouldRouteToScenarioS await That(scenarioCallbackCount).IsEqualTo(1); } - [Fact] + [Test] public async Task RemoveEvent_WithMemberId_AndActiveScenario_ShouldRouteToScenarioSetup() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); diff --git a/Tests/Mockolate.Internal.Tests/Setup/IndexerSetupTests.cs b/Tests/Mockolate.Internal.Tests/Setup/IndexerSetupTests.cs index 515534998..e3a94c2a4 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/IndexerSetupTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/IndexerSetupTests.cs @@ -7,7 +7,7 @@ namespace Mockolate.Internal.Tests.Setup; public sealed class IndexerSetupTests { - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -21,7 +21,7 @@ public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -35,7 +35,7 @@ public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -49,7 +49,7 @@ public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -62,7 +62,7 @@ public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -75,7 +75,7 @@ public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -88,7 +88,7 @@ public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -101,7 +101,7 @@ public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -114,7 +114,7 @@ public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() { IndexerSetup setup = new( @@ -139,7 +139,7 @@ public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() await That(stored).IsEqualTo("base"); } - [Fact] + [Test] public async Task GetResult_WithDefaultValueGenerator_StoresComputedValueForLaterLookup() { IndexerSetup setup = new( @@ -164,7 +164,7 @@ public async Task GetResult_WithDefaultValueGenerator_StoresComputedValueForLate await That(stored).IsEqualTo("generated"); } - [Fact] + [Test] public async Task MatchesAccess_WithUnknownAccessType_ShouldReturnFalse() { IndexerSetup setup = new( @@ -177,7 +177,7 @@ public async Task MatchesAccess_WithUnknownAccessType_ShouldReturnFalse() await That(matches).IsFalse(); } - [Fact] + [Test] public async Task SetResult_WhenValueDoesNotCastToTValue_ShouldNotInvokeSetterCallbacks() { MyIndexerSetup setup = new(); @@ -190,7 +190,7 @@ public async Task SetResult_WhenValueDoesNotCastToTValue_ShouldNotInvokeSetterCa await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task TryCast_WhenValueIsNotOfTargetTypeAndNotNull_ShouldReturnFalse() { bool success = FakeIndexerSetup.InvokeTryCast(42, out string _, MockBehavior.Default); @@ -198,7 +198,7 @@ public async Task TryCast_WhenValueIsNotOfTargetTypeAndNotNull_ShouldReturnFalse await That(success).IsFalse(); } - [Fact] + [Test] public async Task TryCast_WhenValueIsNull_ShouldReturnTrue() { bool success = FakeIndexerSetup.InvokeTryCast(null, out string result, MockBehavior.Default); @@ -209,7 +209,7 @@ public async Task TryCast_WhenValueIsNull_ShouldReturnTrue() public sealed class With2Levels { - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -223,7 +223,7 @@ public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -237,7 +237,7 @@ public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -251,7 +251,7 @@ public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -264,7 +264,7 @@ public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenAssignedValueDoesNotCastToTValue_ShouldNotExecute() { int callCount = 0; @@ -277,7 +277,7 @@ public async Task ExecuteSetterCallback_WhenAssignedValueDoesNotCastToTValue_Sho await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -290,7 +290,7 @@ public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -303,7 +303,7 @@ public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -316,7 +316,7 @@ public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -329,7 +329,7 @@ public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() { IndexerSetup setup = new( @@ -355,7 +355,7 @@ public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() await That(stored).IsEqualTo("base"); } - [Fact] + [Test] public async Task GetResult_WithFuncGenerator_AndInitialization_ShouldUseInitializationValue() { IndexerSetup setup = new( @@ -382,7 +382,7 @@ public async Task GetResult_WithFuncGenerator_AndInitialization_ShouldUseInitial await That(stored).IsEqualTo("7-9"); } - [Fact] + [Test] public async Task MatchesAccess_WithUnknownAccessType_ShouldReturnFalse() { IndexerSetup setup = new( @@ -422,7 +422,7 @@ public void DoSetResult( public sealed class With3Levels { - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -436,7 +436,7 @@ public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -450,7 +450,7 @@ public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -464,7 +464,7 @@ public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -477,7 +477,7 @@ public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenAssignedValueDoesNotCastToTValue_ShouldNotExecute() { int callCount = 0; @@ -490,7 +490,7 @@ public async Task ExecuteSetterCallback_WhenAssignedValueDoesNotCastToTValue_Sho await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -503,7 +503,7 @@ public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -516,7 +516,7 @@ public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -529,7 +529,7 @@ public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -542,7 +542,7 @@ public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() { IndexerSetup setup = new( @@ -571,7 +571,7 @@ public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() await That(stored).IsEqualTo("base"); } - [Fact] + [Test] public async Task GetResult_WithFuncGenerator_AndInitialization_ShouldUseInitializationValue() { IndexerSetup setup = new( @@ -599,7 +599,7 @@ public async Task GetResult_WithFuncGenerator_AndInitialization_ShouldUseInitial await That(stored).IsEqualTo("7-8-9"); } - [Fact] + [Test] public async Task MatchesAccess_WithUnknownAccessType_ShouldReturnFalse() { IndexerSetup setup = new( @@ -641,7 +641,7 @@ public void DoSetResult( public sealed class With4Levels { - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -656,7 +656,7 @@ public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -670,7 +670,7 @@ public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -685,7 +685,7 @@ public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -699,7 +699,7 @@ public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenAssignedValueDoesNotCastToTValue_ShouldNotExecute() { int callCount = 0; @@ -713,7 +713,7 @@ public async Task ExecuteSetterCallback_WhenAssignedValueDoesNotCastToTValue_Sho await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -727,7 +727,7 @@ public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -741,7 +741,7 @@ public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -755,7 +755,7 @@ public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -769,7 +769,7 @@ public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() { IndexerSetup setup = new( @@ -799,7 +799,7 @@ public async Task GetResult_WithBaseValue_StoresComputedValueForLaterLookup() await That(stored).IsEqualTo("base"); } - [Fact] + [Test] public async Task GetResult_WithFuncGenerator_AndInitialization_ShouldUseInitializationValue() { IndexerSetup setup = new( @@ -828,7 +828,7 @@ public async Task GetResult_WithFuncGenerator_AndInitialization_ShouldUseInitial await That(stored).IsEqualTo("6-7-8-9"); } - [Fact] + [Test] public async Task MatchesAccess_WithUnknownAccessType_ShouldReturnFalse() { IndexerSetup setup = new( @@ -872,7 +872,7 @@ public void DoSetResult( public sealed class With5Levels { - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -887,7 +887,7 @@ public async Task ExecuteGetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -902,7 +902,7 @@ public async Task ExecuteGetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -917,7 +917,7 @@ public async Task ExecuteGetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; @@ -931,7 +931,7 @@ public async Task ExecuteGetterCallback_WhenTypesAndNumberMatch_ShouldExecute() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -945,7 +945,7 @@ public async Task ExecuteSetterCallback_WhenGenericTypeDoesNotMatch_ShouldNotExe await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -959,7 +959,7 @@ public async Task ExecuteSetterCallback_WhenNumberOfParametersDoesNotMatch_Shoul await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotExecute() { int callCount = 0; @@ -973,7 +973,7 @@ public async Task ExecuteSetterCallback_WhenParameterTypeDoesNotMatch_ShouldNotE await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task ExecuteSetterCallback_WhenTypesAndNumberMatch_ShouldExecute() { int callCount = 0; diff --git a/Tests/Mockolate.Internal.Tests/Setup/MethodSetupMatchesTests.cs b/Tests/Mockolate.Internal.Tests/Setup/MethodSetupMatchesTests.cs index 9f40bdaa5..70298172a 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/MethodSetupMatchesTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/MethodSetupMatchesTests.cs @@ -36,7 +36,7 @@ public sealed class ReturnMethodSetupTests { public sealed class OneParameter { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardNamedParameterValue() { RecordingNamedParametersMatch matcher = new(true); @@ -53,7 +53,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardSingleParameterValue() { RecordingParametersMatch matcher = new(true); @@ -70,7 +70,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { ReturnMethodSetup.WithParameters setup = @@ -81,7 +81,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1_ShouldReturnFalse() { ReturnMethodSetup.WithParameters setup = @@ -95,7 +95,7 @@ public async Task MatchesInteraction_WithNonMethodInvocationOfT1_ShouldReturnFal public sealed class TwoParameters { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardBothNamedParameterValues() { RecordingNamedParametersMatch matcher = new(true); @@ -112,7 +112,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardBothParameterValues() { RecordingParametersMatch matcher = new(true); @@ -129,7 +129,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { ReturnMethodSetup.WithParameters setup = @@ -140,7 +140,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1AndT2_ShouldReturnFalse() { ReturnMethodSetup.WithParameters setup = @@ -154,7 +154,7 @@ public async Task MatchesInteraction_WithNonMethodInvocationOfT1AndT2_ShouldRetu public sealed class ThreeParameters { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardAllNamedParameterValues() { RecordingNamedParametersMatch matcher = new(true); @@ -171,7 +171,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardAllParameterValues() { RecordingParametersMatch matcher = new(true); @@ -188,7 +188,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { ReturnMethodSetup.WithParameters setup = @@ -199,7 +199,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1T2T3_ShouldReturnFalse() { ReturnMethodSetup.WithParameters setup = @@ -213,7 +213,7 @@ public async Task MatchesInteraction_WithNonMethodInvocationOfT1T2T3_ShouldRetur public sealed class FourParameters { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardAllNamedParameterValues() { RecordingNamedParametersMatch matcher = new(true); @@ -230,7 +230,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardAllParameterValues() { RecordingParametersMatch matcher = new(true); @@ -247,7 +247,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { ReturnMethodSetup.WithParameters setup = @@ -258,7 +258,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1T2T3T4_ShouldReturnFalse() { ReturnMethodSetup.WithParameters setup = @@ -275,7 +275,7 @@ public sealed class VoidMethodSetupTests { public sealed class OneParameter { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardNamedParameterValue() { RecordingNamedParametersMatch matcher = new(true); @@ -292,7 +292,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardSingleParameterValue() { RecordingParametersMatch matcher = new(true); @@ -309,7 +309,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { VoidMethodSetup.WithParameters setup = @@ -320,7 +320,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1_ShouldReturnFalse() { VoidMethodSetup.WithParameters setup = @@ -334,7 +334,7 @@ public async Task MatchesInteraction_WithNonMethodInvocationOfT1_ShouldReturnFal public sealed class TwoParameters { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardBothNamedParameterValues() { RecordingNamedParametersMatch matcher = new(true); @@ -351,7 +351,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardBothParameterValues() { RecordingParametersMatch matcher = new(true); @@ -368,7 +368,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { VoidMethodSetup.WithParameters setup = @@ -379,7 +379,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1AndT2_ShouldReturnFalse() { VoidMethodSetup.WithParameters setup = @@ -393,7 +393,7 @@ public async Task MatchesInteraction_WithNonMethodInvocationOfT1AndT2_ShouldRetu public sealed class ThreeParameters { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardAllNamedParameterValues() { RecordingNamedParametersMatch matcher = new(true); @@ -410,7 +410,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardAllParameterValues() { RecordingParametersMatch matcher = new(true); @@ -427,7 +427,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { VoidMethodSetup.WithParameters setup = @@ -438,7 +438,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1T2T3_ShouldReturnFalse() { VoidMethodSetup.WithParameters setup = @@ -452,7 +452,7 @@ public async Task MatchesInteraction_WithNonMethodInvocationOfT1T2T3_ShouldRetur public sealed class FourParameters { - [Fact] + [Test] public async Task Matches_WithINamedParametersMatch_ShouldForwardAllNamedParameterValues() { RecordingNamedParametersMatch matcher = new(true); @@ -469,7 +469,7 @@ await That(matcher.Received[0]).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Matches_WithIParametersMatch_ShouldForwardAllParameterValues() { RecordingParametersMatch matcher = new(true); @@ -486,7 +486,7 @@ await That(matcher.Received[0]).IsEqualTo(new object?[] }); } - [Fact] + [Test] public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() { VoidMethodSetup.WithParameters setup = @@ -497,7 +497,7 @@ public async Task Matches_WithUnknownIParameters_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task MatchesInteraction_WithNonMethodInvocationOfT1T2T3T4_ShouldReturnFalse() { VoidMethodSetup.WithParameters setup = diff --git a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.IndexersTests.cs b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.IndexersTests.cs index 10ddac769..024a6a56a 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.IndexersTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.IndexersTests.cs @@ -8,7 +8,7 @@ public partial class MockSetupsTests { public class IndexersTests { - [Fact] + [Test] public async Task AddAndGetLatestOrDefault_ShouldReturnLatestMatching() { MockSetups.IndexerSetups setups = new(); @@ -24,7 +24,7 @@ public async Task AddAndGetLatestOrDefault_ShouldReturnLatestMatching() await That(result).IsEqualTo(setup1); } - [Fact] + [Test] public async Task GetMatching_OnEmptyStorage_ShouldReturnNullWithoutThrowing() { MockSetups.IndexerSetups setups = new(); @@ -34,7 +34,7 @@ public async Task GetMatching_OnEmptyStorage_ShouldReturnNullWithoutThrowing() await That(result).IsNull(); } - [Fact] + [Test] public async Task InitializeStorageCount_OnFreshInstance_ShouldAllocateValueStoragesArrayWithRequestedLength() { MockSetups.IndexerSetups setups = new(); @@ -46,7 +46,7 @@ public async Task InitializeStorageCount_OnFreshInstance_ShouldAllocateValueStor await That(storages!.Length).IsEqualTo(5); } - [Fact] + [Test] public async Task InitializeStorageCount_WhenAlreadyAllocated_ShouldKeepFirstAllocation() { MockSetups.IndexerSetups setups = new(); @@ -61,7 +61,7 @@ public async Task InitializeStorageCount_WhenAlreadyAllocated_ShouldKeepFirstAll await That(secondAllocation).IsSameAs(firstAllocation); } - [Fact] + [Test] public async Task Stress_ShouldMaintainCountAfterManyAdds() { MockSetups.IndexerSetups setups = new(); @@ -74,7 +74,7 @@ public async Task Stress_ShouldMaintainCountAfterManyAdds() await That(setups.Count).IsEqualTo(1000); } - [Fact] + [Test] public async Task ThreadSafety_ConcurrentAddsAndQueries_ShouldReturnConsistentMatches() { MockSetups.IndexerSetups setups = new(); @@ -98,7 +98,7 @@ public async Task ThreadSafety_ConcurrentAddsAndQueries_ShouldReturnConsistentMa await That(result).IsEqualTo(finalMatch); } - [Fact] + [Test] public async Task ThreadSafety_ShouldHandleParallelAdds() { MockSetups.IndexerSetups setups = new(); diff --git a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.MethodsTests.cs b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.MethodsTests.cs index d76388a0e..8d064770c 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.MethodsTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.MethodsTests.cs @@ -7,7 +7,7 @@ public partial class MockSetupsTests { public class MethodsTests { - [Fact] + [Test] public async Task AddAndRetrieve_ShouldReturnCorrectCount() { MockSetups.MethodSetups setups = new(); @@ -20,7 +20,7 @@ public async Task AddAndRetrieve_ShouldReturnCorrectCount() await That(setups.Count).IsEqualTo(2); } - [Fact] + [Test] public async Task GetLatestOrDefault_OnEmptyStorage_ShouldReturnNullWithoutThrowing() { MockSetups.MethodSetups setups = new(); @@ -30,7 +30,7 @@ public async Task GetLatestOrDefault_OnEmptyStorage_ShouldReturnNullWithoutThrow await That(result).IsNull(); } - [Fact] + [Test] public async Task GetLatestOrDefault_ShouldReturnLatestMatching() { MockSetups.MethodSetups setups = new(); @@ -44,7 +44,7 @@ public async Task GetLatestOrDefault_ShouldReturnLatestMatching() await That(result).IsEqualTo(setup2); } - [Fact] + [Test] public async Task GetLatestOrDefault_WithSingleMatchingSetup_ShouldReturnIt() { MockSetups.MethodSetups setups = new(); @@ -56,7 +56,7 @@ public async Task GetLatestOrDefault_WithSingleMatchingSetup_ShouldReturnIt() await That(result).IsSameAs(setup); } - [Fact] + [Test] public async Task Stress_ShouldMaintainCountAfterManyAdds() { MockSetups.MethodSetups setups = new(); @@ -69,7 +69,7 @@ public async Task Stress_ShouldMaintainCountAfterManyAdds() await That(setups.Count).IsEqualTo(1000); } - [Fact] + [Test] public async Task ThreadSafety_ShouldAllowConcurrentReadsDuringAdds() { MockSetups.MethodSetups setups = new(); @@ -87,7 +87,7 @@ public async Task ThreadSafety_ShouldAllowConcurrentReadsDuringAdds() await That(result).IsEqualTo(needle); } - [Fact] + [Test] public async Task ThreadSafety_ShouldHandleParallelAdds() { MockSetups.MethodSetups setups = new(); diff --git a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.PropertiesTests.cs b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.PropertiesTests.cs index dbaac0868..84cc572ee 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.PropertiesTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.PropertiesTests.cs @@ -7,7 +7,7 @@ public partial class MockSetupsTests { public class PropertiesTests { - [Fact] + [Test] public async Task Add_DefaultPlaceholderAfterUserSetup_ShouldNotOverwriteUserSetup() { MockSetups.PropertySetups setups = new(); @@ -22,7 +22,7 @@ public async Task Add_DefaultPlaceholderAfterUserSetup_ShouldNotOverwriteUserSet await That(setups.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task Add_DefaultPlaceholderOverDefault_ShouldKeepDefaultEntry() { MockSetups.PropertySetups setups = new(); @@ -37,7 +37,7 @@ public async Task Add_DefaultPlaceholderOverDefault_ShouldKeepDefaultEntry() await That(setups.Count).IsEqualTo(0); } - [Fact] + [Test] public async Task Add_ReplacingDefaultWithUserSetup_ShouldIncrementCountByOne() { MockSetups.PropertySetups setups = new(); @@ -54,7 +54,7 @@ public async Task Add_ReplacingDefaultWithUserSetup_ShouldIncrementCountByOne() await That(found).IsSameAs(userSetup); } - [Fact] + [Test] public async Task AddDuplicate_ShouldReplaceAndAdjustCount() { MockSetups.PropertySetups setups = new(); @@ -71,7 +71,7 @@ public async Task AddDuplicate_ShouldReplaceAndAdjustCount() await That(found).IsEqualTo(setup2); } - [Fact] + [Test] public async Task Stress_ShouldMaintainCountAfterManyAddsAndReplacements() { MockSetups.PropertySetups setups = new(); @@ -84,7 +84,7 @@ public async Task Stress_ShouldMaintainCountAfterManyAddsAndReplacements() await That(setups.Count).IsEqualTo(100); } - [Fact] + [Test] public async Task ThreadSafety_DuplicateKeyReplacements_ShouldPreserveSingleEntry() { MockSetups.PropertySetups setups = new(); @@ -98,7 +98,7 @@ public async Task ThreadSafety_DuplicateKeyReplacements_ShouldPreserveSingleEntr await That(setup).IsNotNull(); } - [Fact] + [Test] public async Task ThreadSafety_ShouldHandleParallelAdds() { MockSetups.PropertySetups setups = new(); @@ -108,7 +108,7 @@ public async Task ThreadSafety_ShouldHandleParallelAdds() await That(setups.Count).IsEqualTo(200); } - [Fact] + [Test] public async Task TryGetValue_Nonexistent_ShouldReturnFalse() { MockSetups.PropertySetups setups = new(); diff --git a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.cs b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.cs index dd5852be5..226a9fbec 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/MockSetupsTests.cs @@ -7,7 +7,7 @@ namespace Mockolate.Internal.Tests.Setup; public partial class MockSetupsTests { - [Fact] + [Test] public async Task EventSetup_ToString_ShouldReturnEventName() { EventSetup setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), @@ -18,17 +18,17 @@ public async Task EventSetup_ToString_ShouldReturnEventName() await That(result).IsEqualTo("SomeEvent"); } - [Theory] - [InlineData(0, 0, 0, 0, "no setups")] - [InlineData(1, 0, 0, 0, "1 method")] - [InlineData(2, 0, 0, 0, "2 methods")] - [InlineData(0, 1, 0, 0, "1 property")] - [InlineData(0, 2, 0, 0, "2 properties")] - [InlineData(0, 0, 1, 0, "1 indexer")] - [InlineData(0, 0, 2, 0, "2 indexers")] - [InlineData(0, 0, 0, 1, "1 event")] - [InlineData(0, 0, 0, 2, "2 events")] - [InlineData(3, 5, 2, 1, "3 methods, 5 properties, 2 indexers, 1 event")] + [Test] + [Arguments(0, 0, 0, 0, "no setups")] + [Arguments(1, 0, 0, 0, "1 method")] + [Arguments(2, 0, 0, 0, "2 methods")] + [Arguments(0, 1, 0, 0, "1 property")] + [Arguments(0, 2, 0, 0, "2 properties")] + [Arguments(0, 0, 1, 0, "1 indexer")] + [Arguments(0, 0, 2, 0, "2 indexers")] + [Arguments(0, 0, 0, 1, "1 event")] + [Arguments(0, 0, 0, 2, "2 events")] + [Arguments(3, 5, 2, 1, "3 methods, 5 properties, 2 indexers, 1 event")] public async Task ToString_ShouldReturnExpectedValue( int methodCount, int propertyCount, int indexerCount, int eventCount, string expected) { @@ -62,7 +62,7 @@ public async Task ToString_ShouldReturnExpectedValue( await That(result).IsEqualTo(expected); } - [Fact] + [Test] public async Task TryGetScenario_WithEmptyName_ShouldReturnTrueAndYieldRootBucket() { MockSetups setups = new(); @@ -73,7 +73,7 @@ public async Task TryGetScenario_WithEmptyName_ShouldReturnTrueAndYieldRootBucke await That(scenario).IsSameAs(setups); } - [Fact] + [Test] public async Task TryGetScenario_WithNullName_ShouldReturnTrueAndYieldRootBucket() { MockSetups setups = new(); diff --git a/Tests/Mockolate.Internal.Tests/Setup/PropertySetupTests.cs b/Tests/Mockolate.Internal.Tests/Setup/PropertySetupTests.cs index d747cd606..0e36345a4 100644 --- a/Tests/Mockolate.Internal.Tests/Setup/PropertySetupTests.cs +++ b/Tests/Mockolate.Internal.Tests/Setup/PropertySetupTests.cs @@ -7,7 +7,7 @@ namespace Mockolate.Internal.Tests.Setup; public sealed class PropertySetupTests { - [Fact] + [Test] public async Task AutoInitializeWith_WhenAlreadyInitialized_ShouldNotOverwriteValue() { FakePropertySetup setup = new("p"); @@ -20,7 +20,7 @@ public async Task AutoInitializeWith_WhenAlreadyInitialized_ShouldNotOverwriteVa await That(value).IsEqualTo(5); } - [Fact] + [Test] public async Task DefaultInvokeGetter_WhenRequestedTypeDiffersFromBackingType_ShouldFallBackToGenerator() { PropertySetup.Default setup = new("p", 0x40400000); @@ -33,7 +33,7 @@ await That(value).IsEqualTo(99f) "the typeof-equality branch must fall through to the defaultValueGenerator; reinterpreting 0x40400000 via Unsafe.As would yield 3.0f instead"); } - [Fact] + [Test] public async Task DefaultInvokeGetter_WhenRequestedTypeIsBoxedSuperType_ShouldReturnStoredValueViaPatternMatch() { PropertySetup.Default setup = new("p", 42); @@ -44,7 +44,7 @@ public async Task DefaultInvokeGetter_WhenRequestedTypeIsBoxedSuperType_ShouldRe await That(value).IsEqualTo(42); } - [Fact] + [Test] public async Task DefaultInvokeGetterFast_WhenRequestedTypeIsBoxedSuperType_ShouldReturnStoredValueViaPatternMatch() { PropertySetup.Default setup = new("p", 42); @@ -54,7 +54,7 @@ public async Task DefaultInvokeGetterFast_WhenRequestedTypeIsBoxedSuperType_Shou await That(value).IsEqualTo(42); } - [Fact] + [Test] public async Task DefaultInvokeGetterFast_WhenStoredValueIsNullReference_ShouldReturnNullViaTypeofFastPath() { PropertySetup.Default setup = new("p", null!); @@ -64,7 +64,7 @@ public async Task DefaultInvokeGetterFast_WhenStoredValueIsNullReference_ShouldR await That(value).IsNull(); } - [Fact] + [Test] public async Task DefaultInvokeSetter_WhenValueIsNullAndUnderlyingTypeIsNullable_ShouldStoreDefault() { PropertySetup.Default setup = new("p", 5); @@ -76,7 +76,7 @@ public async Task DefaultInvokeSetter_WhenValueIsNullAndUnderlyingTypeIsNullable await That(value).IsNull(); } - [Fact] + [Test] public async Task DefaultInvokeSetter_WhenValueIsNullButUnderlyingTypeIsNonNullable_ShouldThrow() { PropertySetup.Default setup = new("p", 5); @@ -91,7 +91,7 @@ await That(Act).Throws() .WithMessage("*int*").AsWildcard(); } - [Fact] + [Test] public async Task DefaultInvokeSetter_WhenValueTypeMismatch_ShouldThrowWithFormattedMessage() { PropertySetup.Default setup = new("p", 5); @@ -106,7 +106,7 @@ await That(Act).Throws() .WithMessage("*'int'*'string'*").AsWildcard(); } - [Fact] + [Test] public async Task PropertySetupInvokeGetter_WhenRequestedTypeIsBoxedSuperType_ShouldReturnStoredValueViaPatternMatch() { PropertySetup setup = new( @@ -119,7 +119,7 @@ public async Task PropertySetupInvokeGetter_WhenRequestedTypeIsBoxedSuperType_Sh await That(value).IsEqualTo(42); } - [Fact] + [Test] public async Task PropertySetupInvokeGetter_WhenStoredValueIsNullReference_ShouldReturnNullViaTypeofFastPath() { PropertySetup setup = new( @@ -131,7 +131,7 @@ public async Task PropertySetupInvokeGetter_WhenStoredValueIsNullReference_Shoul await That(value).IsNull(); } - [Fact] + [Test] public async Task PropertySetupInvokeGetterFast_WhenRequestedTypeIsBoxedSuperType_ShouldReturnStoredValueViaPatternMatch() { PropertySetup setup = new( @@ -143,7 +143,7 @@ public async Task PropertySetupInvokeGetterFast_WhenRequestedTypeIsBoxedSuperTyp await That(value).IsEqualTo(42); } - [Fact] + [Test] public async Task UserInitializeWith_SecondCall_ShouldNotOverwriteValue() { FakePropertySetup setup = new("p"); diff --git a/Tests/Mockolate.Internal.Tests/Usings.cs b/Tests/Mockolate.Internal.Tests/Usings.cs index 1990b88b3..3dfd9d39f 100644 --- a/Tests/Mockolate.Internal.Tests/Usings.cs +++ b/Tests/Mockolate.Internal.Tests/Usings.cs @@ -1,5 +1,4 @@ global using System; global using System.Threading.Tasks; -global using Xunit; global using aweXpect; global using static aweXpect.Expect; diff --git a/Tests/Mockolate.Internal.Tests/Verify/CountSourceTests.cs b/Tests/Mockolate.Internal.Tests/Verify/CountSourceTests.cs index 66da8d288..5b618174e 100644 --- a/Tests/Mockolate.Internal.Tests/Verify/CountSourceTests.cs +++ b/Tests/Mockolate.Internal.Tests/Verify/CountSourceTests.cs @@ -7,7 +7,7 @@ namespace Mockolate.Internal.Tests.Verify; public class CountSourceTests { - [Fact] + [Test] public async Task EventCountSource_Subscribe_Count_IsExercised() { FastMockInteractions store = new(1); @@ -25,7 +25,7 @@ public async Task EventCountSource_Subscribe_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task EventCountSource_Unsubscribe_Count_IsExercised() { FastMockInteractions store = new(1); @@ -44,7 +44,7 @@ public async Task EventCountSource_Unsubscribe_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerGetter1_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -62,7 +62,7 @@ public async Task IndexerGetter1_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerGetter2_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -82,7 +82,7 @@ public async Task IndexerGetter2_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerGetter3_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -104,7 +104,7 @@ public async Task IndexerGetter3_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerGetter4_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -127,7 +127,7 @@ public async Task IndexerGetter4_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerSetter1_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -147,7 +147,7 @@ public async Task IndexerSetter1_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerSetter2_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -169,7 +169,7 @@ public async Task IndexerSetter2_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerSetter3_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -192,7 +192,7 @@ public async Task IndexerSetter3_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task IndexerSetter4_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -216,7 +216,7 @@ public async Task IndexerSetter4_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task Method0_FastPath_Count_AndCountAll_AreExercised() { FastMockInteractions store = new(1); @@ -234,7 +234,7 @@ public async Task Method0_FastPath_Count_AndCountAll_AreExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task Method1_FastPath_Count_AndCountAll_AreExercised() { FastMockInteractions store = new(1); @@ -253,7 +253,7 @@ public async Task Method1_FastPath_Count_AndCountAll_AreExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task Method2_FastPath_Count_AndCountAll_AreExercised() { FastMockInteractions store = new(1); @@ -274,7 +274,7 @@ public async Task Method2_FastPath_Count_AndCountAll_AreExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task Method3_FastPath_Count_AndCountAll_AreExercised() { FastMockInteractions store = new(1); @@ -300,7 +300,7 @@ public async Task Method3_FastPath_Count_AndCountAll_AreExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task Method4_FastPath_Count_AndCountAll_AreExercised() { FastMockInteractions store = new(1); @@ -328,7 +328,7 @@ public async Task Method4_FastPath_Count_AndCountAll_AreExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task PropertyGetter_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); @@ -344,7 +344,7 @@ public async Task PropertyGetter_FastPath_Count_IsExercised() await That(true).IsTrue(); } - [Fact] + [Test] public async Task PropertySetter_FastPath_Count_IsExercised() { FastMockInteractions store = new(1); diff --git a/Tests/Mockolate.Internal.Tests/Verify/MethodCountSourcesTests.cs b/Tests/Mockolate.Internal.Tests/Verify/MethodCountSourcesTests.cs index 8f7d5b938..baf89c235 100644 --- a/Tests/Mockolate.Internal.Tests/Verify/MethodCountSourcesTests.cs +++ b/Tests/Mockolate.Internal.Tests/Verify/MethodCountSourcesTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Internal.Tests.Verify; public class MethodCountSourcesTests { - [Fact] + [Test] public async Task EventCountSource_ShouldReturnSubscribeCount() { FastMockInteractions store = new(1); @@ -24,7 +24,7 @@ public async Task EventCountSource_ShouldReturnSubscribeCount() await That(source.Count()).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerGetter1CountSource_ShouldHonorKeyMatcher() { FastMockInteractions store = new(1); @@ -39,7 +39,7 @@ public async Task IndexerGetter1CountSource_ShouldHonorKeyMatcher() await That(source.Count()).IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerGetter2CountSource_ShouldHonorBothMatchers() { FastMockInteractions store = new(1); @@ -56,7 +56,7 @@ public async Task IndexerGetter2CountSource_ShouldHonorBothMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerGetter3CountSource_ShouldHonorAllThreeMatchers() { FastMockInteractions store = new(1); @@ -75,7 +75,7 @@ public async Task IndexerGetter3CountSource_ShouldHonorAllThreeMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerGetter4CountSource_ShouldHonorAllFourMatchers() { FastMockInteractions store = new(1); @@ -95,7 +95,7 @@ public async Task IndexerGetter4CountSource_ShouldHonorAllFourMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerSetter1CountSource_ShouldHonorKeyAndValueMatchers() { FastMockInteractions store = new(1); @@ -112,7 +112,7 @@ public async Task IndexerSetter1CountSource_ShouldHonorKeyAndValueMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerSetter2CountSource_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -131,7 +131,7 @@ public async Task IndexerSetter2CountSource_ShouldHonorAllMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerSetter3CountSource_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -151,7 +151,7 @@ public async Task IndexerSetter3CountSource_ShouldHonorAllMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerSetter4CountSource_ShouldHonorAllMatchers() { FastMockInteractions store = new(1); @@ -172,7 +172,7 @@ public async Task IndexerSetter4CountSource_ShouldHonorAllMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task Method0CountSource_CountAll_ShouldMarkSlotsVerified() { FastMockInteractions store = new(1); @@ -189,7 +189,7 @@ public async Task Method0CountSource_CountAll_ShouldMarkSlotsVerified() await That(dest).IsEmpty(); } - [Fact] + [Test] public async Task Method0CountSource_ShouldRouteCountAndCountAllThroughBuffer() { FastMockInteractions store = new(1); @@ -204,7 +204,7 @@ public async Task Method0CountSource_ShouldRouteCountAndCountAllThroughBuffer() await That(source.Count()).IsEqualTo(2); } - [Fact] + [Test] public async Task Method1CountSource_CountAll_ShouldMarkSlotsVerified() { FastMockInteractions store = new(1); @@ -221,7 +221,7 @@ public async Task Method1CountSource_CountAll_ShouldMarkSlotsVerified() await That(dest).IsEmpty(); } - [Fact] + [Test] public async Task Method1CountSource_ShouldHonorMatcher() { FastMockInteractions store = new(1); @@ -241,7 +241,7 @@ public async Task Method1CountSource_ShouldHonorMatcher() await That(matchNone.Count()).IsEqualTo(0); } - [Fact] + [Test] public async Task Method2CountSource_CountAll_ShouldMarkSlotsVerified() { FastMockInteractions store = new(1); @@ -260,7 +260,7 @@ public async Task Method2CountSource_CountAll_ShouldMarkSlotsVerified() await That(dest).IsEmpty(); } - [Fact] + [Test] public async Task Method2CountSource_ShouldHonorBothMatchers() { FastMockInteractions store = new(1); @@ -278,7 +278,7 @@ public async Task Method2CountSource_ShouldHonorBothMatchers() await That(source.Count()).IsEqualTo(1); } - [Fact] + [Test] public async Task Method3CountSource_CountAll_ShouldMarkSlotsVerified() { FastMockInteractions store = new(1); @@ -298,7 +298,7 @@ public async Task Method3CountSource_CountAll_ShouldMarkSlotsVerified() await That(dest).IsEmpty(); } - [Fact] + [Test] public async Task Method3CountSource_ShouldHonorAllThreeMatchers() { FastMockInteractions store = new(1); @@ -317,7 +317,7 @@ public async Task Method3CountSource_ShouldHonorAllThreeMatchers() await That(source.Count()).IsEqualTo(2); } - [Fact] + [Test] public async Task Method4CountSource_CountAll_ShouldMarkSlotsVerified() { FastMockInteractions store = new(1); @@ -339,7 +339,7 @@ public async Task Method4CountSource_CountAll_ShouldMarkSlotsVerified() await That(dest).IsEmpty(); } - [Fact] + [Test] public async Task Method4CountSource_ShouldHonorAllFourMatchers() { FastMockInteractions store = new(1); @@ -360,7 +360,7 @@ public async Task Method4CountSource_ShouldHonorAllFourMatchers() await That(source.Count()).IsEqualTo(2); } - [Fact] + [Test] public async Task PropertyGetterCountSource_ShouldReturnRecordedCount() { FastMockInteractions store = new(1); @@ -375,7 +375,7 @@ public async Task PropertyGetterCountSource_ShouldReturnRecordedCount() await That(source.Count()).IsEqualTo(3); } - [Fact] + [Test] public async Task PropertySetterCountSource_ShouldHonorValueMatcher() { FastMockInteractions store = new(1); diff --git a/Tests/Mockolate.Internal.Tests/Verify/TypedVerifyFastPathTests.cs b/Tests/Mockolate.Internal.Tests/Verify/TypedVerifyFastPathTests.cs index b3db8ce09..c71ac4b22 100644 --- a/Tests/Mockolate.Internal.Tests/Verify/TypedVerifyFastPathTests.cs +++ b/Tests/Mockolate.Internal.Tests/Verify/TypedVerifyFastPathTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Internal.Tests.Verify; public class TypedVerifyFastPathTests { - [Fact] + [Test] public async Task IndexerGot_WithMemberIdAndBuffer_CountsBufferEntriesAndProducesExpectation() { FastMockInteractions store = new(1); @@ -28,7 +28,7 @@ public async Task IndexerGot_WithMemberIdAndBuffer_CountsBufferEntriesAndProduce await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task IndexerGot_WithMemberIdAndInstalledBuffer_OnlyWalksBuffer() { FastMockInteractions store = new(1); @@ -47,7 +47,7 @@ public async Task IndexerGot_WithMemberIdAndInstalledBuffer_OnlyWalksBuffer() await That(((IVerificationResult)result).Verify(arr => arr.Length == 0)).IsTrue(); } - [Fact] + [Test] public async Task IndexerGot_WithoutBuffer_ProducesParametersDescriptionInExpectation() { FastMockInteractions store = new(0); @@ -61,7 +61,7 @@ public async Task IndexerGot_WithoutBuffer_ProducesParametersDescriptionInExpect await That(((IVerificationResult)result).Expectation).IsEqualTo("got indexer (5)"); } - [Fact] + [Test] public async Task IndexerGotTyped_WithBuffer_ProducesParametersDescriptionInExpectation() { FastMockInteractions store = new(1); @@ -77,7 +77,7 @@ public async Task IndexerGotTyped_WithBuffer_ProducesParametersDescriptionInExpe await That(((IVerificationResult)result).Expectation).IsEqualTo("got indexer (5)"); } - [Fact] + [Test] public async Task IndexerSet_WithMemberIdAndBuffer_CountsMatchingValuesAndProducesExpectation() { FastMockInteractions store = new(1); @@ -100,7 +100,7 @@ public async Task IndexerSet_WithMemberIdAndBuffer_CountsMatchingValuesAndProduc await That(((IVerificationResult)result).Verify(arr => arr.Length == 1)).IsTrue(); } - [Fact] + [Test] public async Task IndexerSet_WithMemberIdAndInstalledBuffer_OnlyWalksBuffer() { FastMockInteractions store = new(1); @@ -121,7 +121,7 @@ public async Task IndexerSet_WithMemberIdAndInstalledBuffer_OnlyWalksBuffer() await That(((IVerificationResult)result).Verify(arr => arr.Length == 0)).IsTrue(); } - [Fact] + [Test] public async Task IndexerSet_WithoutBuffer_ProducesParametersDescriptionInExpectation() { FastMockInteractions store = new(0); @@ -138,7 +138,7 @@ public async Task IndexerSet_WithoutBuffer_ProducesParametersDescriptionInExpect await That(((IVerificationResult)result).Expectation).Contains(value.ToString()!); } - [Fact] + [Test] public async Task IndexerSetTyped_WithBuffer_ProducesParametersDescriptionInExpectation() { FastMockInteractions store = new(1); @@ -157,7 +157,7 @@ public async Task IndexerSetTyped_WithBuffer_ProducesParametersDescriptionInExpe await That(((IVerificationResult)result).Expectation).Contains(value.ToString()!); } - [Fact] + [Test] public async Task SubscribedTo_WithMemberIdAndBuffer_CountsBufferEntriesAndProducesExpectation() { FastMockInteractions store = new(1); @@ -175,7 +175,7 @@ public async Task SubscribedTo_WithMemberIdAndBuffer_CountsBufferEntriesAndProdu await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task SubscribedTo_WithMemberIdButNoBuffer_FallsBackAndFiltersByName() { FastMockInteractions store = new(0); @@ -193,7 +193,7 @@ public async Task SubscribedTo_WithMemberIdButNoBuffer_FallsBackAndFiltersByName await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task SubscribedToTyped_WithBuffer_ProducesEventNameInExpectation() { FastMockInteractions store = new(1); @@ -206,7 +206,7 @@ public async Task SubscribedToTyped_WithBuffer_ProducesEventNameInExpectation() await That(((IVerificationResult)result).Expectation).IsEqualTo("subscribed to event OnFoo"); } - [Fact] + [Test] public async Task SubscribedToTyped_WithMemberIdButNoBuffer_FallsBackToStringKeyedPath() { FastMockInteractions store = new(0); @@ -217,7 +217,7 @@ public async Task SubscribedToTyped_WithMemberIdButNoBuffer_FallsBackToStringKey await That(((IVerificationResult)result).Expectation).IsEqualTo("subscribed to event OnFoo"); } - [Fact] + [Test] public async Task TryGetBuffer_WhenBufferReturned_TypedFastPathIgnoresOtherInteractions() { FastMockInteractions store = new(1); @@ -236,7 +236,7 @@ public async Task TryGetBuffer_WhenBufferReturned_TypedFastPathIgnoresOtherInter await That(true).IsTrue(); } - [Fact] + [Test] public async Task UnsubscribedFrom_WithMemberIdAndBuffer_CountsBufferEntriesAndProducesExpectation() { FastMockInteractions store = new(1); @@ -254,7 +254,7 @@ public async Task UnsubscribedFrom_WithMemberIdAndBuffer_CountsBufferEntriesAndP await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task UnsubscribedFrom_WithMemberIdButNoBuffer_FallsBackAndFiltersByName() { FastMockInteractions store = new(0); @@ -272,7 +272,7 @@ public async Task UnsubscribedFrom_WithMemberIdButNoBuffer_FallsBackAndFiltersBy await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task UnsubscribedFromTyped_WithBuffer_ProducesEventNameInExpectation() { FastMockInteractions store = new(1); @@ -285,7 +285,7 @@ public async Task UnsubscribedFromTyped_WithBuffer_ProducesEventNameInExpectatio await That(((IVerificationResult)result).Expectation).IsEqualTo("unsubscribed from event OnFoo"); } - [Fact] + [Test] public async Task UnsubscribedFromTyped_WithMemberIdButNoBuffer_FallsBackToStringKeyedPath() { FastMockInteractions store = new(0); @@ -296,7 +296,7 @@ public async Task UnsubscribedFromTyped_WithMemberIdButNoBuffer_FallsBackToStrin await That(((IVerificationResult)result).Expectation).IsEqualTo("unsubscribed from event OnFoo"); } - [Fact] + [Test] public async Task UnsubscribedFromTyped_WithMemberIdButNonMatchingBufferKind_FallsBackToStringKeyedPath() { FastMockInteractions store = new(1); @@ -309,7 +309,7 @@ public async Task UnsubscribedFromTyped_WithMemberIdButNonMatchingBufferKind_Fal } - [Fact] + [Test] public async Task VerifyMethod0_TypedFastPath_ShouldCount() { FastMockInteractions store = new(1); @@ -326,7 +326,7 @@ public async Task VerifyMethod0_TypedFastPath_ShouldCount() await That(true).IsTrue(); } - [Fact] + [Test] public async Task VerifyMethod0_WithMemberIdButNoMatchingBuffer_FallbackPredicateMatchesAllMethodInteractions() { FastMockInteractions store = new(0); @@ -343,7 +343,7 @@ public async Task VerifyMethod0_WithMemberIdButNoMatchingBuffer_FallbackPredicat await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task VerifyMethod1_TypedFastPath_FailsWithExpectedMessage() { FastMockInteractions store = new(1); @@ -360,7 +360,7 @@ await That(() => registry.VerifyMethod(new object(), 0, "Foo", .Throws(); } - [Fact] + [Test] public async Task VerifyMethod1_TypedFastPath_ShouldHonorMatcher() { FastMockInteractions store = new(1); @@ -381,7 +381,7 @@ public async Task VerifyMethod1_TypedFastPath_ShouldHonorMatcher() await That(true).IsTrue(); } - [Fact] + [Test] public async Task VerifyMethod2_TypedFastPath_AnyParameters_UsesCountAll() { FastMockInteractions store = new(1); @@ -407,7 +407,7 @@ public async Task VerifyMethod2_TypedFastPath_AnyParameters_UsesCountAll() await That(true).IsTrue(); } - [Fact] + [Test] public async Task VerifyMethod3_FallbackPath_RequiresAllParametersToMatch() { FastMockInteractions store = new(0); @@ -429,7 +429,7 @@ public async Task VerifyMethod3_FallbackPath_RequiresAllParametersToMatch() await That(((IVerificationResult)result).Verify(arr => arr.Length == 1)).IsTrue(); } - [Fact] + [Test] public async Task VerifyMethod4_FallbackPath_RequiresAllParametersToMatch() { FastMockInteractions store = new(0); @@ -453,7 +453,7 @@ public async Task VerifyMethod4_FallbackPath_RequiresAllParametersToMatch() await That(((IVerificationResult)result).Verify(arr => arr.Length == 1)).IsTrue(); } - [Fact] + [Test] public async Task VerifyProperty_GetterWithMemberIdAndBuffer_CountsBufferEntriesAndProducesExpectation() { FastMockInteractions store = new(1); @@ -468,7 +468,7 @@ public async Task VerifyProperty_GetterWithMemberIdAndBuffer_CountsBufferEntries await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task VerifyProperty_SetterWithMemberIdAndBuffer_CountsMatchingValuesAndProducesExpectation() { FastMockInteractions store = new(1); @@ -487,7 +487,7 @@ public async Task VerifyProperty_SetterWithMemberIdAndBuffer_CountsMatchingValue await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task VerifyProperty_WithMemberIdButNoBuffer_FallbackPredicateFiltersByName() { FastMockInteractions store = new(0); @@ -503,7 +503,7 @@ public async Task VerifyProperty_WithMemberIdButNoBuffer_FallbackPredicateFilter await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task VerifyProperty_WithMemberIdButNoBuffer_FallsBackToStringKeyedPath() { FastMockInteractions store = new(0); @@ -519,7 +519,7 @@ public async Task VerifyProperty_WithMemberIdButNoBuffer_FallsBackToStringKeyedP ((IVerificationResult)result).Verify(arr => arr.Length == 2); } - [Fact] + [Test] public async Task VerifyPropertySetter_WithMemberIdButNoBuffer_FallbackPredicateFiltersByName() { FastMockInteractions store = new(0); @@ -536,7 +536,7 @@ public async Task VerifyPropertySetter_WithMemberIdButNoBuffer_FallbackPredicate await That(((IVerificationResult)result).Verify(arr => arr.Length == 2)).IsTrue(); } - [Fact] + [Test] public async Task VerifyPropertySetter_WithMemberIdButNoBuffer_FallsBackToStringKeyedPath() { FastMockInteractions store = new(0); @@ -553,7 +553,7 @@ public async Task VerifyPropertySetter_WithMemberIdButNoBuffer_FallsBackToString ((IVerificationResult)result).Verify(arr => arr.Length == 2); } - [Fact] + [Test] public async Task VerifyPropertyTyped_Getter_WithBuffer_ProducesPropertyNameInExpectation() { FastMockInteractions store = new(1); @@ -565,7 +565,7 @@ public async Task VerifyPropertyTyped_Getter_WithBuffer_ProducesPropertyNameInEx await That(((IVerificationResult)result).Expectation).IsEqualTo("got property P"); } - [Fact] + [Test] public async Task VerifyPropertyTyped_Setter_WithBuffer_ProducesPropertyNameInExpectation() { FastMockInteractions store = new(1); diff --git a/Tests/Mockolate.Internal.Tests/Verify/VerificationResultTests.cs b/Tests/Mockolate.Internal.Tests/Verify/VerificationResultTests.cs index c184fa898..796b8d96e 100644 --- a/Tests/Mockolate.Internal.Tests/Verify/VerificationResultTests.cs +++ b/Tests/Mockolate.Internal.Tests/Verify/VerificationResultTests.cs @@ -19,7 +19,7 @@ private static FastMethod1Buffer InstallMethod(FastMockInteractions store, public sealed class AwaitableTests { - [Fact] + [Test] public async Task Verify_WhenPredicateNeverSatisfies_ShouldTimeOut() { FastMockInteractions store = new(0); @@ -39,7 +39,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VerifyCount_WhenPredicateNeverSatisfies_ShouldTimeOut() { FastMockInteractions store = new(1); @@ -56,7 +56,7 @@ await That(Act).Throws() .WithMessage("*timed out*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyCount_WithUseCountAll_ShouldPickCountAllNotFilteredCount() { // Pins the `_useCountAll ? CountAll() : Count()` conditional in Awaitable.VerifyCount. @@ -88,7 +88,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task WithCancellation_PreservesUseCountAllFlag() { FastMockInteractions store = new(1); @@ -114,7 +114,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Within_PreservesUseCountAllFlag() { FastMockInteractions store = new(1); @@ -143,7 +143,7 @@ void Act() public sealed class MapTests { - [Fact] + [Test] public async Task Map_WhenBufferAndFastSourceBothNull_DropsToSimpleConstructor() { // Mirrors the buffer-only case from the other side: with neither buffer nor source, the @@ -165,7 +165,7 @@ public async Task Map_WhenBufferAndFastSourceBothNull_DropsToSimpleConstructor() await That(fastSourceField.GetValue(mapped)).IsNull(); } - [Fact] + [Test] public async Task Map_WhenBufferOnlyAndFastSourceNull_PreservesBuffer() { // The buffer-only IgnoreParameters constructor is wired with no fast source. Map must @@ -198,7 +198,7 @@ public async Task Map_WhenBufferOnlyAndFastSourceNull_PreservesBuffer() await That(observedLength).IsEqualTo(2); } - [Fact] + [Test] public async Task Map_WithBuffer_PreservesFastPathSource() { FastMockInteractions store = new(1); @@ -225,7 +225,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Map_WithoutBuffer_StillCarriesPredicate() { FastMockInteractions store = new(0); @@ -244,7 +244,7 @@ public async Task Map_WithoutBuffer_StillCarriesPredicate() public sealed class CollectMatchingTests { - [Fact] + [Test] public async Task WithBufferAndExactlyTwoRecords_PreservesSequenceOrder() { // Crosses the `records.Count > 1` boundary in CollectMatching at exactly N=2. Combined @@ -276,7 +276,7 @@ public async Task WithBufferAndExactlyTwoRecords_PreservesSequenceOrder() await That(values).IsEqualTo([10, 20,]); } - [Fact] + [Test] public async Task WithBufferAndMultipleRecords_PreservesSequenceOrder() { FastMockInteractions store = new(1); @@ -305,7 +305,7 @@ public async Task WithBufferAndMultipleRecords_PreservesSequenceOrder() await That(values).IsEqualTo([10, 20, 30,]); } - [Fact] + [Test] public async Task WithBufferAndNoMatchingRecord_ReturnsEmpty() { FastMockInteractions store = new(1); @@ -328,7 +328,7 @@ public async Task WithBufferAndNoMatchingRecord_ReturnsEmpty() await That(observed).IsEqualTo(0); } - [Fact] + [Test] public async Task WithBufferAndSingleRecord_ReturnsRecord() { FastMockInteractions store = new(1); @@ -351,7 +351,7 @@ public async Task WithBufferAndSingleRecord_ReturnsRecord() await That(observed).IsEqualTo(1); } - [Fact] + [Test] public async Task WithEmptyBuffer_ReturnsEmpty() { FastMockInteractions store = new(1); @@ -375,7 +375,7 @@ public async Task WithEmptyBuffer_ReturnsEmpty() public sealed class SkipInteractionRecordingTests { - [Fact] + [Test] public async Task Verify_WhenRecordingDisabled_AndAwaitableViaWithin_ShouldThrowMockException() { // Same guard, Awaitable Verify (records-array) path. Constructed with a predicate-based @@ -395,7 +395,7 @@ await That(Act).Throws() .WithMessage("*recording is disabled*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyCount_WhenRecordingDisabled_AndAwaitableViaWithin_ShouldThrowMockException() { // Same guard, Awaitable path (via Within). Distinct mutation site. @@ -416,7 +416,7 @@ await That(Act).Throws() .WithMessage("*recording is disabled*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyCount_WhenRecordingDisabled_ShouldThrowMockException() { // Kills the ThrowIfRecordingDisabled statement-removal mutation on the non-Awaitable @@ -441,7 +441,7 @@ await That(Act).Throws() public sealed class IgnoreParametersAnyParametersTests { - [Fact] + [Test] public async Task AnyParameters_WithoutBuffer_AndNoOverloadFilter_MatchesAllOfMethodName() { IMockInteractions store = new FastMockInteractions(0); @@ -466,7 +466,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task AnyParameters_WithoutBuffer_KeepsOverloadFilter() { IMockInteractions store = new FastMockInteractions(0); diff --git a/Tests/Mockolate.Internal.Tests/Web/HttpClientExtensionsTests.cs b/Tests/Mockolate.Internal.Tests/Web/HttpClientExtensionsTests.cs index 1bfea5573..7cbb0548e 100644 --- a/Tests/Mockolate.Internal.Tests/Web/HttpClientExtensionsTests.cs +++ b/Tests/Mockolate.Internal.Tests/Web/HttpClientExtensionsTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Internal.Tests.Web; public class HttpClientExtensionsTests { - [Fact] + [Test] public async Task WhenParameterImplementsIHttpRequestMessagePropertyParameter_ShouldUseThisMatch() { ItExtensions.IHttpContentParameter parameter = ItExtensions.IHttpContentParameter.CreateMock() @@ -31,7 +31,7 @@ await That(parameter.Mock.As>().Verify .Never(); } - [Fact] + [Test] public async Task WithoutMediaTypeHeader_WhenNoneIsRequired_ShouldReturnTrue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -42,7 +42,7 @@ public async Task WithoutMediaTypeHeader_WhenNoneIsRequired_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task WithoutMediaTypeHeader_WhenOneIsRequired_ShouldReturnFalse() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent("*"); diff --git a/Tests/Mockolate.SourceGenerators.Tests/Entities/EventEqualityComparerTests.cs b/Tests/Mockolate.SourceGenerators.Tests/Entities/EventEqualityComparerTests.cs index 0d4517874..b23bd90ed 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Entities/EventEqualityComparerTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Entities/EventEqualityComparerTests.cs @@ -9,14 +9,14 @@ namespace Mockolate.SourceGenerators.Tests.Entities; public class EventEqualityComparerTests { - [Fact] + [Test] public async Task BothNull_ShouldReturnTrue() { await That(Event.EqualityComparer.Equals(null, null)).IsTrue(); await That(Event.ContainingTypeIndependentEqualityComparer.Equals(null, null)).IsTrue(); } - [Fact] + [Test] public async Task ContainingTypeIndependent_DifferentNames_ShouldReturnFalse() { IEqualityComparer comparer = Event.ContainingTypeIndependentEqualityComparer; @@ -30,7 +30,7 @@ public async Task ContainingTypeIndependent_DifferentNames_ShouldReturnFalse() await That(comparer.Equals(e1, e2)).IsFalse(); } - [Fact] + [Test] public async Task ContainingTypeIndependent_SameNameDifferentContainingType_ShouldReturnTrue() { IEqualityComparer comparer = Event.ContainingTypeIndependentEqualityComparer; @@ -44,7 +44,7 @@ public async Task ContainingTypeIndependent_SameNameDifferentContainingType_Shou await That(comparer.Equals(fromC, fromD)).IsTrue(); } - [Fact] + [Test] public async Task EventsWithDifferentContainingType_ShouldReturnFalse() { IEqualityComparer comparer = Event.EqualityComparer; @@ -58,7 +58,7 @@ public async Task EventsWithDifferentContainingType_ShouldReturnFalse() await That(comparer.Equals(fromC, fromD)).IsFalse(); } - [Fact] + [Test] public async Task EventsWithDifferentNames_ShouldReturnFalse() { IEqualityComparer comparer = Event.EqualityComparer; @@ -72,7 +72,7 @@ public async Task EventsWithDifferentNames_ShouldReturnFalse() await That(comparer.Equals(e1, e2)).IsFalse(); } - [Fact] + [Test] public async Task LeftOrRightNull_ShouldReturnFalse() { IEqualityComparer comparer = Event.EqualityComparer; diff --git a/Tests/Mockolate.SourceGenerators.Tests/Entities/MethodEqualityComparerTests.cs b/Tests/Mockolate.SourceGenerators.Tests/Entities/MethodEqualityComparerTests.cs index 9e2fd328c..d9045f17c 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Entities/MethodEqualityComparerTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Entities/MethodEqualityComparerTests.cs @@ -9,7 +9,7 @@ namespace Mockolate.SourceGenerators.Tests.Entities; public class MethodEqualityComparerTests { - [Fact] + [Test] public async Task WhenBothMethodsAreNull_ShouldReturnTrue() { IEqualityComparer comparer = Method.ContainingTypeIndependentEqualityComparer; @@ -19,7 +19,7 @@ public async Task WhenBothMethodsAreNull_ShouldReturnTrue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task WhenLeftMethodIsNull_ShouldReturnFalse() { IEqualityComparer comparer = Method.ContainingTypeIndependentEqualityComparer; @@ -30,7 +30,7 @@ public async Task WhenLeftMethodIsNull_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task WhenMethodsHaveDifferentNames_ShouldReturnFalse() { IEqualityComparer comparer = Method.ContainingTypeIndependentEqualityComparer; @@ -42,7 +42,7 @@ public async Task WhenMethodsHaveDifferentNames_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task WhenMethodsHaveDifferentParameterCount_ShouldReturnFalse() { IEqualityComparer comparer = Method.ContainingTypeIndependentEqualityComparer; @@ -54,7 +54,7 @@ public async Task WhenMethodsHaveDifferentParameterCount_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task WhenRightMethodIsNull_ShouldReturnFalse() { IEqualityComparer comparer = Method.ContainingTypeIndependentEqualityComparer; diff --git a/Tests/Mockolate.SourceGenerators.Tests/Entities/MockClassEqualityTests.cs b/Tests/Mockolate.SourceGenerators.Tests/Entities/MockClassEqualityTests.cs index 2f587c536..a7e14c681 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Entities/MockClassEqualityTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Entities/MockClassEqualityTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.SourceGenerators.Tests.Entities; public class MockClassEqualityTests { - [Fact] + [Test] public async Task ReferenceEqualMockClasses_ShouldBeEqual() { (Compilation compilation, INamedTypeSymbol[] symbols) = ParseSymbols(Source, "IBase"); @@ -19,7 +19,7 @@ public async Task ReferenceEqualMockClasses_ShouldBeEqual() await That(a.Equals(null)).IsFalse(); } - [Fact] + [Test] public async Task TwoMockClassesWithDifferentConstructors_ShouldNotBeEqual() { (Compilation compilation, INamedTypeSymbol[] symbols) = ParseSymbols(Source, @@ -31,7 +31,7 @@ public async Task TwoMockClassesWithDifferentConstructors_ShouldNotBeEqual() await That(a.Equals(b)).IsFalse(); } - [Fact] + [Test] public async Task TwoMockClassesWithSameRootAndSameAdditionals_ShouldBeEqual() { (Compilation compilation, INamedTypeSymbol[] symbols) = ParseSymbols(Source, @@ -44,7 +44,7 @@ public async Task TwoMockClassesWithSameRootAndSameAdditionals_ShouldBeEqual() await That(a.GetHashCode()).IsEqualTo(b.GetHashCode()); } - [Fact] + [Test] public async Task TwoMockClassesWithSameRootButDifferentAdditionals_ShouldNotBeEqual() { (Compilation compilation, INamedTypeSymbol[] symbols) = ParseSymbols(Source, diff --git a/Tests/Mockolate.SourceGenerators.Tests/Entities/PropertyEqualityComparerTests.cs b/Tests/Mockolate.SourceGenerators.Tests/Entities/PropertyEqualityComparerTests.cs index 17dd2c251..e86a876f1 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Entities/PropertyEqualityComparerTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Entities/PropertyEqualityComparerTests.cs @@ -9,14 +9,14 @@ namespace Mockolate.SourceGenerators.Tests.Entities; public class PropertyEqualityComparerTests { - [Fact] + [Test] public async Task BothNull_ShouldReturnTrue() { await That(Property.EqualityComparer.Equals(null, null)).IsTrue(); await That(Property.ContainingTypeIndependentEqualityComparer.Equals(null, null)).IsTrue(); } - [Fact] + [Test] public async Task ContainingTypeIndependent_IndexersWithDifferentArity_ShouldReturnFalse() { IEqualityComparer comparer = Property.ContainingTypeIndependentEqualityComparer; @@ -26,7 +26,7 @@ public async Task ContainingTypeIndependent_IndexersWithDifferentArity_ShouldRet await That(comparer.Equals(arity1, arity2)).IsFalse(); } - [Fact] + [Test] public async Task ContainingTypeIndependent_IndexerVsNonIndexer_ShouldReturnFalse() { IEqualityComparer comparer = Property.ContainingTypeIndependentEqualityComparer; @@ -37,7 +37,7 @@ public async Task ContainingTypeIndependent_IndexerVsNonIndexer_ShouldReturnFals await That(comparer.Equals(nonIndexer, indexer)).IsFalse(); } - [Fact] + [Test] public async Task IndexersWithDifferentArity_ShouldReturnFalse() { IEqualityComparer comparer = Property.EqualityComparer; @@ -47,7 +47,7 @@ public async Task IndexersWithDifferentArity_ShouldReturnFalse() await That(comparer.Equals(arity1, arity2)).IsFalse(); } - [Fact] + [Test] public async Task IndexersWithDifferentContainingType_ShouldReturnFalse() { IEqualityComparer comparer = Property.EqualityComparer; @@ -57,7 +57,7 @@ public async Task IndexersWithDifferentContainingType_ShouldReturnFalse() await That(comparer.Equals(fromC, fromD)).IsFalse(); } - [Fact] + [Test] public async Task IndexerVsNonIndexer_ShouldReturnFalse() { IEqualityComparer comparer = Property.EqualityComparer; @@ -68,7 +68,7 @@ public async Task IndexerVsNonIndexer_ShouldReturnFalse() await That(comparer.Equals(nonIndexer, indexer)).IsFalse(); } - [Fact] + [Test] public async Task NonIndexersWithDifferentContainingType_ShouldReturnFalse() { IEqualityComparer comparer = Property.EqualityComparer; diff --git a/Tests/Mockolate.SourceGenerators.Tests/Entities/TypeIsFormattableTests.cs b/Tests/Mockolate.SourceGenerators.Tests/Entities/TypeIsFormattableTests.cs index f7b1af16b..9d7ebd982 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Entities/TypeIsFormattableTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Entities/TypeIsFormattableTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -8,30 +9,30 @@ namespace Mockolate.SourceGenerators.Tests.Entities; public class TypeIsFormattableTests { - [Fact] - public async Task WhenSymbolIsObject_ShouldNotReportFormattable() + [Test] + public async Task WhenSymbolIsObject_ShouldNotReportFormattable(CancellationToken cancellationToken) { const string source = "public class Holder { public object Value; }"; - SyntaxTree tree = CSharpSyntaxTree.ParseText(source, cancellationToken: TestContext.Current.CancellationToken); + SyntaxTree tree = CSharpSyntaxTree.ParseText(source, cancellationToken: cancellationToken); CSharpCompilation compilation = CSharpCompilation.Create( "TestAssembly", [tree,], [MetadataReference.CreateFromFile(typeof(object).Assembly.Location),], new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); SemanticModel model = compilation.GetSemanticModel(tree); - FieldDeclarationSyntax declaration = tree.GetRoot(TestContext.Current.CancellationToken).DescendantNodes() + FieldDeclarationSyntax declaration = tree.GetRoot(cancellationToken).DescendantNodes() .OfType() .First(); VariableDeclaratorSyntax variable = declaration.Declaration.Variables.Single(); - IFieldSymbol fieldSymbol = (IFieldSymbol)model.GetDeclaredSymbol(variable, TestContext.Current.CancellationToken)!; + IFieldSymbol fieldSymbol = (IFieldSymbol)model.GetDeclaredSymbol(variable, cancellationToken)!; Type type = Type.From(fieldSymbol.Type); await That(type.IsFormattable).IsFalse(); } - [Fact] - public async Task WhenSymbolIsSystemIFormattableItself_ShouldReportFormattable() + [Test] + public async Task WhenSymbolIsSystemIFormattableItself_ShouldReportFormattable(CancellationToken cancellationToken) { // The IsFormattable self-check (Type.cs:87-94) handles the case where the symbol IS // System.IFormattable - AllInterfaces excludes the type itself, so the explicit @@ -43,7 +44,7 @@ public class Holder public IFormattable Value; } """; - SyntaxTree tree = CSharpSyntaxTree.ParseText(source, cancellationToken: TestContext.Current.CancellationToken); + SyntaxTree tree = CSharpSyntaxTree.ParseText(source, cancellationToken: cancellationToken); CSharpCompilation compilation = CSharpCompilation.Create( "TestAssembly", [tree,], @@ -53,11 +54,11 @@ public class Holder ], new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); SemanticModel model = compilation.GetSemanticModel(tree); - FieldDeclarationSyntax declaration = tree.GetRoot(TestContext.Current.CancellationToken).DescendantNodes() + FieldDeclarationSyntax declaration = tree.GetRoot(cancellationToken).DescendantNodes() .OfType() .First(); VariableDeclaratorSyntax variable = declaration.Declaration.Variables.Single(); - IFieldSymbol fieldSymbol = (IFieldSymbol)model.GetDeclaredSymbol(variable, TestContext.Current.CancellationToken)!; + IFieldSymbol fieldSymbol = (IFieldSymbol)model.GetDeclaredSymbol(variable, cancellationToken)!; ITypeSymbol typeSymbol = fieldSymbol.Type; Type type = Type.From(typeSymbol); diff --git a/Tests/Mockolate.SourceGenerators.Tests/GeneralTests.cs b/Tests/Mockolate.SourceGenerators.Tests/GeneralTests.cs index 4b9b4e91b..b8271f434 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/GeneralTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/GeneralTests.cs @@ -9,7 +9,7 @@ namespace Mockolate.SourceGenerators.Tests; public class GeneralTests { - [Fact] + [Test] public async Task AllGeneratedSourcesShouldContainAutoGeneratedTag() { GeneratorResult result = Generator @@ -53,7 +53,7 @@ await That(result.Sources.Values).All() .Satisfy(x => x!.Contains("") && x.Contains("")); } - [Fact] + [Test] public async Task Constructor_WithRegistrationsParameter_ShouldRenameAdditionalParameter() { GeneratorResult result = Generator @@ -93,7 +93,7 @@ public MyClass(global::Mockolate.MockRegistry mockRegistry_1, int mockRegistry) """); } - [Fact] + [Test] public async Task InterfaceProperty_ShouldNotRecursivelyCreateMocks() { GeneratorResult result = Generator @@ -135,7 +135,7 @@ await That(result.Sources) .DoesNotContainKey("Mock.IMyInterface3.g.cs"); } - [Fact] + [Test] public async Task MockOfGenericTypes_ShouldHandleSpecialGenericParameters() { GeneratorResult result = Generator @@ -223,7 +223,7 @@ await That(result.Sources["Mock.IMyInterface_decimal.g.cs"]) .Contains("public global::System.Collections.Generic.IEnumerable MyEnumerable"); } - [Fact] + [Test] public async Task MockOfHttpMessageHandler_ShouldContainGetEnumeratorFromIEnumerableAndIEnumerableOfT() { GeneratorResult result = Generator @@ -250,7 +250,7 @@ await That(result.Sources["Mock.HttpMessageHandler.g.cs"]) .DoesNotContain("void Dispose()"); } - [Fact] + [Test] public async Task MockOfIList_ShouldContainGetEnumeratorFromIEnumerableAndIEnumerableOfT() { GeneratorResult result = Generator @@ -277,7 +277,7 @@ await That(result.Sources["Mock.IList_int.g.cs"]) .Contains("public global::System.Collections.Generic.IEnumerator GetEnumerator()"); } - [Fact] + [Test] public async Task MockOfIList_ShouldIncludeFullNameAsGenericParameter() { GeneratorResult result = Generator @@ -311,7 +311,7 @@ internal class IList_MyRecord : """); } - [Fact] + [Test] public async Task MockOfTypesWithGenericTypes_ShouldHandleSpecialGenericParameters() { GeneratorResult result = Generator @@ -371,7 +371,7 @@ await That(result.Sources["Mock.IMyInterface.g.cs"]) .Contains("public global::System.Collections.Generic.IEnumerable EnumerableOfDecimal"); } - [Fact] + [Test] public async Task MultipleInterfacesWithSameName_ShouldAddSuffixToSetupAndVerifyMethods() { GeneratorResult result = Generator @@ -424,7 +424,7 @@ await That(result.Sources).ContainsKey("Mock.IMyInterface__IMyInterface__IMyInte .Contains("global::MyCode.N2.IMyInterface, IMockForIMyInterface_2, IMockSetupForIMyInterface_2, IMockVerifyForIMyInterface_2"); } - [Fact] + [Test] public async Task ObsoleteAttributes_ShouldBeRepeatedInMock() { GeneratorResult result = Generator @@ -505,7 +505,7 @@ public override int SomeMethod() """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task SameMethodInMultipleInterfaces_ShouldUseExplicitImplementation() { GeneratorResult result = Generator @@ -545,7 +545,7 @@ await That(result.Sources["Mock.IMyInterface1__IMyInterface2.g.cs"]) .Contains("void global::MyCode.IMyInterface2.MyMethod(int v1)"); } - [Fact] + [Test] public async Task SameMethodInNestedInterfaces_ShouldUseExplicitImplementation() { GeneratorResult result = Generator @@ -584,7 +584,7 @@ await That(result.Sources["Mock.IMyInterface1.g.cs"]) .Contains("void global::MyCode.IMyInterface2.MyMethod(int v1)"); } - [Fact] + [Test] public async Task WhenClassHasFieldNamedMockRegistry_ShouldFallBackToAlternative() { GeneratorResult result = Generator @@ -618,7 +618,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) "a mock subclass declaring a property `MockRegistry` would hide the inherited field (CS0108), so the dedup pipeline must skip past the conflicting member name"); } - [Fact] + [Test] public async Task WhenClassHasNestedTypeNamedMockRegistry_ShouldFallBackToAlternative() { GeneratorResult result = Generator @@ -650,7 +650,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenInterfaceHasMethodNamedMock_ExtensionMockPropertyShouldBeRenamed() { GeneratorResult result = Generator @@ -681,7 +681,7 @@ await That(result.Sources["Mock.IMyInterface.g.cs"]) "`Mock` is a method on the type, so the extension `Mock` property would shadow access and CreateUniquePropertyName must skip past it to a Mockolate_-prefixed alternative"); } - [Fact] + [Test] public async Task WhenInterfaceHasMockAndMockolate_MockProperties_ShouldUseMockolate_Mock__1ForMockAccessProperty() { GeneratorResult result = Generator @@ -711,7 +711,7 @@ await That(result.Sources["Mock.IMyInterface.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenInterfaceHasMockMockolate_MockAndMockolate_Mock__1Properties_ShouldUseMockolate_Mock__2() { GeneratorResult result = Generator @@ -742,7 +742,7 @@ await That(result.Sources["Mock.IMyInterface.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenInterfaceMembersOccupyAllMockRegistryNameCandidates_ShouldUseMockRegistry_2() { GeneratorResult result = Generator @@ -776,7 +776,7 @@ await That(result.Sources["Mock.IMyInterface.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WithAttributes_ShouldAddAttributesToGeneratedCode() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/IndexerSetupsTests.cs b/Tests/Mockolate.SourceGenerators.Tests/IndexerSetupsTests.cs index efa2477e3..7f3a1c9e5 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/IndexerSetupsTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/IndexerSetupsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.SourceGenerators.Tests; public sealed class IndexerSetupsTests { - [Fact] + [Test] public async Task GenerateIndexerSetupsForIndexersWithMoreParameters() { GeneratorResult result = Generator @@ -37,7 +37,7 @@ await That(result.Sources["IndexerSetups.g.cs"]) "internal class IndexerSetup(global::Mockolate.MockRegistry mockRegistry, global::Mockolate.Parameters.IParameterMatch parameter1, global::Mockolate.Parameters.IParameterMatch parameter2, global::Mockolate.Parameters.IParameterMatch parameter3, global::Mockolate.Parameters.IParameterMatch parameter4, global::Mockolate.Parameters.IParameterMatch parameter5) : global::Mockolate.Setup.IndexerSetup(mockRegistry)"); } - [Fact] + [Test] public async Task WhenAllIndexersHaveUpTo4Parameters_ShouldNotGenerateIndexerSetups() { GeneratorResult result = Generator @@ -70,7 +70,7 @@ public interface IMyInterface await That(result.Sources).DoesNotContainKey("IndexerSetups.g.cs"); } - [Fact] + [Test] public async Task WithComplexIndexer_ShouldOnlyGenerateNecessaryExtensions() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MethodSetupsTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MethodSetupsTests.cs index b2e438c67..9673b09a6 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MethodSetupsTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MethodSetupsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.SourceGenerators.Tests; public sealed class MethodSetupsTests { - [Fact] + [Test] public async Task GenerateMethodSetupsForMethodsWithMoreParameters() { GeneratorResult result = Generator @@ -43,7 +43,7 @@ await That(result.Sources["MethodSetups.g.cs"]) "internal abstract class VoidMethodSetup : global::Mockolate.Setup.MethodSetup"); } - [Fact] + [Test] public async Task WhenAllMethodsHaveUpTo4Parameters_ShouldNotGenerateMethodSetups() { GeneratorResult result = Generator @@ -74,8 +74,8 @@ public interface IMyInterface await That(result.Sources).DoesNotContainKey("MethodSetups.g.cs"); } - [Theory] - [InlineData( + [Test] + [Arguments( """ string ToString(); bool Equals(object? obj); @@ -84,43 +84,43 @@ public interface IMyInterface "public override string ToString()", "public override int GetHashCode()", "public override bool Equals(object? obj)")] - [InlineData( + [Arguments( """ bool Equals(object obj); int GetHashCode(); """, "public override bool Equals(object obj)", "public override int GetHashCode()")] - [InlineData( + [Arguments( """ string ToString(); int GetHashCode(); """, "public override string ToString()", "public override int GetHashCode()")] - [InlineData( + [Arguments( """ string ToString(); bool Equals(object obj); """, "public override string ToString()", "public override bool Equals(object obj)")] - [InlineData( + [Arguments( """ string ToString(); """, "public override string ToString()")] - [InlineData( + [Arguments( """ bool Equals(object obj); """, "public override bool Equals(object obj)")] - [InlineData( + [Arguments( """ bool Equals(object? obj); """, "public override bool Equals(object? obj)")] - [InlineData( + [Arguments( """ int GetHashCode(); """, @@ -156,7 +156,7 @@ public interface IMyInterface } } - [Fact] + [Test] public async Task WithComplexMethodReturningAValue_ShouldOnlyGenerateNecessaryExtensions() { GeneratorResult result = Generator @@ -191,7 +191,7 @@ await That(result.Sources["MethodSetups.g.cs"]) .DoesNotContain("class ReturnMethodSetup"); } - [Fact] + [Test] public async Task WithComplexMethodReturningVoid_ShouldOnlyGenerateNecessaryExtensions() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockBehaviorExtensionsTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockBehaviorExtensionsTests.cs index 4e52b8c4a..602b184fc 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockBehaviorExtensionsTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockBehaviorExtensionsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.SourceGenerators.Tests; public sealed class MockBehaviorExtensionsTests { - [Fact] + [Test] public async Task DefaultValueGenerator_ForValueTuples_ShouldEmitInlineExpressions() { GeneratorResult result = Generator @@ -47,7 +47,7 @@ await That(result.Sources["MockBehaviorExtensions.g.cs"]) .DoesNotContain("Generate"); } - [Fact] + [Test] public async Task DefaultValueGenerator_ShouldRegisterArrays() { GeneratorResult result = Generator @@ -94,7 +94,7 @@ public T[] Generate(T[] nullValue, params object?[] parameters) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task DefaultValueGenerator_ShouldRegisterIEnumerables() { GeneratorResult result = Generator @@ -134,7 +134,7 @@ await That(result.Sources["MockBehaviorExtensions.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task DefaultValueGenerator_ShouldRegisterTasks() { GeneratorResult result = Generator @@ -180,7 +180,7 @@ await That(result.Sources["MockBehaviorExtensions.g.cs"]) .DoesNotContain("global::System.Func"); } - [Fact] + [Test] public async Task DefaultValueGenerator_ShouldRegisterValueTasks() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.AggregationTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.AggregationTests.cs index 412de3474..13a09040c 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.AggregationTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.AggregationTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.SourceGenerators.Tests; public sealed class MockGeneratorAggregationTests { - [Fact] + [Test] public async Task AllVoidMethods_ShouldNotEmitReturnsThrowsAsyncExtensions() { GeneratorResult result = Generator @@ -32,7 +32,7 @@ public interface IService await That(result.Sources).DoesNotContainKey("ReturnsThrowsAsyncExtensions.g.cs"); } - [Fact] + [Test] public async Task AsExtensionsForChainOfTwoAdditionalInterfaces_ShouldEmitBothPairs() { // Implementing().Implementing() must register two pairs in Mock.AsExtensions.g.cs: @@ -68,7 +68,7 @@ await That(result.Sources["Mock.AsExtensions.g.cs"]) .Contains("internal static partial class MockExtensionsForIA"); } - [Fact] + [Test] public async Task HttpClientMock_ShouldEmitHttpResponseMessageFactoryInBehaviorExtensions() { GeneratorResult result = Generator @@ -93,7 +93,7 @@ await That(result.Sources["MockBehaviorExtensions.g.cs"]) .Contains("new HttpResponseMessageFactory(global::System.Net.HttpStatusCode.NotImplemented)"); } - [Fact] + [Test] public async Task NonHttpClientMock_ShouldNotEmitHttpResponseMessageFactoryInBehaviorExtensions() { GeneratorResult result = Generator @@ -121,7 +121,7 @@ await That(result.Sources["MockBehaviorExtensions.g.cs"]) .DoesNotContain("HttpResponseMessageFactory"); } - [Fact] + [Test] public async Task NonVoidMethodWithArity5_ShouldEmitReturnsThrowsAsyncExtensions() { GeneratorResult result = Generator @@ -147,7 +147,7 @@ public interface IService await That(result.Sources).ContainsKey("ReturnsThrowsAsyncExtensions.g.cs"); } - [Fact] + [Test] public async Task SameRootWithDifferentAdditionalImplementations_ShouldEmitBothCombinations() { // Two MockClass entries have identical ClassFullName (IBase) but different @@ -179,7 +179,7 @@ await That(result.Sources) .ContainsKey("Mock.IBase__IExtraB.g.cs"); } - [Fact] + [Test] public async Task TwoCombinationsWithCollidingCombinedName_ShouldSuffixSecondCombination() { // Each combination resolves to combinedName "IBase__IExtra" because GetClassNameWithoutDots diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.EqualityTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.EqualityTests.cs index 937bb2255..dc58b8bbb 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.EqualityTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockGenerator.EqualityTests.cs @@ -14,7 +14,7 @@ public sealed class MockGeneratorEqualityTests { public sealed class RefStructAggregateTests { - [Fact] + [Test] public async Task Equals_WithDifferentType_IsFalse() { RefStructAggregate a = new( @@ -25,7 +25,7 @@ public async Task Equals_WithDifferentType_IsFalse() await That(a.Equals("not an aggregate")).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithDifferingIndexerSetups_IsFalse() { RefStructAggregate a = new( @@ -38,7 +38,7 @@ public async Task Equals_WithDifferingIndexerSetups_IsFalse() await That(a.Equals(b)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithDifferingMethodSetups_IsFalse() { RefStructAggregate a = new( @@ -52,7 +52,7 @@ public async Task Equals_WithDifferingMethodSetups_IsFalse() await That(a.Equals((object)b)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithEqualMethodAndIndexerSetups_IsTrue() { RefStructAggregate a = new( @@ -67,7 +67,7 @@ public async Task Equals_WithEqualMethodAndIndexerSetups_IsTrue() await That(a.GetHashCode()).IsEqualTo(b.GetHashCode()); } - [Fact] + [Test] public async Task Equals_WithNull_IsFalse() { RefStructAggregate a = new( @@ -81,7 +81,7 @@ public async Task Equals_WithNull_IsFalse() public sealed class NamedMockTests { - [Fact] + [Test] public async Task Equals_WhenAdditionalClassesDiffer_IsFalse() { MockClass mc = CreateMockClass(); @@ -93,7 +93,7 @@ public async Task Equals_WhenAdditionalClassesDiffer_IsFalse() await That(a.Equals(b)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WhenAdditionalClassesPresentOnOneAndNullOnOther_IsFalse() { MockClass mc = CreateMockClass(); @@ -105,7 +105,7 @@ public async Task Equals_WhenAdditionalClassesPresentOnOneAndNullOnOther_IsFalse await That(withNull.Equals(withAdditional)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WhenBothAdditionalClassesNull_IsTrue() { MockClass mc = CreateMockClass(); @@ -115,7 +115,7 @@ public async Task Equals_WhenBothAdditionalClassesNull_IsTrue() await That(a.Equals(b)).IsTrue(); } - [Fact] + [Test] public async Task Equals_WithDifferentFileName_IsFalse() { MockClass mc = CreateMockClass(); @@ -125,7 +125,7 @@ public async Task Equals_WithDifferentFileName_IsFalse() await That(a.Equals(b)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithDifferentMockClass_IsFalse() { MockClass mcA = CreateMockClass(); @@ -138,7 +138,7 @@ public async Task Equals_WithDifferentMockClass_IsFalse() await That(a.Equals(b)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithDifferentParentName_IsFalse() { MockClass mc = CreateMockClass(); @@ -148,7 +148,7 @@ public async Task Equals_WithDifferentParentName_IsFalse() await That(a.Equals(b)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithIdenticalNamedMock_IsTrue() { MockClass mc = CreateMockClass(); @@ -160,7 +160,7 @@ public async Task Equals_WithIdenticalNamedMock_IsTrue() await That(a.GetHashCode()).IsEqualTo(b.GetHashCode()); } - [Fact] + [Test] public async Task Equals_WithNullOther_IsFalse() { MockClass mc = CreateMockClass(); @@ -170,7 +170,7 @@ public async Task Equals_WithNullOther_IsFalse() await That(a!.Equals((object?)null)).IsFalse(); } - [Fact] + [Test] public async Task GetHashCode_IncludesAdditionalClasses() { MockClass mc = CreateMockClass(); diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockGeneratorTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockGeneratorTests.cs index 13fa5061b..ea6b81863 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockGeneratorTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockGeneratorTests.cs @@ -7,7 +7,7 @@ namespace Mockolate.SourceGenerators.Tests; public partial class MockGeneratorTests { - [Fact] + [Test] public async Task SameMethodDifferingOnlyByNullability_ShouldUseExplicitImplementationForConflictingInterface() { GeneratorResult result = Generator @@ -44,7 +44,7 @@ await That(result.Sources["Mock.IInterface1__IInterface2.g.cs"]) .Contains("void global::MyCode.IInterface2.Method(string value)"); } - [Fact] + [Test] public async Task SealedClass_ShouldNotBeIncluded() { GeneratorResult result = Generator @@ -74,7 +74,7 @@ await ThatAll( ); } - [Fact] + [Test] public async Task WhenClassHasConstructorWithParameters_ShouldGenerateTypedCreateMockOverload() { GeneratorResult result = Generator @@ -113,7 +113,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenClassHasMultipleConstructors_ShouldGenerateTypedOverloadPerConstructor() { GeneratorResult result = Generator @@ -147,7 +147,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenClassHasOnlyParameterlessConstructor_ShouldNotEmitAdditionalTypedOverloads() { GeneratorResult result = Generator @@ -176,7 +176,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) "the hand-written parameterless CreateMock() overload is still emitted, and no typed overload is added beyond it"); } - [Fact] + [Test] public async Task WhenConstructorHasCharDefault_ShouldEscapeInTypedOverload() { GeneratorResult result = Generator @@ -206,7 +206,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasDecimalDefault_ShouldAppendMSuffixInTypedOverload() { GeneratorResult result = Generator @@ -236,7 +236,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasEnumDefault_ShouldCastToFullyQualifiedEnumTypeInTypedOverload() { GeneratorResult result = Generator @@ -268,7 +268,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasFloatDefault_ShouldAppendFSuffixInTypedOverload() { GeneratorResult result = Generator @@ -298,7 +298,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasInParameter_ShouldNotEmitTypedOverload() { GeneratorResult result = Generator @@ -331,7 +331,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasLongAndDoubleDefaults_ShouldPreserveLiteralsInTypedOverload() { GeneratorResult result = Generator @@ -361,7 +361,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasNullableDecimalDefault_ShouldAppendMSuffixInTypedOverload() { GeneratorResult result = Generator @@ -392,7 +392,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasNullableReferenceDefaultNull_ShouldEmitNullLiteralInTypedOverload() { GeneratorResult result = Generator @@ -423,7 +423,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasRefOrParamsParameter_ShouldNotEmitTypedOverload() { GeneratorResult result = Generator @@ -455,7 +455,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasStringDefaultWithQuotes_ShouldEscapeInTypedOverload() { GeneratorResult result = Generator @@ -485,7 +485,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorHasValueTypeDefaultNull_ShouldEmitDefaultInTypedOverload() { GeneratorResult result = Generator @@ -517,7 +517,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenConstructorParameterIsMockBehavior_ShouldNotEmitAmbiguousTypedOverload() { GeneratorResult result = Generator @@ -547,7 +547,7 @@ await That(matches).IsEqualTo(1) "the hand-written CreateMock(MockBehavior) overload already covers this signature, so a typed single-parameter overload would produce a duplicate definition"); } - [Fact] + [Test] public async Task WhenConstructorParameterIsUnrelatedAction_ShouldEmitTypedOverload() { GeneratorResult result = Generator @@ -581,7 +581,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) "Action does not collide with the setup action type (Action)"); } - [Fact] + [Test] public async Task WhenConstructorParameterTypeIsProtectedInternalNestedType_ShouldEmitConstructor() { GeneratorResult result = Generator @@ -613,7 +613,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .Because("the internal half of `protected internal` is visible within the declaring assembly"); } - [Fact] + [Test] public async Task WhenConstructorParameterTypeIsProtectedNestedType_ShouldNotEmitConstructor() { GeneratorResult result = Generator @@ -647,7 +647,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) "a protected nested type is only reachable through inheritance, so naming it on the generated public constructor (CS0051) or in MockExtensionsForMyService (CS0122) would not compile"); } - [Fact] + [Test] public async Task WhenConstructorParameterTypeIsProtectedNestedTypeArgument_ShouldNotEmitConstructor() { GeneratorResult result = Generator @@ -681,7 +681,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .Because("an inaccessible type is equally unusable when composed into an array or a type argument"); } - [Fact] + [Test] public async Task WhenOnlyConstructorHasProtectedNestedParameterType_ShouldNotGenerateMock() { GeneratorResult result = Generator @@ -709,7 +709,7 @@ await That(result.Sources).DoesNotContainKey("Mock.MyService.g.cs") .Because("no constructor remains that the generated mock could invoke"); } - [Fact] + [Test] public async Task WhenConstructorParameterTypeNestsInProtectedTypeArgumentOfContainingType_ShouldNotEmitConstructor() { GeneratorResult result = Generator @@ -747,7 +747,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) "`Wrapper.Inner` carries the type argument on its containing type, so checking only the innermost type's arguments would let the inaccessible type through"); } - [Fact] + [Test] public async Task WhenConstructorParameterTypeIsInternalInSameAssembly_ShouldEmitConstructor() { GeneratorResult result = Generator @@ -780,7 +780,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .Because("the generated mock lives in the same assembly, so an internal parameter type is nameable"); } - [Fact] + [Test] public async Task WhenVirtualMemberSignatureUsesProtectedNestedType_ShouldNotMockMember() { GeneratorResult result = Generator @@ -819,7 +819,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) "the setup and verify surfaces restate the signature verbatim but do not derive from the mocked type, so a protected nested type would cause CS0122 there"); } - [Fact] + [Test] public async Task WhenVirtualEventTypeUsesProtectedNestedType_ShouldNotMockEvent() { GeneratorResult result = Generator @@ -852,7 +852,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .Because("the raise surface names the delegate type verbatim"); } - [Fact] + [Test] public async Task WhenAbstractMemberSignatureUsesProtectedNestedType_ShouldNotGenerateMock() { GeneratorResult result = Generator @@ -880,12 +880,12 @@ await That(result.Sources).DoesNotContainKey("Mock.MyService.g.cs") .Because("the member must be implemented, but the mock cannot restate its signature"); } - [Theory] - [InlineData("protected abstract void Consume(Configuration configuration);", + [Test] + [Arguments("protected abstract void Consume(Configuration configuration);", "protected override void Consume(Configuration configuration) { }")] - [InlineData("protected abstract Configuration Current { get; set; }", + [Arguments("protected abstract Configuration Current { get; set; }", "protected override Configuration Current { get; set; }")] - [InlineData("protected abstract event Handler Changed;", + [Arguments("protected abstract event Handler Changed;", "protected override event Handler Changed; protected void Fire() => Changed?.Invoke();")] public async Task WhenAbstractMemberWithInaccessibleSignatureIsAlreadyOverridden_ShouldGenerateMock( string baseMember, string derivedOverride) @@ -925,7 +925,7 @@ await That(result.Sources["Mock.Derived.g.cs"]) .DoesNotContain("Handler"); } - [Fact] + [Test] public async Task WhenConstructorsDifferOnlyByNullableValueType_ShouldEmitBothTypedOverloads() { GeneratorResult result = Generator @@ -960,7 +960,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenDerivedClassHasBaseClassConstructorParameters_ShouldEmitTypedOverloadForDerived() { GeneratorResult result = Generator @@ -995,7 +995,7 @@ await That(result.Sources["Mock.DerivedService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenGenericClassHasTypedConstructor_ShouldEmitTypedOverloadForClosedType() { GeneratorResult result = Generator @@ -1027,7 +1027,7 @@ await That(generated) "the mock for the closed generic MyService must carry the typed overload with the substituted type argument"); } - [Fact] + [Test] public async Task WhenImplementingAdditionalClass_ShouldCreateCombinationMock() { GeneratorResult result = Generator @@ -1067,7 +1067,7 @@ await That(result.Sources.Keys).IsEqualTo([ ]).InAnyOrder(); } - [Fact] + [Test] public async Task WhenImplementingAdditionalInterface_WithBaseClassHavingOptionalConstructorParameter_ShouldGenerateTryCastWithDefaultValue() { GeneratorResult result = Generator @@ -1105,7 +1105,7 @@ await That(result.Sources["Mock.MyService__IMyInterface.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenImplementingAdditionalInterface_WithBaseClassHavingRequiredConstructorParameter_ShouldGenerateTryCast() { GeneratorResult result = Generator @@ -1147,7 +1147,7 @@ await That(result.Sources["Mock.MyService__IMyInterface.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task WhenMethodContainsMoreThan16Parameters_ShouldAddCustomAction() { GeneratorResult result = Generator @@ -1183,7 +1183,7 @@ await That(result.Sources["ActionFunc.g.cs"]) "public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17);"); } - [Fact] + [Test] public async Task WhenNamesConflict_ShouldBeDistinguishable() { GeneratorResult result = Generator @@ -1226,7 +1226,7 @@ await ThatAll( ); } - [Fact] + [Test] public async Task WhenNamesConflictForAdditionalClasses_ShouldBeDistinguishable() { GeneratorResult result = Generator @@ -1273,7 +1273,7 @@ await ThatAll( ); } - [Fact] + [Test] public async Task WhenNamesConflictForAdditionalClassesInDifferentNamespaces_ShouldBeDistinguishable() { GeneratorResult result = Generator @@ -1322,7 +1322,7 @@ await ThatAll( ); } - [Fact] + [Test] public async Task WhenOneCtorStartsWithMockBehaviorAndAnotherOmitsIt_ShouldNotEmitDuplicateTypedOverloads() { // Two constructors that could produce the same C# signature after the generator's @@ -1357,7 +1357,7 @@ public MyService(int value) { } await That(matches).IsEqualTo(1); } - [Fact] + [Test] public async Task WhenSameCombinationIsDeclaredTwice_ShouldDeduplicateToSingleEmittedFile() { // Same root mock with the same .Implementing() chain in different call sites must @@ -1390,7 +1390,7 @@ public interface IMyExtra { } await That(combinationKeys).IsEqualTo(["Mock.IMyService__IMyExtra.g.cs",]).InAnyOrder(); } - [Fact] + [Test] public async Task WhenSameMethodInTwoInterfacesDiffersOnlyInRefKind_ShouldUseExplicitImplementation() { // Two interfaces declare a method with the same name and parameter type but different @@ -1430,7 +1430,7 @@ await That(result.Sources["Mock.IInterface1__IInterface2.g.cs"]) .Contains("void global::MyCode.IInterface2.Method(in int value)"); } - [Fact] + [Test] public async Task WhenSameMockIsDeclaredTwice_ShouldDeduplicateToSingleEmittedFile() { // Two identical Mock.Create() declarations must collapse to a single emitted @@ -1465,7 +1465,7 @@ public interface IMyInterface await That(interfaceMockKeys).IsEqualTo(["Mock.IMyInterface.g.cs",]).InAnyOrder(); } - [Fact] + [Test] public async Task WhenSameTypeImplementsDifferentCombinationsOfSameInterface_ShouldGenerateAllCombinations() { GeneratorResult result = Generator @@ -1504,7 +1504,7 @@ await That(result.Sources) .ContainsKey("Mock.IBaseInterface__IAdditionalInterface1.g.cs"); } - [Fact] + [Test] public async Task WhenTypedCreateMockOverloadIsEmitted_ConstructorCrefShouldResolve() { const string expectedCref = "global::MyCode.MyService(int, string)"; @@ -1542,7 +1542,7 @@ await That(crefFailures).IsEmpty() "CS1574/CS1584/CS1658 messages embed the offending cref text, so a cref that resolves cleanly under DocumentationMode.Diagnose is mentioned by no diagnostic"); } - [Fact] + [Test] public async Task WhenTypedCreateMockOverloadIsEmittedForExternalType_ConstructorCrefShouldResolve() { GeneratorResult result = Generator @@ -1574,7 +1574,7 @@ await That(result.Sources["Mock.HttpClient.g.cs"]) await That(crefFailures).IsEmpty(); } - [Fact] + [Test] public async Task WhenTypedCreateMockOverloadIsEmittedForGenericClass_ShouldNotEmitConstructorCref() { GeneratorResult result = Generator @@ -1607,7 +1607,7 @@ await That(result.Sources["Mock.MyService_int.g.cs"]) "closed-generic constructor crefs (e.g. MyService{int}.MyService(int)) aren't valid C# cref syntax, so generic classes fall back to the unlinked phrasing rather than surface CS1584 on the consumer side"); } - [Fact] + [Test] public async Task WhenUsingCreateMockFromNonMockolateNamespace_ShouldNotBeIncluded() { GeneratorResult result = Generator @@ -1648,7 +1648,7 @@ await ThatAll( ); } - [Fact] + [Test] public async Task WhenUsingSetups_ShouldGenerateMocksAndExtensions() { GeneratorResult result = Generator @@ -1678,7 +1678,7 @@ public interface IMyInterface await That(result.Sources).ContainsKey("Mock.IMyInterface.g.cs"); } - [Fact] + [Test] public async Task WithClassAsAdditionalImplementation_ShouldNotThrow() { GeneratorResult result = Generator @@ -1715,7 +1715,7 @@ await That(result.Sources.Keys).IsEqualTo([ ]).InAnyOrder(); } - [Fact] + [Test] public async Task WithHttpClient_ShouldAlsoGenerateMockForHttpMessageHandler() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.EventsTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.EventsTests.cs index 45e4d4544..bb673ca54 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.EventsTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.EventsTests.cs @@ -6,7 +6,7 @@ public sealed partial class ClassTests { public sealed class EventsTests { - [Fact] + [Test] public async Task EventWithRefOutDelegate_ShouldPreserveModifiersOnRaise() { GeneratorResult result = Generator @@ -33,7 +33,7 @@ public interface IMyService await That(result.Diagnostics).IsEmpty(); } - [Fact] + [Test] public async Task MultipleImplementations_ShouldOnlyHaveOneExplicitImplementation() { GeneratorResult result = Generator @@ -73,7 +73,7 @@ await That(result.Sources["Mock.IMyService__IMyServiceBase1__IMyServiceBase2.g.c .Contains("event global::System.EventHandler? global::MyCode.IMyServiceBase2.SomeEvent").Once(); } - [Fact] + [Test] public async Task ShouldGenerateEventSetupInSetupInterface() { GeneratorResult result = Generator @@ -119,7 +119,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementAllEventsFromInterfaces() { GeneratorResult result = Generator @@ -209,7 +209,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementImplicitlyInheritedEvents() { GeneratorResult result = Generator @@ -375,7 +375,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementVirtualEventsOfClassesAndAllExplicitlyFromAdditionalInterfaces() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.IndexerTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.IndexerTests.cs index 0881f16f1..4a232dbad 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.IndexerTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.IndexerTests.cs @@ -6,43 +6,43 @@ public sealed partial class ClassTests { public sealed class IndexerTests { - [Theory] - [InlineData("string this[int key] { get; }", + [Test] + [Arguments("string this[int key] { get; }", "Setup.IIndexerGetterOnlySetup", "Verify.VerificationIndexerGetterResult", "Setup.IndexerSetup", "Verify.VerificationIndexerResult")] - [InlineData("string this[int key] { set; }", + [Arguments("string this[int key] { set; }", "Setup.IIndexerSetterOnlySetup", "Verify.VerificationIndexerSetterResult", "Setup.IndexerSetup", "Verify.VerificationIndexerResult")] - [InlineData("string this[int key] { get; set; }", + [Arguments("string this[int key] { get; set; }", "Setup.IndexerSetup", "Verify.VerificationIndexerResult", "Setup.IIndexerGetterOnlySetup", "Verify.VerificationIndexerGetterResult")] - [InlineData("string this[int key, bool flag] { get; }", + [Arguments("string this[int key, bool flag] { get; }", "Setup.IIndexerGetterOnlySetup", "Verify.VerificationIndexerGetterResult", "Setup.IndexerSetup", "Verify.VerificationIndexerResult")] - [InlineData("string this[int key, bool flag] { set; }", + [Arguments("string this[int key, bool flag] { set; }", "Setup.IIndexerSetterOnlySetup", "Verify.VerificationIndexerSetterResult", "Setup.IndexerSetup", "Verify.VerificationIndexerResult")] - [InlineData("string this[int a, int b, int c, int d, int e] { get; }", + [Arguments("string this[int a, int b, int c, int d, int e] { get; }", "Setup.IIndexerGetterOnlySetup", "Verify.VerificationIndexerGetterResult", "Setup.IndexerSetup", "Verify.VerificationIndexerResult")] - [InlineData("string this[int a, int b, int c, int d, int e] { set; }", + [Arguments("string this[int a, int b, int c, int d, int e] { set; }", "Setup.IIndexerSetterOnlySetup", "Verify.VerificationIndexerSetterResult", "Setup.IndexerSetup", "Verify.VerificationIndexerResult")] - [InlineData("string this[int a, int b, int c, int d, int e] { get; set; }", + [Arguments("string this[int a, int b, int c, int d, int e] { get; set; }", "Setup.IndexerSetup", "Verify.VerificationIndexerResult", "Setup.IIndexerGetterOnlySetup", @@ -79,7 +79,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .Because("a widened facade would silently re-expose an accessor the mock never intercepts"); } - [Fact] + [Test] public async Task InterfaceIndexerWithParameterNamedLikeLocal_ShouldGenerateUniqueLocalVariableName() { GeneratorResult result = Generator @@ -108,7 +108,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task InterfaceIndexerWithParameterNamedWraps_ShouldRenameWrapsCastVariable() { GeneratorResult result = Generator @@ -142,7 +142,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementAllIndexersFromInterfaces() { GeneratorResult result = Generator @@ -315,7 +315,7 @@ public int this[int index] """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementVirtualIndexersOfClassesAndAllExplicitlyFromAdditionalInterfaces() { GeneratorResult result = Generator @@ -470,7 +470,7 @@ public override int this[int index] """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldNotCallBaseForAbstractIndexersOfAbstractClasses() { GeneratorResult result = Generator @@ -502,7 +502,7 @@ await That(result.Sources["Mock.MyAbstractService.g.cs"]) .Because("abstract indexers have no base implementation to call (CS0205)"); } - [Fact] + [Test] public async Task ShouldSupportSpanAndReadOnlySpanIndexerParameters() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.MethodTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.MethodTests.cs index 4c8a931af..38c2aca6c 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.MethodTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.MethodTests.cs @@ -6,7 +6,7 @@ public sealed partial class ClassTests { public sealed class MethodTests { - [Fact] + [Test] public async Task ClassMethodWithParameterNamedWraps_ShouldRenameWrapsCastVariable() { GeneratorResult result = Generator @@ -43,7 +43,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .Because("the forwarding call must use the deduped name, not the parameter"); } - [Fact] + [Test] public async Task ExplicitInterfaceImplementation_WithUnconstrainedGeneric_ShouldHaveDefaultConstraint() { GeneratorResult result = Generator @@ -81,20 +81,20 @@ await That(result.Sources["Mock.IMyService__IMyOtherService.g.cs"]) """).IgnoringNewlineStyle(); } - [Theory] - [InlineData("class, T")] - [InlineData("struct")] - [InlineData("class")] - [InlineData("class, notnull")] - [InlineData("notnull")] - [InlineData("unmanaged")] - [InlineData("class?")] - [InlineData("global::MyCode.IMyInterface")] - [InlineData("new()")] - [InlineData("global::MyCode.IMyInterface?")] - [InlineData("allows ref struct")] - [InlineData("class, allows ref struct")] - [InlineData("global::MyCode.IMyInterface, new()")] + [Test] + [Arguments("class, T")] + [Arguments("struct")] + [Arguments("class")] + [Arguments("class, notnull")] + [Arguments("notnull")] + [Arguments("unmanaged")] + [Arguments("class?")] + [Arguments("global::MyCode.IMyInterface")] + [Arguments("new()")] + [Arguments("global::MyCode.IMyInterface?")] + [Arguments("allows ref struct")] + [Arguments("class, allows ref struct")] + [Arguments("global::MyCode.IMyInterface, new()")] public async Task Generic_ShouldApplyAllConstraints(string constraint) { GeneratorResult result = Generator @@ -139,7 +139,7 @@ public bool MyMethod1(int index) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task Generic_WithoutConstraints_ShouldNotHaveWhereClause() { GeneratorResult result = Generator @@ -181,7 +181,7 @@ public bool MyMethod1(int index) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task GenericMethodWithAllowsRefStruct_ShouldCompile() { GeneratorResult result = Generator @@ -211,7 +211,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) "throw new global::System.NotSupportedException(\"Mockolate: methods with a generic type parameter declaring 'allows ref struct' are not supported. Method 'global::MyCode.IMyService.G8'.\");"); } - [Fact] + [Test] public async Task InterfaceMethodWithParameterNamedMethodExecution_ShouldGenerateUniqueLocalVariableName() { GeneratorResult result = Generator @@ -247,7 +247,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task InterfaceMethodWithParameterNamedOutParam1_ShouldRenameNumberedCastVariable() { GeneratorResult result = Generator @@ -281,7 +281,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task InterfaceMethodWithParameterNamedResult_ShouldGenerateUniqueLocalVariableName() { GeneratorResult result = Generator @@ -316,7 +316,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task InterfaceMethodWithParameterNamedReturnValue_ShouldRenameReturnValueOutVar() { GeneratorResult result = Generator @@ -347,7 +347,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task MethodWithEnumDefaultValue_ShouldGenerateCastExpression() { GeneratorResult result = Generator @@ -378,7 +378,7 @@ await That(result.Sources["Mock.IService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task MethodWithStructDefaultValue_ShouldGenerateDefaultKeyword() { GeneratorResult result = Generator @@ -408,7 +408,7 @@ await That(result.Sources["Mock.IService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task MultipleImplementations_ShouldOnlyHaveOneExplicitImplementation() { GeneratorResult result = Generator @@ -452,7 +452,7 @@ await That(result.Sources["Mock.IMyService__IMyServiceBase1__IMyServiceBase2.g.c .Contains("long global::MyCode.IMyServiceBase2.Value()").Once(); } - [Fact] + [Test] public async Task MultipleStaticAbstractMethods_WithCollidingSignature_ShouldEmitStaticKeywordOnExplicitImplementation() { @@ -487,7 +487,7 @@ await That(result.Sources["Mock.IDerived.g.cs"]) "a colliding static abstract method on a base interface must be emitted as an explicit static implementation, with the static keyword preserved"); } - [Fact] + [Test] public async Task ParameterNamedI_ShouldNotCollideWithVerifyLambdaVariable() { GeneratorResult result = Generator @@ -513,7 +513,7 @@ public interface IMyService await That(result.Diagnostics).IsEmpty(); } - [Fact] + [Test] public async Task ParameterNamedSetup_ShouldCompile() { GeneratorResult result = Generator @@ -539,7 +539,7 @@ public interface IMyService await That(result.Diagnostics).IsEmpty(); } - [Fact] + [Test] public async Task ShouldImplementAllMethodsFromInterfaces() { GeneratorResult result = Generator @@ -638,7 +638,7 @@ public void MyMethod2(int index, bool isReadOnly) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementImplicitlyInheritedMethods() { GeneratorResult result = Generator @@ -836,7 +836,7 @@ public int MyBaseMethod3(int value) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementVirtualMethodsOfClassesAndAllExplicitlyFromAdditionalInterfaces() { GeneratorResult result = Generator @@ -1031,7 +1031,7 @@ protected override bool MyMethod2(int index, bool isReadOnly, ref int value1, ou """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldSupportOptionalParameters() { GeneratorResult result = Generator @@ -1074,7 +1074,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldSupportParamsParameters() { GeneratorResult result = Generator @@ -1117,7 +1117,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldSupportRefInAndOutParameters() { GeneratorResult result = Generator @@ -1321,7 +1321,7 @@ public void MyMethod4(ref readonly global::MyCode.MyReadonlyStruct p1) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldSupportSpanParameters() { GeneratorResult result = Generator @@ -1371,7 +1371,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task StaticAbstractEventOnly_ShouldCompile() { GeneratorResult result = Generator @@ -1398,7 +1398,7 @@ public interface IMyService await That(result.Diagnostics).IsEmpty(); } - [Fact] + [Test] public async Task StaticAbstractMethodWithParameter_ShouldAppendArgumentToFastBuffer() { GeneratorResult result = Generator @@ -1432,7 +1432,7 @@ await That(result.Sources["Mock.IStaticOps.g.cs"]) .Because("the static-method fast-buffer branch must include the call argument when arity > 0"); } - [Fact] + [Test] public async Task VirtualMethodOverride_WithConstrainedGeneric_ShouldNotRepeatConstraints() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.PropertiesTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.PropertiesTests.cs index 66c02f059..840c6d4b7 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.PropertiesTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.PropertiesTests.cs @@ -6,14 +6,14 @@ public sealed partial class ClassTests { public sealed class PropertiesTests { - [Theory] - [InlineData("string Name { get; }", "Setup.IPropertyGetterOnlySetup", + [Test] + [Arguments("string Name { get; }", "Setup.IPropertyGetterOnlySetup", "Verify.VerificationPropertyGetterResult", "Setup.PropertySetup", "Verify.VerificationPropertyResult")] - [InlineData("string Name { set; }", "Setup.IPropertySetterOnlySetup", + [Arguments("string Name { set; }", "Setup.IPropertySetterOnlySetup", "Verify.VerificationPropertySetterResult", "Setup.PropertySetup", "Verify.VerificationPropertyResult")] - [InlineData("string Name { get; set; }", "Setup.PropertySetup", + [Arguments("string Name { get; set; }", "Setup.PropertySetup", "Verify.VerificationPropertyResult", "Setup.IPropertyGetterOnlySetup", "Verify.VerificationPropertyGetterResult")] public async Task PropertySurface_ShouldOnlyExposeTheAccessorsTheMockIntercepts( @@ -48,7 +48,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) .Because("a widened facade would silently re-expose an accessor the mock never intercepts"); } - [Fact] + [Test] public async Task InitOnlyProperty_ShouldEmitInitAccessorAndCompile() { GeneratorResult result = Generator @@ -87,7 +87,7 @@ public string Name """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task MultipleImplementations_ShouldOnlyHaveOneExplicitImplementation() { GeneratorResult result = Generator @@ -127,7 +127,7 @@ await That(result.Sources["Mock.IMyService__IMyServiceBase1__IMyServiceBase2.g.c .Contains("long global::MyCode.IMyServiceBase2.Value").Once(); } - [Fact] + [Test] public async Task MultipleStaticAbstractProperties_WithCollidingName_ShouldEmitStaticKeywordOnExplicitImplementation() { @@ -162,7 +162,7 @@ await That(result.Sources["Mock.IDerived.g.cs"]) "a colliding static abstract property on a base interface must be emitted as an explicit static implementation, with the static keyword preserved"); } - [Fact] + [Test] public async Task RefReturn_ShouldCompile() { GeneratorResult result = Generator @@ -188,7 +188,7 @@ public interface IMyService await That(result.Diagnostics).IsEmpty(); } - [Fact] + [Test] public async Task ShouldImplementAllPropertiesFromInterfaces() { GeneratorResult result = Generator @@ -316,7 +316,7 @@ private protected int SomePrivateProtectedProperty """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementImplicitlyInheritedProperties() { GeneratorResult result = Generator @@ -430,7 +430,7 @@ public int MyBaseProperty3 """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldImplementVirtualPropertiesOfClassesAndAllExplicitlyFromAdditionalInterfaces() { diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.cs index 9ffaa165f..db7a4089f 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.ClassTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockTests { public sealed partial class ClassTests { - [Fact] + [Test] public async Task BaseClassMethodWithParameterNamedBaseResult_ShouldGenerateUniqueLocalVariableName() { GeneratorResult result = Generator @@ -41,7 +41,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ClassWithBaseConstructorAlreadyAnnotatedSetsRequiredMembers_ShouldNotDuplicateAttribute() { GeneratorResult result = Generator @@ -78,7 +78,7 @@ await That(result.Sources["Mock.AnnotatedShape.g.cs"]) "one occurrence per generator-emitted public ctor, the (MockRegistry, ...) overload and the typed (MockBehavior, ...) overload that subclasses use; the base ctor already carries the attribute and the dedup check suppresses an injected duplicate on each"); } - [Fact] + [Test] public async Task ClassWithInheritedRequiredMember_ShouldEmitSetsRequiredMembersOnGeneratedConstructor() { GeneratorResult result = Generator @@ -112,7 +112,7 @@ await That(result.Sources["Mock.DerivedShape.g.cs"]) .Contains("[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]"); } - [Fact] + [Test] public async Task ClassWithoutRequiredMember_ShouldNotEmitSetsRequiredMembers() { GeneratorResult result = Generator @@ -142,7 +142,7 @@ await That(result.Sources["Mock.PlainShape.g.cs"]) .DoesNotContain("SetsRequiredMembers"); } - [Fact] + [Test] public async Task ClassWithRequiredMember_ShouldEmitSetsRequiredMembersOnGeneratedConstructor() { GeneratorResult result = Generator @@ -176,7 +176,7 @@ public RequiredShape(global::Mockolate.MockRegistry mockRegistry) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task InheritedInterface_ShouldHaveCorrectReferenceInXMLDocumentation() { GeneratorResult result = Generator @@ -231,7 +231,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) "Verify subscriptions on the BaseEvent event of BaseEvent."); } - [Fact] + [Test] public async Task InterfaceWithEvents_ShouldIncludeRaiseRemarkBullet() { GeneratorResult result = Generator @@ -263,7 +263,7 @@ await That(result.Sources["Mock.IHasEvent.g.cs"]) .DoesNotContain("SetupStatic / VerifyStatic / RaiseStatic"); } - [Fact] + [Test] public async Task PlainInterface_ShouldOmitConditionalRemarkBullets() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.CombinationTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.CombinationTests.cs index 6fb4d8275..15237f6c8 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.CombinationTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.CombinationTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockTests { public sealed class CombinationTests { - [Fact] + [Test] public async Task AbstractBaseWithParameterlessAndMixedConstructor_ShouldEmitBothTryCastHelpers() { // A constructor with a required parameter sets useTryCast; a defaulted parameter sets @@ -55,7 +55,7 @@ await That(result.Sources["Mock.MyService__IMyInterface.g.cs"]) "the 'else if' arity dispatch chain must include the optional-range branch for a mixed-required + defaulted ctor"); } - [Fact] + [Test] public async Task AbstractBaseWithRequiredOnlyConstructor_ShouldThrowNoParameterlessConstructorMessage() { GeneratorResult result = Generator @@ -92,7 +92,7 @@ await That(result.Sources["Mock.MyService__IMyInterface.g.cs"]) .DoesNotContain("static bool TryCastWithDefaultValue"); } - [Fact] + [Test] public async Task CombinationOnConcreteClassWithStaticAbstractInterface_ShouldPrimeMockRegistryProviderInBaseClassConstructor() { @@ -128,7 +128,7 @@ await That(result.Sources["Mock.MyService__IStaticAware.g.cs"]) "when a concrete base class is combined with an interface declaring static abstract members, the (MockRegistry) constructor must prime the AsyncLocal so virtual calls during base-class construction can resolve the registry"); } - [Fact] + [Test] public async Task CombinationWithProtectedEventOnBaseClass_ShouldEmitProtectedRaiseRegion() { GeneratorResult result = Generator @@ -163,7 +163,7 @@ await That(result.Sources["Mock.MyService__IExtra.g.cs"]) .Contains("#region IMockProtectedRaiseOnMyService"); } - [Fact] + [Test] public async Task CombinationWithRequiredMemberOnBase_ShouldEmitSetsRequiredMembersAttribute() { GeneratorResult result = Generator @@ -199,7 +199,7 @@ await That(result.Sources["Mock.MyService__IExtra.g.cs"]) "AppendMockSubject_BaseClassConstructor must stamp SetsRequiredMembers on the generated constructor when the base class declares any `required` member"); } - [Fact] + [Test] public async Task CombinationWithStaticInterfaceEvents_ShouldEmitStaticRaiseRegion() { GeneratorResult result = Generator @@ -236,7 +236,7 @@ await That(result.Sources["Mock.IBase__IStaticEvents.g.cs"]) "internal static readonly global::System.Threading.AsyncLocal MockRegistryProvider"); } - [Fact] + [Test] public async Task CombinationWithStaticInterfaceMembers_ShouldEmitStaticSetupAndVerifyRegions() { GeneratorResult result = Generator @@ -276,7 +276,7 @@ await That(result.Sources["Mock.IBase__IStaticAware.g.cs"]) .Because("the AsyncLocal field is required so static accessors can find the registry"); } - [Fact] + [Test] public async Task InterfaceTheClassAlreadyImplements_ShouldOnlyReImplementNonOverridableMembers() { // Re-implementing the interface is what makes the non-virtual `Add` reachable through the @@ -329,7 +329,7 @@ await That(result.Sources["Mock.MyCalculator__ICalculator.g.cs"]) .Because("documentation keeps referring to the interface member the shared member implements"); } - [Fact] + [Test] public async Task InterfaceTheClassAlreadyImplements_ShouldShareMemberIdsAndKeys() { GeneratorResult result = Generator @@ -366,7 +366,7 @@ await That(result.Sources["Mock.MyCalculator__ICalculator.g.cs"]) .Because("the interface surface registers setups under the class member's key"); } - [Fact] + [Test] public async Task InterfaceTheClassAlreadyImplements_ShouldShareIndexers() { GeneratorResult result = Generator @@ -404,7 +404,7 @@ await That(result.Sources["Mock.MyCalculator__ICalculator.g.cs"]) + "implementation would get its own value storage"); } - [Fact] + [Test] public async Task ImplementedMemberDifferingOnlyInNullabilityOrTypeParameterName_ShouldStillBeShared() { // The class member is the compiler-resolved implementation of the interface member in both @@ -446,7 +446,7 @@ await That(result.Sources["Mock.MyCalculator__ICalculator.g.cs"]) .DoesNotContain("global::MyCode.ICalculator.Convert(T value)"); } - [Fact] + [Test] public async Task InterfaceTheClassDoesNotImplement_ShouldKeepCollidingMembersSeparate() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.CrossAssemblyTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.CrossAssemblyTests.cs index 11dfe843a..2f06b29aa 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.CrossAssemblyTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.CrossAssemblyTests.cs @@ -39,7 +39,7 @@ public class Program } """; - [Fact] + [Test] public async Task InternalVirtualMember_WithInternalsVisibleTo_ShouldBeOverridden() { MetadataReference external = CompileMyBaseClassAssembly(grantsInternalsVisibleTo: true); @@ -53,7 +53,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) .Contains("internal override int InternalVirtualProperty"); } - [Fact] + [Test] public async Task InternalVirtualMember_WithoutInternalsVisibleTo_ShouldNotBeOverridden() { MetadataReference external = CompileMyBaseClassAssembly(grantsInternalsVisibleTo: false); @@ -68,7 +68,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) .DoesNotContain("InternalVirtualProperty"); } - [Fact] + [Test] public async Task ProtectedInternalMember_WithInternalsVisibleTo_ShouldBeOverriddenAsProtectedInternal() { MetadataReference external = CompileMyBaseClassAssembly(grantsInternalsVisibleTo: true); @@ -84,7 +84,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) .Contains("protected internal set"); } - [Fact] + [Test] public async Task ProtectedInternalMember_WithoutInternalsVisibleTo_ShouldBeOverriddenAsProtected() { MetadataReference external = CompileMyBaseClassAssembly(grantsInternalsVisibleTo: false); @@ -102,7 +102,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) .DoesNotContain("protected internal set"); } - [Fact] + [Test] public async Task ProtectedInternalNestedConstructorParameter_WithInternalsVisibleTo_ShouldEmitConstructor() { MetadataReference external = CompileClientBaseAssembly(grantsInternalsVisibleTo: true); @@ -116,7 +116,7 @@ await That(result.Sources["Mock.ClientBase.g.cs"]) .Because("InternalsVisibleTo makes the internal half of `protected internal` visible"); } - [Fact] + [Test] public async Task ProtectedInternalNestedConstructorParameter_WithoutInternalsVisibleTo_ShouldNotEmitConstructor() { MetadataReference external = CompileClientBaseAssembly(grantsInternalsVisibleTo: false); @@ -132,9 +132,9 @@ await That(result.Sources["Mock.ClientBase.g.cs"]) "`protected internal` degrades to `protected` outside the declaring assembly, so the type is only reachable through inheritance and cannot be named on the generated public constructor (CS0051) or in MockExtensionsForClientBase (CS0122)"); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task ProtectedInternalNestedMemberSignature_ShouldFollowInternalsVisibleTo( bool grantsInternalsVisibleTo) { @@ -159,7 +159,7 @@ await That(result.Sources["Mock.ClientBase.g.cs"]) } } - [Fact] + [Test] public async Task AttributeWithInaccessibleTypeArgument_ShouldNotBeEmitted() { MetadataReference external = ExternalAssembly.Compile(""" @@ -186,7 +186,7 @@ await That(result.Sources["Mock.ClientBase.g.cs"]) "the attribute name is emitted verbatim, so an inaccessible type argument makes it unusable even though the attribute class itself is public"); } - [Fact] + [Test] public async Task PublicMembers_ShouldBeMockedAcrossAssemblyBoundary() { MetadataReference external = ExternalAssembly.Compile(""" @@ -229,18 +229,18 @@ await That(result.Sources["Mock.MyAbstractService.g.cs"]) .Contains("public override int Compute()"); } - [Theory] - [InlineData("public abstract string MyProperty { get; internal set; }", "public override string MyProperty")] - [InlineData("internal abstract void MyMethod();", "internal override void MyMethod()")] - [InlineData("internal abstract int MyProperty { get; set; }", "internal override int MyProperty")] - [InlineData("internal abstract event System.EventHandler MyEvent;", + [Test] + [Arguments("public abstract string MyProperty { get; internal set; }", "public override string MyProperty")] + [Arguments("internal abstract void MyMethod();", "internal override void MyMethod()")] + [Arguments("internal abstract int MyProperty { get; set; }", "internal override int MyProperty")] + [Arguments("internal abstract event System.EventHandler MyEvent;", "internal override event global::System.EventHandler MyEvent")] - [InlineData("private protected abstract void MyMethod();", "private protected override void MyMethod()")] - [InlineData("private protected abstract int MyProperty { get; set; }", + [Arguments("private protected abstract void MyMethod();", "private protected override void MyMethod()")] + [Arguments("private protected abstract int MyProperty { get; set; }", "private protected override int MyProperty")] - [InlineData("private protected abstract event System.EventHandler MyEvent;", + [Arguments("private protected abstract event System.EventHandler MyEvent;", "private protected override event global::System.EventHandler MyEvent")] - [InlineData("public abstract string MyProperty { get; private protected set; }", + [Arguments("public abstract string MyProperty { get; private protected set; }", "public override string MyProperty")] public async Task InaccessibleAbstractClassMember_WithInternalsVisibleTo_ShouldBeMocked( string member, string expectedOverride) @@ -257,9 +257,9 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]).Contains(expectedOverride "the override must repeat the base member's declared accessibility, and the member name alone would also match the setup and verify surfaces"); } - [Theory] - [InlineData("private protected abstract void MyMethod();")] - [InlineData("private protected abstract event System.EventHandler MyEvent;")] + [Test] + [Arguments("private protected abstract void MyMethod();")] + [Arguments("private protected abstract event System.EventHandler MyEvent;")] public async Task PrivateProtectedMember_WithInternalsVisibleTo_ShouldNotBeWrapped(string member) { MetadataReference external = CompileMyExternalTypeAssembly("abstract class", member, @@ -273,16 +273,16 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]).DoesNotContain(".Wraps is "a `private protected` member cannot be reached through a base-typed qualifier from the derived mock (CS1540)"); } - [Theory] - [InlineData("interface", "string MyProperty { get; internal set; }")] - [InlineData("interface", "internal void MyMethod();")] - [InlineData("abstract class", "public abstract string MyProperty { get; internal set; }")] - [InlineData("abstract class", "internal abstract void MyMethod();")] - [InlineData("abstract class", "internal abstract int MyProperty { get; set; }")] - [InlineData("abstract class", "internal abstract event System.EventHandler MyEvent;")] - [InlineData("abstract class", "private protected abstract void MyMethod();")] - [InlineData("abstract class", "private protected abstract int MyProperty { get; set; }")] - [InlineData("abstract class", "private protected abstract event System.EventHandler MyEvent;")] + [Test] + [Arguments("interface", "string MyProperty { get; internal set; }")] + [Arguments("interface", "internal void MyMethod();")] + [Arguments("abstract class", "public abstract string MyProperty { get; internal set; }")] + [Arguments("abstract class", "internal abstract void MyMethod();")] + [Arguments("abstract class", "internal abstract int MyProperty { get; set; }")] + [Arguments("abstract class", "internal abstract event System.EventHandler MyEvent;")] + [Arguments("abstract class", "private protected abstract void MyMethod();")] + [Arguments("abstract class", "private protected abstract int MyProperty { get; set; }")] + [Arguments("abstract class", "private protected abstract event System.EventHandler MyEvent;")] public async Task InaccessibleRequiredMember_WithoutInternalsVisibleTo_ShouldNotBeMocked( string typeKeyword, string member) { @@ -299,12 +299,12 @@ await That(result.Sources).DoesNotContainKey("Mock.MyExternalType.g.cs") "the generator must refuse to emit a mock whose overrides could not compile; the user-facing guarantee is the Mockolate0002 error"); } - [Theory] - [InlineData("internal abstract void Hidden();", "internal override void Hidden() { }")] - [InlineData("internal abstract int Hidden { get; set; }", "internal override int Hidden { get; set; }")] - [InlineData("internal abstract event System.EventHandler Hidden;", + [Test] + [Arguments("internal abstract void Hidden();", "internal override void Hidden() { }")] + [Arguments("internal abstract int Hidden { get; set; }", "internal override int Hidden { get; set; }")] + [Arguments("internal abstract event System.EventHandler Hidden;", "internal override event System.EventHandler Hidden;")] - [InlineData("private protected abstract int Hidden { get; set; }", + [Arguments("private protected abstract int Hidden { get; set; }", "private protected override int Hidden { get; set; }")] public async Task InaccessibleAbstractMemberAlreadyOverridden_ShouldStillBeMocked( string baseMember, string derivedOverride) @@ -334,11 +334,11 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the slot is already filled, so neither the unreachable override nor the base declaration may be restated"); } - [Theory] - [InlineData("internal void Hidden();", "void IMyBaseType.Hidden() { }")] - [InlineData("internal int Hidden { get; set; }", + [Test] + [Arguments("internal void Hidden();", "void IMyBaseType.Hidden() { }")] + [Arguments("internal int Hidden { get; set; }", "int IMyBaseType.Hidden { get => 0; set { } }")] - [InlineData("internal event System.EventHandler Hidden;", + [Arguments("internal event System.EventHandler Hidden;", "event System.EventHandler IMyBaseType.Hidden { add { } remove { } }")] public async Task InaccessibleInterfaceMemberWithDefaultImplementation_ShouldStillBeMocked( string baseMember, string defaultImplementation) @@ -368,10 +368,10 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the default implementation fills the slot, so the mock inherits it rather than restating it"); } - [Theory] - [InlineData("public abstract string Mixed { get; internal set; }", + [Test] + [Arguments("public abstract string Mixed { get; internal set; }", "public override string Mixed { get => null!; internal set { } }", "internal set")] - [InlineData("public abstract string Mixed { get; private protected set; }", + [Arguments("public abstract string Mixed { get; private protected set; }", "public override string Mixed { get => null!; private protected set { } }", "private protected set")] public async Task MixedAccessorSlotAlreadyOverridden_ShouldBeMockedWithTheAccessibleAccessorOnly( string baseMember, string derivedOverride, string inaccessibleAccessor) @@ -403,8 +403,8 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the accessor is invisible to the mock's assembly, so only the reachable one may be overridden"); } - [Theory] - [InlineData("public abstract string Mixed { internal get; set; }", + [Test] + [Arguments("public abstract string Mixed { internal get; set; }", "public override string Mixed { internal get => null!; set { } }", "internal get")] public async Task MixedAccessorSlotAlreadyOverridden_WithOnlyTheSetterReachable_ShouldBeMockedWithTheSetter( string baseMember, string derivedOverride, string inaccessibleAccessor) @@ -437,7 +437,7 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the accessor is invisible to the mock's assembly, so only the reachable one may be overridden"); } - [Fact] + [Test] public async Task MixedAccessorIndexerSlotAlreadyOverridden_ShouldBeMockedWithTheAccessibleAccessorOnly() { MetadataReference external = ExternalAssembly.Compile(""" @@ -466,7 +466,7 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the setter is invisible to the mock's assembly, so only the getter may be overridden"); } - [Fact] + [Test] public async Task MixedAccessorIndexerSlotAlreadyOverridden_WithOnlyTheSetterReachable_ShouldBeMockedWithTheSetter() { MetadataReference external = ExternalAssembly.Compile(""" @@ -495,7 +495,7 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the getter is invisible to the mock's assembly, so only the setter may be overridden"); } - [Fact] + [Test] public async Task MixedAccessorSlotFilledByAnIntermediateType_ShouldBeMockedWithTheAccessibleAccessorOnly() { MetadataReference external = ExternalAssembly.Compile(""" @@ -526,7 +526,7 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) .Because("the slot is filled further up the chain, which discharges the setter just as a direct override does"); } - [Fact] + [Test] public async Task MixedAccessorSlot_WithInternalsVisibleTo_ShouldBeMockedWithBothAccessors() { MetadataReference external = ExternalAssembly.Compile(""" @@ -550,7 +550,7 @@ public abstract class MyExternalType : MyBaseType await That(result.Sources["Mock.MyExternalType.g.cs"]).Contains("internal set"); } - [Fact] + [Test] public async Task MixedAccessorInterfaceSlotWithDefaultImplementation_ShouldNotBeRestated() { MetadataReference external = ExternalAssembly.Compile(""" @@ -578,7 +578,7 @@ await That(result.Sources["Mock.MyExternalType.g.cs"]) "an explicit interface implementation must supply every accessor (CS0551) and cannot reach the internal one (CS0122), so interface slots stay all-or-nothing"); } - [Fact] + [Test] public async Task InaccessibleAbstractMemberReDeclaredAsAbstract_ShouldNotBeMocked() { MetadataReference external = ExternalAssembly.Compile(""" @@ -603,7 +603,7 @@ await That(result.Sources).DoesNotContainKey("Mock.MyExternalType.g.cs") "an `abstract override` re-declaration continues the slot without filling it, so the member is still the mock's obligation"); } - [Fact] + [Test] public async Task PartlyReachableSlot_WithInaccessibleSignatureType_ShouldSkipMember() { MetadataReference external = ExternalAssembly.Compile(""" diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.DelegateTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.DelegateTests.cs index 331063886..fa1045fa3 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.DelegateTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.DelegateTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockTests { public sealed class DelegateTests { - [Fact] + [Test] public async Task CustomDelegates_ShouldOnlyCreateTwoExtensionsForSetupAndVerify() { GeneratorResult result = Generator @@ -51,7 +51,7 @@ await That(result.Sources["Mock.Program_DoSomething.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task CustomDelegates_ShouldSupportSpanAndReadOnlySpanReturnTypes() { GeneratorResult result = Generator @@ -124,7 +124,7 @@ await That(result.Sources["Mock.Program_DoSomething2.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task CustomDelegates_WithSpanParameter_ShouldUseWrapperInsteadOfDegrading() { GeneratorResult result = Generator @@ -155,7 +155,7 @@ await That(result.Sources["Mock.Program_DoSomething1.g.cs"]) "a by-value Span parameter stays outside the delegate ref-struct carve-out, so the setup surface is emitted against SpanWrapper"); } - [Fact] + [Test] public async Task CustomVoidDelegates_ShouldOnlyCreateTwoExtensionsForSetupAndVerify() { GeneratorResult result = Generator @@ -202,7 +202,7 @@ await That(result.Sources["Mock.Program_DoSomething.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task Delegate_ShouldHaveCorrectReferenceInXMLDocumentation() { GeneratorResult result = Generator @@ -230,7 +230,7 @@ await That(result.Sources["Mock.Program_DoSomething.g.cs"]) .DoesNotContain("Verify invocations for the method Object").IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task DelegateWithMoreThanMaxParameters_ShouldGenerateSingleAllValueFlagsOverload() { GeneratorResult result = Generator @@ -288,7 +288,7 @@ await That(result.Sources["Mock.Program_ProcessAll.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task DelegateWithMoreThanMaxParametersAllOut_ShouldNotGenerateValueFlagsOverload() { GeneratorResult result = Generator @@ -317,7 +317,7 @@ await That(result.Sources["Mock.Program_ProcessAll.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task DelegateWithParameterNamedMethodSetup_ShouldGenerateUniqueLocalVariableName() { GeneratorResult result = Generator @@ -348,7 +348,7 @@ await That(result.Sources["Mock.Program_ProcessResult.g.cs"]) .IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task VoidDelegateWithParameterNamedMethodSetup_ShouldGenerateUniqueLocalVariableName() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.RefStructTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.RefStructTests.cs index 5873deb8b..c01a8e597 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.RefStructTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.RefStructTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockTests { public sealed class RefStructTests { - [Fact] + [Test] public async Task Arity16VoidMethod_EmitsGeneratedRefStructSetupAtArity16() { GeneratorResult result = Generator @@ -38,7 +38,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Contains("where T1 : allows ref struct"); } - [Fact] + [Test] public async Task Arity5IndexerGetAndSet_WithRefStructKey_EmitsCombinedSetup() { GeneratorResult result = Generator @@ -78,7 +78,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Contains("BoundGetter"); } - [Fact] + [Test] public async Task Arity5IndexerGetterOnly_WithRefStructKey_EmitsGetterSetupOnly() { GeneratorResult result = Generator @@ -116,7 +116,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .DoesNotContain("public sealed class RefStructIndexerSetup"); } - [Fact] + [Test] public async Task Arity5IndexerSetterOnly_WithRefStructKey_EmitsSetterSetupOnly() { GeneratorResult result = Generator @@ -153,7 +153,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .DoesNotContain("public sealed class RefStructIndexerSetup"); } - [Fact] + [Test] public async Task Arity5ReturnMethod_EmitsGeneratedRefStructReturnSetup() { GeneratorResult result = Generator @@ -190,7 +190,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Because("a `default!` fallback must be emitted when neither return factory nor defaultFactory is present"); } - [Fact] + [Test] public async Task Arity5VoidMethod_EmitsGeneratedRefStructSetup() { // Arity 5 exceeds the hand-written ceiling (1-4); the generator must emit @@ -233,7 +233,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Because("every generic parameter must carry the allows-ref-struct anti-constraint"); } - [Fact] + [Test] public async Task Arity6ReturnMethod_EmitsGeneratedRefStructReturnSetup() { GeneratorResult result = Generator @@ -266,7 +266,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Contains("public bool HasReturnValue"); } - [Fact] + [Test] public async Task Arity6VoidMethod_EmitsGeneratedRefStructSetupAtArity6() { GeneratorResult result = Generator @@ -303,7 +303,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Contains("_returnAction = static () => new TException();"); } - [Fact] + [Test] public async Task Arity7ReturnMethod_MixedRefStructAndValueTypes_EmitsRefStructReturnSetup() { GeneratorResult result = Generator @@ -338,7 +338,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Contains("where T7 : allows ref struct"); } - [Fact] + [Test] public async Task Arity8VoidMethod_EmitsGeneratedRefStructSetupAtArity8() { GeneratorResult result = Generator @@ -372,7 +372,7 @@ await That(result.Sources["RefStructMethodSetups.g.cs"]) .Contains("_returnAction = exceptionFactory;"); } - [Fact] + [Test] public async Task IndexerGetterWithRefStructKey_EmitsRefStructDispatch() { // Getter-only ref-struct-keyed indexers route through RefStructIndexerGetterSetup. @@ -408,7 +408,7 @@ await That(result.Sources["Mock.IRefStructLookup.g.cs"]) .Because("the setup facade must expose the narrow IRefStructIndexerGetterSetup surface"); } - [Fact] + [Test] public async Task IndexerWithRefStructKey_AndSetter_EmitsCombinedSetup() { // Get+set ref-struct-keyed indexer: expose IRefStructIndexerSetup on the @@ -446,7 +446,7 @@ await That(result.Sources["Mock.IRefStructStore.g.cs"]) .Contains("RefStructIndexerSetterSetup"); } - [Fact] + [Test] public async Task IndexerWithRefStructKey_SetterOnly_EmitsSetterSetup() { GeneratorResult result = Generator @@ -478,7 +478,7 @@ await That(result.Sources["Mock.IRefStructWriter.g.cs"]) .Contains("RefStructMethodInvocation(\"global::MyCode.IRefStructWriter.set_Item\", \"key\", \"value\")"); } - [Fact] + [Test] public async Task MethodReturningNonSpanRefStruct_WithRefStructParameter_ShouldEmitNotSupportedExceptionAndSkipSetupSurface() { GeneratorResult result = Generator @@ -514,7 +514,7 @@ await That(result.Sources["Mock.IPacketTransformer.g.cs"]) .Because("the setup-interface implementation must be skipped for unsupported ref-struct return types"); } - [Fact] + [Test] public async Task MethodWithOutRefStructParameter_ShouldEmitRefStructOutParameterPipeline() { GeneratorResult result = Generator @@ -550,7 +550,7 @@ await That(result.Sources["Mock.IPacketBag.g.cs"]) .Because("the mock body routes the out slot through IOutRefStructParameter instead of IOutParameter"); } - [Fact] + [Test] public async Task MixedParameters_RefStructPlusValueType_ShouldRouteThroughRefStructPipeline() { GeneratorResult result = Generator @@ -583,7 +583,7 @@ await That(result.Sources["Mock.IPacketWriter.g.cs"]) .Contains("setup.Matches(packet, priority)"); } - [Fact] + [Test] public async Task NonRefStructMethod_ShouldContinueToUseRegularPipeline() { // Regression guard: our ref-struct switch must not intercept methods that have no @@ -619,7 +619,7 @@ await That(result.Sources["Mock.IBoringService.g.cs"]) .DoesNotContain("RefStructVoidMethodSetup"); } - [Fact] + [Test] public async Task NoRefStructSurface_ShouldNotEmitRefStructMethodSetupsFile() { GeneratorResult result = Generator @@ -647,7 +647,7 @@ public static void Main(string[] args) await That(result.Sources).DoesNotContainKey("RefStructMethodSetups.g.cs"); } - [Fact] + [Test] public async Task ReturnMethodWithRefStructParameter_ShouldEmitRefStructReturnSetup() { GeneratorResult result = Generator @@ -681,7 +681,7 @@ await That(result.Sources["Mock.IPacketParser.g.cs"]) .Because("the return-side HasReturnValue gate must be present so Throws-only setups still fall through to the framework default"); } - [Fact] + [Test] public async Task VoidMethodWithRefStructParameter_ShouldEmitRefStructPipeline() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/MockTests.cs b/Tests/Mockolate.SourceGenerators.Tests/MockTests.cs index cac19b990..b87eb7d85 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/MockTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/MockTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.SourceGenerators.Tests; public sealed partial class MockTests { - [Fact] + [Test] public async Task DeeplyNestedClass_ShouldSetupAndVerifyForAllInheritedTypesExceptExplicitInterfaceMembers() { GeneratorResult result = Generator @@ -99,7 +99,7 @@ await That(result.Sources["Mock.OuterClass.g.cs"]) .DoesNotContain("global::Mockolate.Verify.VerificationEventResult IMockVerifyForOuterClass.NestedEvent"); } - [Fact] + [Test] public async Task ExplicitInterfaceImplementation_ShouldNotAddAccessibility() { GeneratorResult result = Generator @@ -138,7 +138,7 @@ await That(result.Sources["Mock.MyService.g.cs"]) .DoesNotContain("private global::System.Collections.IEnumerator GetEnumerator()"); } - [Fact] + [Test] public async Task ForTypesWithAdditionalConstructorsWithParameters_ShouldWorkForAllNonPrivateConstructors() { GeneratorResult result = Generator @@ -168,7 +168,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) .DoesNotContain("No parameterless constructor found"); } - [Fact] + [Test] public async Task ForTypesWithConstructorWithParameters_ShouldWorkForAllNonPrivateConstructors() { GeneratorResult result = Generator @@ -245,7 +245,7 @@ public MyBaseClass(global::Mockolate.MockRegistry mockRegistry, int value, bool """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ForTypesWithOnlyParameterlessConstructor_ShouldOmitConstructorParametersOverloads() { GeneratorResult result = Generator @@ -277,7 +277,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) "private static global::MyCode.MyBaseClass CreateMock(global::Mockolate.MockBehavior? mockBehavior, global::System.Action? setup, object?[]? constructorParameters)"); } - [Fact] + [Test] public async Task ForTypesWithoutExplicitConstructor_ShouldOmitConstructorParametersOverloads() { GeneratorResult result = Generator @@ -307,7 +307,7 @@ await That(result.Sources["Mock.MyBaseClass.g.cs"]) "private static global::MyCode.MyBaseClass CreateMock(global::Mockolate.MockBehavior? mockBehavior, global::System.Action? setup, object?[]? constructorParameters)"); } - [Fact] + [Test] public async Task ForTypesWithoutPublicOrProtectedConstructor_ShouldOnlyGenerateMockThatThrowsException() { GeneratorResult result = Generator @@ -333,7 +333,7 @@ private MyBaseClass() { } await That(result.Sources).DoesNotContainKey("Mock.MyBaseClass.g.cs"); } - [Fact] + [Test] public async Task ForTypesWithSealedOverrideEvent_ShouldNotOverrideEvent() { GeneratorResult result = Generator @@ -367,7 +367,7 @@ await That(result.Sources["Mock.MyClassWithSealedEvents.g.cs"]) .DoesNotContain("event System.EventHandler? SomeEvent"); } - [Fact] + [Test] public async Task ForTypesWithSealedOverrideIndexer_ShouldNotOverrideIndexer() { GeneratorResult result = Generator @@ -401,7 +401,7 @@ await That(result.Sources["Mock.MyClassWithSealedIndexers.g.cs"]) .DoesNotContain("override int this[int index]"); } - [Fact] + [Test] public async Task ForTypesWithSealedOverrideMethod_ShouldNotOverrideMethod() { GeneratorResult result = Generator @@ -436,7 +436,7 @@ await That(result.Sources["Mock.MyClassWithSealedMethods.g.cs"]) .DoesNotContain("override void MyMethod(int value)"); } - [Fact] + [Test] public async Task ForTypesWithSealedOverrideProperty_ShouldNotOverrideProperty() { GeneratorResult result = Generator @@ -470,7 +470,7 @@ await That(result.Sources["Mock.MyClassWithSealedProperties.g.cs"]) .DoesNotContain("override int MyProperty"); } - [Fact] + [Test] public async Task HiddenGenericMethod_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -510,7 +510,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) "the explicit implementation of the hidden member must delegate to the declaring interface, not to the hiding member"); } - [Fact] + [Test] public async Task HiddenGenericMethod_WithAdditionalConstraints_ShouldNotDelegateToHidingMember() { GeneratorResult result = Generator @@ -549,7 +549,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task HiddenGenericMethod_WithNarrowedConstraints_ShouldNotDelegateToHidingMember() { GeneratorResult result = Generator @@ -588,7 +588,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task HiddenGenericMethod_InDeepHierarchy_ShouldNotDelegateToHidingMember() { GeneratorResult result = Generator @@ -638,7 +638,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("every level of the hierarchy must delegate to its own declaring interface"); } - [Fact] + [Test] public async Task HiddenProperty_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -680,7 +680,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("the setter of the explicit implementation must write to the declaring interface"); } - [Fact] + [Test] public async Task HiddenProperty_WithUnrelatedType_ShouldNotDelegateToHidingMember() { GeneratorResult result = Generator @@ -721,7 +721,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task HiddenGetOnlyProperty_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -756,7 +756,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("a get-only hidden property must still read from the declaring interface"); } - [Fact] + [Test] public async Task HiddenInitOnlyProperty_ShouldOnlyDelegateGetterToDeclaringInterface() { GeneratorResult result = Generator @@ -793,7 +793,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("an init accessor cannot be forwarded to an already constructed instance"); } - [Fact] + [Test] public async Task InitOnlyProperty_InClass_ShouldNotDelegateSetterToWrappedInstance() { GeneratorResult result = Generator @@ -823,7 +823,7 @@ await That(result.Sources["Mock.MyClass.g.cs"]) .Because("an init accessor cannot be forwarded to an already constructed instance"); } - [Fact] + [Test] public async Task HiddenIndexer_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -867,7 +867,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("the setter of the explicit implementation must write to the declaring interface"); } - [Fact] + [Test] public async Task HiddenEvent_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -913,7 +913,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("unsubscribing on the explicit implementation must unsubscribe on the declaring interface"); } - [Fact] + [Test] public async Task HiddenProperty_InDeepHierarchy_ShouldNotDelegateToHidingMember() { GeneratorResult result = Generator @@ -956,7 +956,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("every level of the hierarchy must delegate to its own declaring interface"); } - [Fact] + [Test] public async Task SiblingInterfaceProperty_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -1006,7 +1006,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("each sibling member must delegate to its own declaring interface"); } - [Fact] + [Test] public async Task SiblingInterfaceIndexer_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -1060,7 +1060,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("each sibling indexer must delegate to its own declaring interface"); } - [Fact] + [Test] public async Task SiblingInterfaceEvent_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -1119,7 +1119,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("each sibling event must subscribe and unsubscribe on its own declaring interface"); } - [Fact] + [Test] public async Task SiblingInterfaceMethod_ShouldDelegateWrappingToDeclaringInterface() { GeneratorResult result = Generator @@ -1159,7 +1159,7 @@ await That(result.Sources["Mock.ITest.g.cs"]) .Because("each sibling method must delegate to its own declaring interface"); } - [Fact] + [Test] public async Task MembersWithReservedNames_ShouldPrefixAtSymbol() { GeneratorResult result = Generator @@ -1200,7 +1200,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) ; } - [Fact] + [Test] public async Task MethodOrIndexerParametersWithReservedNames_ShouldPrefixAtSymbol() { GeneratorResult result = Generator @@ -1262,7 +1262,7 @@ await That(result.Sources["Mock.IMyService.g.cs"]) """).IgnoringNewlineStyle(); } - [Fact] + [Test] public async Task ShouldHandleComplexInheritanceWithSealedAndInternalMembers() { GeneratorResult result = Generator @@ -1308,7 +1308,7 @@ await That(result.Sources["Mock.MyDerivedClass.g.cs"]) .Contains("override void ProtectedMethod"); } - [Fact] + [Test] public async Task ShouldNotIncludeSealedOverrideSpecialMethods() { GeneratorResult result = Generator @@ -1349,7 +1349,7 @@ await That(result.Sources["Mock.MyDerivedClass.g.cs"]) .DoesNotContain("override string ToString"); } - [Fact] + [Test] public async Task ShouldNotIncludeSealedOverrideSpecialMethodsWithNonNullableParameters() { GeneratorResult result = Generator @@ -1388,7 +1388,7 @@ await That(result.Sources["Mock.MyDerivedClass.g.cs"]) "MyMiddleClass.Equals(object) must still match and filter out object.Equals(object?) despite the nullability difference"); } - [Fact] + [Test] public async Task ShouldPreserveProtectedInternalAccessibilityOnOverriddenMembers() { GeneratorResult result = Generator @@ -1424,7 +1424,7 @@ await That(generated) .DoesNotContain("protected override event"); } - [Fact] + [Test] public async Task ShouldSupportSpecialTypes() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj b/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj index beca3921a..685bf833b 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj +++ b/Tests/Mockolate.SourceGenerators.Tests/Mockolate.SourceGenerators.Tests.csproj @@ -11,11 +11,6 @@ - - - - - diff --git a/Tests/Mockolate.SourceGenerators.Tests/ReturnsThrowsAsyncExtensionsTests.cs b/Tests/Mockolate.SourceGenerators.Tests/ReturnsThrowsAsyncExtensionsTests.cs index 79f1a0586..654d1e1ec 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/ReturnsThrowsAsyncExtensionsTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/ReturnsThrowsAsyncExtensionsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.SourceGenerators.Tests; public sealed class ReturnsThrowsAsyncExtensionsTests { - [Fact] + [Test] public async Task ForVoidMethods_ShouldNotGenerateReturnsAsyncExtensions() { GeneratorResult result = Generator @@ -34,7 +34,7 @@ public interface IMyInterface await That(result.Sources).DoesNotContainKey("ReturnsThrowsAsyncExtensions.g.cs"); } - [Fact] + [Test] public async Task GenerateAsyncExtensionsForMethodsWithMoreParameters() { GeneratorResult result = Generator @@ -100,7 +100,7 @@ await That(result.Sources["ReturnsThrowsAsyncExtensions.g.cs"]) "public static global::Mockolate.Setup.IReturnMethodSetupReturnBuilder, T1, T2, T3, T4, T5> ThrowsAsync(this global::Mockolate.Setup.IReturnMethodSetupWithCallback, T1, T2, T3, T4, T5> setup, global::System.Func callback)"); } - [Fact] + [Test] public async Task ShouldOnlyGenerateNecessaryExtensions() { GeneratorResult result = Generator @@ -137,7 +137,7 @@ await That(result.Sources["ReturnsThrowsAsyncExtensions.g.cs"]) .DoesNotContain("ThrowsAsync(this"); } - [Fact] + [Test] public async Task WhenAllMethodsHaveUpTo4Parameters_ShouldNotGenerateReturnsAsyncExtensions() { GeneratorResult result = Generator diff --git a/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotAcceptance.cs b/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotAcceptance.cs index 7f1142193..cd4af9fe5 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotAcceptance.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotAcceptance.cs @@ -6,7 +6,8 @@ public sealed class MockGenerationSnapshotAcceptance /// Execute this test to overwrite the expected snapshot files for /// with the current generator output. /// - [Fact(Explicit = true)] + [Test] + [Explicit] public void AcceptSnapshotChanges() { foreach (var scenario in MockGenerationSnapshotTests.Scenarios) diff --git a/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotTests.cs b/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotTests.cs index b6297d629..d16053abf 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotTests.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/Snapshot/MockGenerationSnapshotTests.cs @@ -18,8 +18,8 @@ namespace Mockolate.SourceGenerators.Tests.Snapshot; /// public sealed class MockGenerationSnapshotTests { - [Theory] - [MemberData(nameof(ScenarioNames))] + [Test] + [MethodDataSource(nameof(ScenarioNames))] public async Task GeneratorOutput_MatchesExpectedSnapshot(string scenarioName) { var scenario = Scenarios.Single(s => s.Name == scenarioName); @@ -102,16 +102,8 @@ await That(SnapshotStorage.StripConfigSpecificLines(generated[fileName])) []), ]; - public static TheoryData ScenarioNames - { - get - { - TheoryData data = new(); - foreach (var scenario in Scenarios) data.Add(scenario.Name); - - return data; - } - } + public static IEnumerable ScenarioNames() + => Scenarios.Select(scenario => scenario.Name); internal static GeneratorResult RunGenerator(SnapshotScenario scenario) { diff --git a/Tests/Mockolate.SourceGenerators.Tests/TestHelpers/Usings.cs b/Tests/Mockolate.SourceGenerators.Tests/TestHelpers/Usings.cs index 64c73faed..0be329787 100644 --- a/Tests/Mockolate.SourceGenerators.Tests/TestHelpers/Usings.cs +++ b/Tests/Mockolate.SourceGenerators.Tests/TestHelpers/Usings.cs @@ -1,6 +1,5 @@ global using System; global using System.Threading.Tasks; -global using Xunit; global using Mockolate.SourceGenerators.Tests.TestHelpers; global using aweXpect; global using static aweXpect.Expect; diff --git a/Tests/Mockolate.Tests/DefaultValueFactoryTests.cs b/Tests/Mockolate.Tests/DefaultValueFactoryTests.cs index 7ff600aef..1053eadb5 100644 --- a/Tests/Mockolate.Tests/DefaultValueFactoryTests.cs +++ b/Tests/Mockolate.Tests/DefaultValueFactoryTests.cs @@ -2,7 +2,7 @@ namespace Mockolate.Tests; public sealed class DefaultValueFactoryTests { - [Fact] + [Test] public async Task CanGenerateValue_ShouldFallbackToFalse() { MyDefaultValueFactory defaultValueFactory = new(); @@ -12,7 +12,7 @@ public async Task CanGenerateValue_ShouldFallbackToFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task GenerateValue_ShouldFallbackToAlwaysReturnNull() { MyDefaultValueFactory defaultValueFactory = new(); diff --git a/Tests/Mockolate.Tests/Exceptions/MockExceptionTests.cs b/Tests/Mockolate.Tests/Exceptions/MockExceptionTests.cs index 3f90cb395..43b975153 100644 --- a/Tests/Mockolate.Tests/Exceptions/MockExceptionTests.cs +++ b/Tests/Mockolate.Tests/Exceptions/MockExceptionTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.Exceptions; public sealed class MockExceptionTests { - [Fact] + [Test] public async Task ShouldForwardInnerException() { Exception innerException = new("bar"); @@ -14,7 +14,7 @@ await That(exception).HasMessage("foo").And .HasInner(e => e.HasMessage("bar")); } - [Fact] + [Test] public async Task ShouldForwardMessage() { Exception exception = new MockException("foo"); diff --git a/Tests/Mockolate.Tests/Exceptions/MockNotSetupExceptionTests.cs b/Tests/Mockolate.Tests/Exceptions/MockNotSetupExceptionTests.cs index 515a0434c..bc374a666 100644 --- a/Tests/Mockolate.Tests/Exceptions/MockNotSetupExceptionTests.cs +++ b/Tests/Mockolate.Tests/Exceptions/MockNotSetupExceptionTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.Exceptions; public sealed class MockNotSetupExceptionTests { - [Fact] + [Test] public async Task ShouldForwardInnerException() { Exception innerException = new("bar"); @@ -14,7 +14,7 @@ await That(exception).HasMessage("foo").And .HasInner(e => e.HasMessage("bar")); } - [Fact] + [Test] public async Task ShouldForwardMessage() { Exception exception = new MockNotSetupException("foo"); diff --git a/Tests/Mockolate.Tests/Exceptions/MockVerificationTimeoutExceptionTests.cs b/Tests/Mockolate.Tests/Exceptions/MockVerificationTimeoutExceptionTests.cs index 6bb382ba4..5e0688b01 100644 --- a/Tests/Mockolate.Tests/Exceptions/MockVerificationTimeoutExceptionTests.cs +++ b/Tests/Mockolate.Tests/Exceptions/MockVerificationTimeoutExceptionTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests.Exceptions; public class MockVerificationTimeoutExceptionTests { - [Fact] + [Test] public async Task WithoutTimeout_ShouldHaveTimedOutMessage() { Exception exception = new("foo"); @@ -16,7 +16,7 @@ public async Task WithoutTimeout_ShouldHaveTimedOutMessage() await That(sut.InnerException).IsSameAs(exception); } - [Fact] + [Test] public async Task WithTimeout_ShouldIncludeTimeoutInMessage() { Exception exception = new("foo"); diff --git a/Tests/Mockolate.Tests/IParameterRefStructCompileProbe.cs b/Tests/Mockolate.Tests/IParameterRefStructCompileProbe.cs index 2feddbc5d..ea499263c 100644 --- a/Tests/Mockolate.Tests/IParameterRefStructCompileProbe.cs +++ b/Tests/Mockolate.Tests/IParameterRefStructCompileProbe.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests; public sealed class IParameterRefStructCompileProbe { - [Fact] + [Test] public async Task IParameterOfT_Accepts_RefStruct() { IParameter parameter = new AnyRefStructMatch(); diff --git a/Tests/Mockolate.Tests/Internals/TypeFormatterTests.cs b/Tests/Mockolate.Tests/Internals/TypeFormatterTests.cs index 9da9348ea..b52a8ca94 100644 --- a/Tests/Mockolate.Tests/Internals/TypeFormatterTests.cs +++ b/Tests/Mockolate.Tests/Internals/TypeFormatterTests.cs @@ -6,88 +6,38 @@ namespace Mockolate.Tests.Internals; public sealed class TypeFormatterTests { - [Theory] - [MemberData(nameof(ProvideTestData))] + [Test] + [MethodDataSource(nameof(ProvideTestData))] public async Task FormattedType_ShouldBeExpectedValue(string formattedType, string expectedValue) => await That(formattedType).IsEqualTo(expectedValue); - public static TheoryData ProvideTestData() + public static IEnumerable<(string, string)> ProvideTestData() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); - return new TheoryData - { - { - new PropertySetup(registry, "Foo").ToString(), "int Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "uint Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "nint Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "nuint Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "byte Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "sbyte Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "short Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "ushort Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "long Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "ulong Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "float Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "double Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "decimal Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "object Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "bool Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "bool? Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "char Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "string Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "int[] Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "DateTime? Foo" - }, - { - new PropertySetup(registry, "Foo").ToString(), "StreamReader Foo" - }, - { - new PropertySetup>(registry, "Foo").ToString(), "List Foo" - }, - { - new PropertySetup>(registry, "Foo").ToString(), "List Foo" - }, - { - new PropertySetup>(registry, "Foo").ToString(), "Dictionary Foo" - }, - }; + + yield return (new PropertySetup(registry, "Foo").ToString(), "int Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "uint Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "nint Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "nuint Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "byte Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "sbyte Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "short Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "ushort Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "long Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "ulong Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "float Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "double Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "decimal Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "object Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "bool Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "bool? Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "char Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "string Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "int[] Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "DateTime? Foo"); + yield return (new PropertySetup(registry, "Foo").ToString(), "StreamReader Foo"); + yield return (new PropertySetup>(registry, "Foo").ToString(), "List Foo"); + yield return (new PropertySetup>(registry, "Foo").ToString(), "List Foo"); + yield return (new PropertySetup>(registry, "Foo").ToString(), "Dictionary Foo"); } } diff --git a/Tests/Mockolate.Tests/ItTests.ContainsTests.cs b/Tests/Mockolate.Tests/ItTests.ContainsTests.cs index 2fbb90715..812747d45 100644 --- a/Tests/Mockolate.Tests/ItTests.ContainsTests.cs +++ b/Tests/Mockolate.Tests/ItTests.ContainsTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class ContainsTests { - [Fact] + [Test] public async Task ShouldMatchArrayParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -21,7 +21,7 @@ public async Task ShouldMatchArrayParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchEnumerableParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -34,7 +34,7 @@ public async Task ShouldMatchEnumerableParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchHashSetParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -47,7 +47,7 @@ public async Task ShouldMatchHashSetParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchListParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -60,7 +60,7 @@ public async Task ShouldMatchListParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchQueueParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -73,7 +73,7 @@ public async Task ShouldMatchQueueParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchReadOnlyListParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -86,7 +86,7 @@ public async Task ShouldMatchReadOnlyListParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchSetParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -109,7 +109,7 @@ public async Task ShouldMatchSetParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchStackParameter() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -122,12 +122,12 @@ public async Task ShouldMatchStackParameter() await That(miss).IsEqualTo(0); } - [Theory] - [InlineData(1, false)] - [InlineData(4, false)] - [InlineData(5, true)] - [InlineData(6, true)] - [InlineData(42, false)] + [Test] + [Arguments(1, false)] + [Arguments(4, false)] + [Arguments(5, true)] + [Arguments(6, true)] + [Arguments(42, false)] public async Task ShouldMatchWhenEnumerableContainsItem(int item, bool expectMatch) { IParameter> sut = It.Contains(item); @@ -137,7 +137,7 @@ public async Task ShouldMatchWhenEnumerableContainsItem(int item, bool expectMat await That(result).IsEqualTo(expectMatch); } - [Fact] + [Test] public async Task ShouldNotMatchWhenValueIsNotCollection() { IParameter> sut = It.Contains(5); @@ -147,7 +147,7 @@ public async Task ShouldNotMatchWhenValueIsNotCollection() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldNotMatchWhenValueIsNull() { IParameter> sut = It.Contains(5); @@ -157,7 +157,7 @@ public async Task ShouldNotMatchWhenValueIsNull() await That(result).IsFalse(); } - [Fact] + [Test] public async Task TypedArrayMatch_WithNullValue_ShouldNotMatch() { IParameter sut = It.Contains(5); @@ -167,7 +167,7 @@ public async Task TypedArrayMatch_WithNullValue_ShouldNotMatch() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldSupportVerify() { ICollectionConsumer sut = ICollectionConsumer.CreateMock(); @@ -180,7 +180,7 @@ public async Task ShouldSupportVerify() await That(sut.Mock.Verify.WithArray(It.Contains(99))).Never(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.Contains(5); @@ -191,7 +191,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_Using_ShouldReturnExpectedValue() { IParameter sut = It.Contains(5).Using(new AllEqualComparer()); @@ -202,7 +202,7 @@ public async Task ToString_Using_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task WithComparer_ShouldUseComparer() { IParameter sut = It.Contains(42).Using(new AllEqualComparer()); @@ -214,7 +214,7 @@ public async Task WithComparer_ShouldUseComparer() public sealed class DoTests { - [Fact] + [Test] public async Task Do_RegistersCallbackForArray() { It.IContainsParameter sut = It.Contains(1); @@ -227,7 +227,7 @@ public async Task Do_RegistersCallbackForArray() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForHashSet() { It.IContainsParameter sut = It.Contains(1); @@ -240,7 +240,7 @@ public async Task Do_RegistersCallbackForHashSet() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForICollection() { It.IContainsParameter sut = It.Contains(1); @@ -253,7 +253,7 @@ public async Task Do_RegistersCallbackForICollection() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIEnumerable() { It.IContainsParameter sut = It.Contains(1); @@ -266,7 +266,7 @@ public async Task Do_RegistersCallbackForIEnumerable() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIList() { It.IContainsParameter sut = It.Contains(1); @@ -279,7 +279,7 @@ public async Task Do_RegistersCallbackForIList() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIReadOnlyCollection() { It.IContainsParameter sut = It.Contains(1); @@ -292,7 +292,7 @@ public async Task Do_RegistersCallbackForIReadOnlyCollection() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIReadOnlyList() { It.IContainsParameter sut = It.Contains(1); @@ -305,7 +305,7 @@ public async Task Do_RegistersCallbackForIReadOnlyList() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForISet() { It.IContainsParameter sut = It.Contains(1); @@ -318,7 +318,7 @@ public async Task Do_RegistersCallbackForISet() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForList() { It.IContainsParameter sut = It.Contains(1); @@ -331,7 +331,7 @@ public async Task Do_RegistersCallbackForList() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForQueue() { It.IContainsParameter sut = It.Contains(1); @@ -345,7 +345,7 @@ public async Task Do_RegistersCallbackForQueue() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForStack() { It.IContainsParameter sut = It.Contains(1); @@ -359,7 +359,7 @@ public async Task Do_RegistersCallbackForStack() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task InvokeCallbacks_OnNonEnumerableValue_ShortCircuits() { It.IContainsParameter sut = It.Contains(1); @@ -371,7 +371,7 @@ public async Task InvokeCallbacks_OnNonEnumerableValue_ShortCircuits() await That(invocations).IsEqualTo(0); } - [Fact] + [Test] public async Task InvokeCallbacks_WithoutAnyRegistration_DoesNotThrow() { It.IContainsParameter sut = It.Contains(1); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyOutReadOnlySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyOutReadOnlySpanTests.cs index 9429d8132..179c6e7a1 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyOutReadOnlySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyOutReadOnlySpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsAnyOutReadOnlySpanTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutParameter> sut = It.IsAnyOutReadOnlySpan(); @@ -19,7 +19,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task TryGetValue_ShouldReturnFalse() { IOutParameter> sut = It.IsAnyOutReadOnlySpan(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyOutRefStructTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyOutRefStructTests.cs index 5b67dc7a3..cfdfa0dfe 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyOutRefStructTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyOutRefStructTests.cs @@ -7,7 +7,7 @@ public sealed partial class ItTests { public sealed class IsAnyOutRefStructTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutRefStructParameter> sut = It.IsAnyOutRefStruct>(); @@ -18,7 +18,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task TryGetValue_ShouldReturnFalse() { IOutRefStructParameter> sut = It.IsAnyOutRefStruct>(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyOutSpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyOutSpanTests.cs index a9536030d..8ff30ed65 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyOutSpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyOutSpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsAnyOutSpanTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutParameter> sut = It.IsAnyOutSpan(); @@ -19,7 +19,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task TryGetValue_ShouldReturnFalse() { IOutParameter> sut = It.IsAnyOutSpan(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyOutTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyOutTests.cs index db47ff3b1..f0684fc7b 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyOutTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyOutTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsAnyOutTests { - [Fact] + [Test] public async Task ShouldMatchInt() { IOutParameter sut = It.IsAnyOut(); @@ -16,7 +16,7 @@ public async Task ShouldMatchInt() await That(result).IsTrue(); } - [Fact] + [Test] public async Task ShouldMatchNull() { IOutParameter sut = It.IsAnyOut(); @@ -26,7 +26,7 @@ public async Task ShouldMatchNull() await That(result).IsTrue(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutParameter sut = It.IsAnyOut(); @@ -37,7 +37,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task TryGetValue_ShouldReturnFalse() { IOutParameter sut = It.IsAnyOut(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyReadOnlySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyReadOnlySpanTests.cs index 205678a17..417cef4d2 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyReadOnlySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyReadOnlySpanTests.cs @@ -8,10 +8,10 @@ public sealed partial class ItTests { public sealed class IsAnyReadOnlySpanTests { - [Theory] - [InlineData("")] - [InlineData("foo")] - [InlineData("bar")] + [Test] + [Arguments("")] + [Arguments("foo")] + [Arguments("bar")] public async Task ShouldAlwaysMatch(string value) { ReadOnlySpan valueSpan = value.AsSpan(); @@ -22,7 +22,7 @@ public async Task ShouldAlwaysMatch(string value) await That(result).IsTrue(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IVerifyReadOnlySpanParameter sut = It.IsAnyReadOnlySpan(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyRefReadOnlySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyRefReadOnlySpanTests.cs index a62285fe6..5a7448b41 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyRefReadOnlySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyRefReadOnlySpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsAnyRefReadOnlySpanTests { - [Fact] + [Test] public async Task GetValue_ShouldReturnSameValue() { IRefParameter> sut = It.IsAnyRefReadOnlySpan(); @@ -22,7 +22,7 @@ public async Task GetValue_ShouldReturnSameValue() await That(result.ReadOnlySpanValues.Length).IsEqualTo(3); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IRefParameter> sut = It.IsAnyRefReadOnlySpan(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyRefRefStructTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyRefRefStructTests.cs index 97df2be25..745555229 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyRefRefStructTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyRefRefStructTests.cs @@ -7,7 +7,7 @@ public sealed partial class ItTests { public sealed class IsAnyRefRefStructTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IRefRefStructParameter> sut = It.IsAnyRefRefStruct>(); @@ -18,7 +18,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task GetValue_ShouldReturnSameValue() { IRefRefStructParameter> sut = It.IsAnyRefRefStruct>(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyRefSpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyRefSpanTests.cs index 91029daf0..8ffef8cd5 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyRefSpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyRefSpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsAnyRefSpanTests { - [Fact] + [Test] public async Task GetValue_ShouldReturnSameValue() { IRefParameter> sut = It.IsAnyRefSpan(); @@ -22,7 +22,7 @@ public async Task GetValue_ShouldReturnSameValue() await That(result.SpanValues.Length).IsEqualTo(3); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IRefParameter> sut = It.IsAnyRefSpan(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyRefTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyRefTests.cs index 3046c03dd..09be00fc6 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyRefTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyRefTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsAnyRefTests { - [Fact] + [Test] public async Task ShouldMatchInt() { IRefParameter sut = It.IsAnyRef(); @@ -16,7 +16,7 @@ public async Task ShouldMatchInt() await That(result).IsTrue(); } - [Fact] + [Test] public async Task ShouldMatchNull() { IRefParameter sut = It.IsAnyRef(); @@ -26,7 +26,7 @@ public async Task ShouldMatchNull() await That(result).IsTrue(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IRefParameter sut = It.IsAnyRef(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnySpanTests.cs index 675a07a8b..e887ce7e9 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnySpanTests.cs @@ -8,10 +8,10 @@ public sealed partial class ItTests { public sealed class IsAnySpanTests { - [Theory] - [InlineData("")] - [InlineData("foo")] - [InlineData("bar")] + [Test] + [Arguments("")] + [Arguments("foo")] + [Arguments("bar")] public async Task ShouldAlwaysMatch(string value) { Span valueSpan = new(value.ToCharArray()); @@ -22,7 +22,7 @@ public async Task ShouldAlwaysMatch(string value) await That(result).IsTrue(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IVerifySpanParameter sut = It.IsAnySpan(); diff --git a/Tests/Mockolate.Tests/ItTests.IsAnyTests.cs b/Tests/Mockolate.Tests/ItTests.IsAnyTests.cs index d4ab0764e..7eabbb5b7 100644 --- a/Tests/Mockolate.Tests/ItTests.IsAnyTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsAnyTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsAnyTests { - [Fact] + [Test] public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentUsage() { _ = It.IsAny().Do(_ => throw new InvalidOperationException("callback leaked from prior use")); @@ -16,7 +16,7 @@ public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentU await That(() => ((IParameterMatch)subsequent).InvokeCallbacks(42)).DoesNotThrow(); } - [Fact] + [Test] public async Task CachedMatcher_MonitorFromPriorUsage_ShouldNotLeakIntoSubsequentUsage() { _ = It.IsAny().Monitor(out IParameterMonitor leakedMonitor); @@ -27,10 +27,10 @@ public async Task CachedMatcher_MonitorFromPriorUsage_ShouldNotLeakIntoSubsequen await That(leakedMonitor.Values).IsEmpty(); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData("foo")] + [Test] + [Arguments(null)] + [Arguments("")] + [Arguments("foo")] public async Task ShouldAlwaysMatch(string? value) { IParameter sut = It.IsAny(); @@ -40,7 +40,7 @@ public async Task ShouldAlwaysMatch(string? value) await That(result).IsTrue(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.IsAny(); diff --git a/Tests/Mockolate.Tests/ItTests.IsFalseTests.cs b/Tests/Mockolate.Tests/ItTests.IsFalseTests.cs index 6212c3569..8e30137b4 100644 --- a/Tests/Mockolate.Tests/ItTests.IsFalseTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsFalseTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsFalseTests { - [Fact] + [Test] public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentUsage() { _ = It.IsFalse().Do(_ => throw new InvalidOperationException("callback leaked from prior use")); @@ -16,9 +16,9 @@ public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentU await That(() => ((IParameterMatch)subsequent).InvokeCallbacks(false)).DoesNotThrow(); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task False_ShouldMatchWhenFalse(bool value, int expectedCount) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -29,7 +29,7 @@ public async Task False_ShouldMatchWhenFalse(bool value, int expectedCount) await That(sut.Mock.Verify.DoSomething(null, It.IsFalse())).Exactly(expectedCount); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.IsFalse(); diff --git a/Tests/Mockolate.Tests/ItTests.IsInRangeTests.cs b/Tests/Mockolate.Tests/ItTests.IsInRangeTests.cs index 35010e426..f6aa11c5d 100644 --- a/Tests/Mockolate.Tests/ItTests.IsInRangeTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsInRangeTests.cs @@ -6,14 +6,14 @@ public sealed partial class ItTests { public sealed class IsInRangeTests { - [Theory] - [InlineData(3, 5, false)] - [InlineData(3, 6, true)] - [InlineData(2, 4, false)] - [InlineData(5, 5, false)] - [InlineData(5, 6, false)] - [InlineData(4, 6, true)] - [InlineData(6, 7, false)] + [Test] + [Arguments(3, 5, false)] + [Arguments(3, 6, true)] + [Arguments(2, 4, false)] + [Arguments(5, 5, false)] + [Arguments(5, 6, false)] + [Arguments(4, 6, true)] + [Arguments(6, 7, false)] public async Task ExecuteWith5_Exclusive_ShouldMatchWhenRangeContains5(int minimum, int maximum, bool expectFound) { @@ -25,14 +25,14 @@ await That(sut.Mock.Verify.DoSomethingWithInt(It.IsInRange(minimum, maximum).Exc .Exactly(expectFound ? 1 : 0); } - [Theory] - [InlineData(3, 5, true)] - [InlineData(3, 6, true)] - [InlineData(2, 4, false)] - [InlineData(5, 5, true)] - [InlineData(5, 6, true)] - [InlineData(4, 6, true)] - [InlineData(6, 7, false)] + [Test] + [Arguments(3, 5, true)] + [Arguments(3, 6, true)] + [Arguments(2, 4, false)] + [Arguments(5, 5, true)] + [Arguments(5, 6, true)] + [Arguments(4, 6, true)] + [Arguments(6, 7, false)] public async Task ExecuteWith5_Inclusive_ShouldMatchWhenRangeContains5(int minimum, int maximum, bool expectFound) { @@ -46,14 +46,14 @@ await That(sut.Mock.Verify.DoSomethingWithInt(range.Inclusive())) .Exactly(expectFound ? 1 : 0); } - [Theory] - [InlineData(3, 5, true)] - [InlineData(3, 6, true)] - [InlineData(2, 4, false)] - [InlineData(5, 5, true)] - [InlineData(5, 6, true)] - [InlineData(4, 6, true)] - [InlineData(6, 7, false)] + [Test] + [Arguments(3, 5, true)] + [Arguments(3, 6, true)] + [Arguments(2, 4, false)] + [Arguments(5, 5, true)] + [Arguments(5, 6, true)] + [Arguments(4, 6, true)] + [Arguments(6, 7, false)] public async Task ExecuteWith5_ShouldMatchWhenRangeContains5(int minimum, int maximum, bool expectFound) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -64,7 +64,7 @@ await That(sut.Mock.Verify.DoSomethingWithInt(It.IsInRange(minimum, maximum))) .Exactly(expectFound ? 1 : 0); } - [Fact] + [Test] public async Task ToString_Exclusive_ShouldReturnExpectedValue() { IParameter sut = It.IsInRange(1.1, 4.1).Exclusive(); @@ -75,7 +75,7 @@ public async Task ToString_Exclusive_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_Inclusive_ShouldReturnExpectedValue() { IParameter sut = It.IsInRange(1, 4); @@ -86,7 +86,7 @@ public async Task ToString_Inclusive_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task WithMinimumGreaterThanMaximum_ShouldThrowArgumentOutOfRangeException() { void Act() diff --git a/Tests/Mockolate.Tests/ItTests.IsNotNullTests.cs b/Tests/Mockolate.Tests/ItTests.IsNotNullTests.cs index c63fed6bf..693b4eb57 100644 --- a/Tests/Mockolate.Tests/ItTests.IsNotNullTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsNotNullTests.cs @@ -7,7 +7,7 @@ public sealed partial class ItTests { public sealed class IsNotNullTests { - [Fact] + [Test] public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentUsage() { _ = It.IsNotNull().Do(_ => throw new InvalidOperationException("callback leaked from prior use")); @@ -17,9 +17,9 @@ public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentU await That(() => ((IParameterMatch)subsequent).InvokeCallbacks("value")).DoesNotThrow(); } - [Theory] - [InlineData(null, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(null, 0)] + [Arguments(1, 1)] public async Task NotNull_ShouldMatchWhenNotNull(int? value, int expectedCount) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -30,7 +30,7 @@ public async Task NotNull_ShouldMatchWhenNotNull(int? value, int expectedCount) await That(sut.Mock.Verify.DoSomething(It.IsNotNull(), It.Is(true))).Exactly(expectedCount); } - [Fact] + [Test] public async Task ShouldReturnSharedInstance_WhenToStringIsOmitted() { IParameter first = It.IsNotNull(); @@ -39,7 +39,7 @@ public async Task ShouldReturnSharedInstance_WhenToStringIsOmitted() await That(first).IsSameAs(second); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.IsNotNull(); @@ -50,7 +50,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithCustomValue_ShouldReturnCustomValue() { IParameter sut = It.IsNotNull("custom"); @@ -61,7 +61,7 @@ public async Task ToString_WithCustomValue_ShouldReturnCustomValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task WhenTypeDoesNotMatch_ShouldReturnTrue() { MyFlavor flavor = MyFlavor.Dark; @@ -72,10 +72,10 @@ public async Task WhenTypeDoesNotMatch_ShouldReturnTrue() await That(result).IsTrue(); } - [Theory] - [InlineData(null, false)] - [InlineData("", true)] - [InlineData("foo", true)] + [Test] + [Arguments(null, false)] + [Arguments("", true)] + [Arguments("foo", true)] public async Task WithValue_Nullable_ShouldMatchWhenNotNull(string? value, bool expectMatch) { IParameter sut = It.IsNotNull(); diff --git a/Tests/Mockolate.Tests/ItTests.IsNotOneOfTests.cs b/Tests/Mockolate.Tests/ItTests.IsNotOneOfTests.cs index b7cecb8b2..ae07a0dca 100644 --- a/Tests/Mockolate.Tests/ItTests.IsNotOneOfTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsNotOneOfTests.cs @@ -7,15 +7,15 @@ public sealed partial class ItTests { public sealed class IsNotOneOfTests { - [Theory] - [InlineData(1, true)] - [InlineData(4, true)] - [InlineData(5, false)] - [InlineData(6, false)] - [InlineData(7, false)] - [InlineData(8, true)] - [InlineData(-5, true)] - [InlineData(42, true)] + [Test] + [Arguments(1, true)] + [Arguments(4, true)] + [Arguments(5, false)] + [Arguments(6, false)] + [Arguments(7, false)] + [Arguments(8, true)] + [Arguments(-5, true)] + [Arguments(42, true)] public async Task ShouldMatchWhenNotEqualToAny(int value, bool expectMatch) { IParameter sut = It.IsNotOneOf(5, 6, 7); @@ -25,7 +25,7 @@ public async Task ShouldMatchWhenNotEqualToAny(int value, bool expectMatch) await That(result).IsEqualTo(expectMatch); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInSetup() { IMyServiceIsNotOneOf sut = IMyServiceIsNotOneOf.CreateMock(); @@ -42,7 +42,7 @@ public async Task ShouldSupportCovarianceInSetup() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInVerify() { IMyServiceIsNotOneOf sut = IMyServiceIsNotOneOf.CreateMock(); @@ -58,7 +58,7 @@ await That(sut.Mock.Verify.DoSomething(It.IsNotOneOf(other))).Never() .Because("'other' IS in [other]"); } - [Fact] + [Test] public async Task ToString_Using_ShouldReturnExpectedValue() { IParameter sut = It.IsNotOneOf(3, 5).Using(new AllEqualComparer()); @@ -69,7 +69,7 @@ public async Task ToString_Using_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithNullableIntValues_ShouldReturnExpectedValue() { IParameter sut = It.IsNotOneOf(3, null, 5); @@ -80,7 +80,7 @@ public async Task ToString_WithNullableIntValues_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithStringValues_ShouldReturnExpectedValue() { IParameter sut = It.IsNotOneOf("foo", "bar"); @@ -91,7 +91,7 @@ public async Task ToString_WithStringValues_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task WhenTypeDoesNotMatch_ShouldReturnTrue() { MyFlavor flavor = MyFlavor.Dark; @@ -102,10 +102,10 @@ public async Task WhenTypeDoesNotMatch_ShouldReturnTrue() await That(result).IsTrue(); } - [Theory] - [InlineData(1)] - [InlineData(5)] - [InlineData(-42)] + [Test] + [Arguments(1)] + [Arguments(5)] + [Arguments(-42)] public async Task WithComparer_ShouldUseComparer(int value) { IParameter sut = It.IsNotOneOf(4, 5, 6).Using(new AllEqualComparer()); diff --git a/Tests/Mockolate.Tests/ItTests.IsNotTests.cs b/Tests/Mockolate.Tests/ItTests.IsNotTests.cs index 921a1faf1..334094da3 100644 --- a/Tests/Mockolate.Tests/ItTests.IsNotTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsNotTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsNotTests { - [Fact] + [Test] public async Task ShouldCorrectlyHandleNull() { IMyService sut = IMyService.CreateMock(); @@ -21,7 +21,7 @@ public async Task ShouldCorrectlyHandleNull() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldCorrectlyHandleNullWithCovariance() { IMyService sut = IMyService.CreateMock(); @@ -36,11 +36,11 @@ public async Task ShouldCorrectlyHandleNullWithCovariance() await That(result2).IsEqualTo(0); } - [Theory] - [InlineData(1, true)] - [InlineData(5, false)] - [InlineData(-5, true)] - [InlineData(42, true)] + [Test] + [Arguments(1, true)] + [Arguments(5, false)] + [Arguments(-5, true)] + [Arguments(42, true)] public async Task ShouldMatchWhenNotEqual(int value, bool expectMatch) { IParameter sut = It.IsNot(5); @@ -50,7 +50,7 @@ public async Task ShouldMatchWhenNotEqual(int value, bool expectMatch) await That(result).IsEqualTo(expectMatch); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInSetup() { IMyService sut = IMyService.CreateMock(); @@ -66,7 +66,7 @@ public async Task ShouldSupportCovarianceInSetup() await That(result2).IsEqualTo(3); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.IsNot("foo"); @@ -77,7 +77,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithComparer_ShouldReturnExpectedValue() { IParameter sut = It.IsNot(4).Using(new AllEqualComparer()); @@ -88,10 +88,10 @@ public async Task ToString_WithComparer_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Theory] - [InlineData(1)] - [InlineData(5)] - [InlineData(-42)] + [Test] + [Arguments(1)] + [Arguments(5)] + [Arguments(-42)] public async Task WithComparer_ShouldUseComparer(int value) { IParameter sut = It.IsNot(5).Using(new AllEqualComparer()); diff --git a/Tests/Mockolate.Tests/ItTests.IsNullTests.cs b/Tests/Mockolate.Tests/ItTests.IsNullTests.cs index 144024366..d7b36e5a8 100644 --- a/Tests/Mockolate.Tests/ItTests.IsNullTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsNullTests.cs @@ -7,7 +7,7 @@ public sealed partial class ItTests { public sealed class IsNullTests { - [Fact] + [Test] public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentUsage() { _ = It.IsNull().Do(_ => throw new InvalidOperationException("callback leaked from prior use")); @@ -17,9 +17,9 @@ public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentU await That(() => ((IParameterMatch)subsequent).InvokeCallbacks(null)).DoesNotThrow(); } - [Theory] - [InlineData(null, 1)] - [InlineData(1, 0)] + [Test] + [Arguments(null, 1)] + [Arguments(1, 0)] public async Task Null_ShouldMatchWhenNull(int? value, int expectedCount) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -30,7 +30,7 @@ public async Task Null_ShouldMatchWhenNull(int? value, int expectedCount) await That(sut.Mock.Verify.DoSomething(null, It.Is(true))).Exactly(expectedCount); } - [Fact] + [Test] public async Task ShouldReturnSharedInstance_WhenToStringIsOmitted() { IParameter first = It.IsNull(); @@ -39,7 +39,7 @@ public async Task ShouldReturnSharedInstance_WhenToStringIsOmitted() await That(first).IsSameAs(second); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.IsNull(); @@ -50,7 +50,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task WhenTypeDoesNotMatch_ShouldReturnFalse() { MyFlavor flavor = MyFlavor.Dark; @@ -61,10 +61,10 @@ public async Task WhenTypeDoesNotMatch_ShouldReturnFalse() await That(result).IsFalse(); } - [Theory] - [InlineData(null, true)] - [InlineData("", false)] - [InlineData("foo", false)] + [Test] + [Arguments(null, true)] + [Arguments("", false)] + [Arguments("foo", false)] public async Task WithValue_Nullable_ShouldMatchWhenEqual(string? value, bool expectMatch) { IParameter sut = It.IsNull(); diff --git a/Tests/Mockolate.Tests/ItTests.IsOneOfTests.cs b/Tests/Mockolate.Tests/ItTests.IsOneOfTests.cs index 4e74afde4..16a0343c0 100644 --- a/Tests/Mockolate.Tests/ItTests.IsOneOfTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsOneOfTests.cs @@ -6,15 +6,15 @@ public sealed partial class ItTests { public sealed class IsOneOfTests { - [Theory] - [InlineData(1, false)] - [InlineData(4, false)] - [InlineData(5, true)] - [InlineData(6, true)] - [InlineData(7, true)] - [InlineData(8, false)] - [InlineData(-5, false)] - [InlineData(42, false)] + [Test] + [Arguments(1, false)] + [Arguments(4, false)] + [Arguments(5, true)] + [Arguments(6, true)] + [Arguments(7, true)] + [Arguments(8, false)] + [Arguments(-5, false)] + [Arguments(42, false)] public async Task ShouldMatchWhenEqualToAny(int value, bool expectMatch) { IParameter sut = It.IsOneOf(5, 6, 7); @@ -24,7 +24,7 @@ public async Task ShouldMatchWhenEqualToAny(int value, bool expectMatch) await That(result).IsEqualTo(expectMatch); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInSetup() { IMyService sut = IMyService.CreateMock(); @@ -41,7 +41,7 @@ public async Task ShouldSupportCovarianceInSetup() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInVerify() { IMyService sut = IMyService.CreateMock(); @@ -61,7 +61,7 @@ public async Task ShouldSupportCovarianceInVerify() await That(sut.Mock.Verify.DoSomething(It.IsOneOf(other1, other2))).Never(); } - [Fact] + [Test] public async Task ToString_Using_ShouldReturnExpectedValue() { IParameter sut = It.IsOneOf(3, 5).Using(new AllEqualComparer()); @@ -72,7 +72,7 @@ public async Task ToString_Using_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithNullableIntValues_ShouldReturnExpectedValue() { IParameter sut = It.IsOneOf(3, null, 5); @@ -83,7 +83,7 @@ public async Task ToString_WithNullableIntValues_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithStringValues_ShouldReturnExpectedValue() { IParameter sut = It.IsOneOf("foo", "bar"); @@ -94,10 +94,10 @@ public async Task ToString_WithStringValues_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Theory] - [InlineData(1)] - [InlineData(5)] - [InlineData(-42)] + [Test] + [Arguments(1)] + [Arguments(5)] + [Arguments(-42)] public async Task WithComparer_ShouldUseComparer(int value) { IParameter sut = It.IsOneOf(4, 5, 6).Using(new AllEqualComparer()); diff --git a/Tests/Mockolate.Tests/ItTests.IsOutReadOnlySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsOutReadOnlySpanTests.cs index 6412ee98e..2eb9642df 100644 --- a/Tests/Mockolate.Tests/ItTests.IsOutReadOnlySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsOutReadOnlySpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsOutReadOnlySpanTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutParameter> sut = @@ -20,7 +20,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task TryGetValue_ShouldReturnSetterValue() { IOutParameter> sut = diff --git a/Tests/Mockolate.Tests/ItTests.IsOutSpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsOutSpanTests.cs index e6af9e63a..cb1418b9f 100644 --- a/Tests/Mockolate.Tests/ItTests.IsOutSpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsOutSpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsOutSpanTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutParameter> sut = @@ -20,7 +20,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task TryGetValue_ShouldReturnSetterValue() { IOutParameter> sut = diff --git a/Tests/Mockolate.Tests/ItTests.IsOutTests.cs b/Tests/Mockolate.Tests/ItTests.IsOutTests.cs index 995fe8688..ad15b5969 100644 --- a/Tests/Mockolate.Tests/ItTests.IsOutTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsOutTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsOutTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IOutParameter sut = It.IsOut(() => 3); @@ -17,7 +17,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_Verify_ShouldReturnExpectedValue() { IVerifyOutParameter sut = It.IsOut(); @@ -29,7 +29,7 @@ public async Task ToString_Verify_ShouldReturnExpectedValue() } #if NET9_0_OR_GREATER - [Fact] + [Test] public async Task ToString_WithRefStructFactory_ShouldReturnExpectedValue() { IOutRefStructParameter> sut = It.IsOut>(() => default); @@ -41,9 +41,9 @@ public async Task ToString_WithRefStructFactory_ShouldReturnExpectedValue() } #endif - [Theory] - [InlineData(42)] - [InlineData(-2)] + [Test] + [Arguments(42)] + [Arguments(-2)] public async Task WithOut_ShouldReturnValue(int? value) { IOutParameter sut = It.IsOut(() => value); @@ -54,7 +54,7 @@ public async Task WithOut_ShouldReturnValue(int? value) await That(result).IsEqualTo(value); } - [Fact] + [Test] public async Task WithOut_Verify_ShouldAlwaysMatch() { IVerifyOutParameter sut = It.IsOut(); diff --git a/Tests/Mockolate.Tests/ItTests.IsReadOnlySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsReadOnlySpanTests.cs index d0b1bddaa..40cbfa4ac 100644 --- a/Tests/Mockolate.Tests/ItTests.IsReadOnlySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsReadOnlySpanTests.cs @@ -8,10 +8,10 @@ public sealed partial class ItTests { public sealed class IsReadOnlySpanTests { - [Theory] - [InlineData("", false)] - [InlineData("foo", false)] - [InlineData("bar", true)] + [Test] + [Arguments("", false)] + [Arguments("foo", false)] + [Arguments("bar", true)] public async Task ShouldAlwaysMatch(string value, bool expectSuccess) { ReadOnlySpan valueSpan = value.AsSpan(); @@ -22,7 +22,7 @@ public async Task ShouldAlwaysMatch(string value, bool expectSuccess) await That(result).IsEqualTo(expectSuccess); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IVerifyReadOnlySpanParameter sut = It.IsReadOnlySpan(c => c[0] == 'a'); diff --git a/Tests/Mockolate.Tests/ItTests.IsRefReadOnlySpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsRefReadOnlySpanTests.cs index 5b6b92294..95fd66c79 100644 --- a/Tests/Mockolate.Tests/ItTests.IsRefReadOnlySpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsRefReadOnlySpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsRefReadOnlySpanTests { - [Fact] + [Test] public async Task ToString_WithPredicateAndSetter_ShouldReturnExpectedValue() { IRefParameter> sut = It.IsRefReadOnlySpan( @@ -22,7 +22,7 @@ public async Task ToString_WithPredicateAndSetter_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithPredicateOnly_ShouldReturnExpectedValue() { IRefParameter> sut = @@ -35,7 +35,7 @@ public async Task ToString_WithPredicateOnly_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithSetterOnly_ShouldReturnExpectedValue() { IRefParameter> sut = It.IsRefReadOnlySpan(value => value); diff --git a/Tests/Mockolate.Tests/ItTests.IsRefSpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsRefSpanTests.cs index 832da341a..7939b81d5 100644 --- a/Tests/Mockolate.Tests/ItTests.IsRefSpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsRefSpanTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class IsRefSpanTests { - [Fact] + [Test] public async Task ToString_WithPredicateAndSetter_ShouldReturnExpectedValue() { IRefParameter> sut = It.IsRefSpan( @@ -22,7 +22,7 @@ public async Task ToString_WithPredicateAndSetter_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithPredicateOnly_ShouldReturnExpectedValue() { IRefParameter> sut = @@ -34,7 +34,7 @@ public async Task ToString_WithPredicateOnly_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithSetterOnly_ShouldReturnExpectedValue() { IRefParameter> sut = It.IsRefSpan(value => value); diff --git a/Tests/Mockolate.Tests/ItTests.IsRefTests.cs b/Tests/Mockolate.Tests/ItTests.IsRefTests.cs index 70c9d7146..f6e771540 100644 --- a/Tests/Mockolate.Tests/ItTests.IsRefTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsRefTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsRefTests { - [Fact] + [Test] public async Task PredicateOnly_ShouldNotChangeValue() { IRefParameter sut = It.IsRef(_ => true); @@ -16,9 +16,9 @@ public async Task PredicateOnly_ShouldNotChangeValue() await That(result).IsEqualTo("foo"); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task ShouldMatchForExpectedResult(bool predicateValue) { IRefParameter sut = It.IsRef(_ => predicateValue, _ => ""); @@ -28,7 +28,7 @@ public async Task ShouldMatchForExpectedResult(bool predicateValue) await That(result).IsEqualTo(predicateValue); } - [Fact] + [Test] public async Task Verify_ShouldAlwaysMatch() { IVerifyRefParameter sut = It.IsRef(); @@ -40,7 +40,7 @@ public async Task Verify_ShouldAlwaysMatch() } #if NET9_0_OR_GREATER - [Fact] + [Test] public async Task ToString_WithRefStructTransform_ShouldReturnExpectedValue() { IRefRefStructParameter> sut = It.IsRef>(value => value); @@ -51,7 +51,7 @@ public async Task ToString_WithRefStructTransform_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithRefStructPredicateAndTransform_ShouldReturnExpectedValue() { IRefRefStructParameter> sut = @@ -63,7 +63,7 @@ public async Task ToString_WithRefStructPredicateAndTransform_ShouldReturnExpect await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithRefStructPredicateOnly_ShouldReturnExpectedValue() { IRefRefStructParameter> sut = It.IsRef>(value => value.Length > 0); diff --git a/Tests/Mockolate.Tests/ItTests.IsSpanTests.cs b/Tests/Mockolate.Tests/ItTests.IsSpanTests.cs index 5af9b53fb..e3e56c335 100644 --- a/Tests/Mockolate.Tests/ItTests.IsSpanTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsSpanTests.cs @@ -8,10 +8,10 @@ public sealed partial class ItTests { public sealed class IsSpanTests { - [Theory] - [InlineData("", false)] - [InlineData("foo", false)] - [InlineData("bar", true)] + [Test] + [Arguments("", false)] + [Arguments("foo", false)] + [Arguments("bar", true)] public async Task ShouldAlwaysMatch(string value, bool expectSuccess) { Span valueSpan = new(value.ToCharArray()); @@ -22,7 +22,7 @@ public async Task ShouldAlwaysMatch(string value, bool expectSuccess) await That(result).IsEqualTo(expectSuccess); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IVerifySpanParameter sut = It.IsSpan(c => c[0] == 'a'); diff --git a/Tests/Mockolate.Tests/ItTests.IsTests.cs b/Tests/Mockolate.Tests/ItTests.IsTests.cs index d29a7e3ac..1313daa36 100644 --- a/Tests/Mockolate.Tests/ItTests.IsTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsTests.cs @@ -7,11 +7,11 @@ public sealed partial class ItTests { public sealed class IsTests { - [Theory] - [InlineData(1, false)] - [InlineData(5, true)] - [InlineData(-5, false)] - [InlineData(42, false)] + [Test] + [Arguments(1, false)] + [Arguments(5, true)] + [Arguments(-5, false)] + [Arguments(42, false)] public async Task ShouldMatchWhenEqual(int value, bool expectMatch) { IParameter sut = It.Is(5); @@ -21,7 +21,7 @@ public async Task ShouldMatchWhenEqual(int value, bool expectMatch) await That(result).IsEqualTo(expectMatch); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInSetup() { IMyService sut = IMyService.CreateMock(); @@ -37,7 +37,7 @@ public async Task ShouldSupportCovarianceInSetup() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.Is("foo"); @@ -48,7 +48,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithComparer_ShouldReturnExpectedValue() { IParameter sut = It.Is(4).Using(new AllEqualComparer()); @@ -59,10 +59,10 @@ public async Task ToString_WithComparer_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Theory] - [InlineData(1)] - [InlineData(5)] - [InlineData(-42)] + [Test] + [Arguments(1)] + [Arguments(5)] + [Arguments(-42)] public async Task WithComparer_ShouldUseComparer(int value) { IParameter sut = It.Is(5).Using(new AllEqualComparer()); @@ -72,7 +72,7 @@ public async Task WithComparer_ShouldUseComparer(int value) await That(result).IsTrue(); } - [Fact] + [Test] public async Task Within_AfterUsing_ShouldReplaceTheComparer() { IParameter sut = It.Is(5.0).Using(EqualityComparer.Default).Within(0.1); @@ -83,12 +83,12 @@ public async Task Within_AfterUsing_ShouldReplaceTheComparer() await That(sut.ToString()).IsEqualTo("It.Is(5.0).Within(0.1)"); } - [Theory] - [InlineData(-11, false)] - [InlineData(-10, true)] - [InlineData(0, true)] - [InlineData(10, true)] - [InlineData(11, false)] + [Test] + [Arguments(-11, false)] + [Arguments(-10, true)] + [Arguments(0, true)] + [Arguments(10, true)] + [Arguments(11, false)] public async Task Within_DateTime_ShouldMatchWhenWithinTolerance(int offsetInSeconds, bool expectMatch) { DateTime expected = new(2024, 5, 6, 7, 8, 9, DateTimeKind.Utc); @@ -99,12 +99,12 @@ public async Task Within_DateTime_ShouldMatchWhenWithinTolerance(int offsetInSec await That(result).IsEqualTo(expectMatch); } - [Theory] - [InlineData(-11, false)] - [InlineData(-10, true)] - [InlineData(0, true)] - [InlineData(10, true)] - [InlineData(11, false)] + [Test] + [Arguments(-11, false)] + [Arguments(-10, true)] + [Arguments(0, true)] + [Arguments(10, true)] + [Arguments(11, false)] public async Task Within_DateTimeOffset_ShouldMatchWhenWithinTolerance(int offsetInSeconds, bool expectMatch) { DateTimeOffset expected = new(2024, 5, 6, 7, 8, 9, TimeSpan.FromHours(2)); @@ -115,12 +115,12 @@ public async Task Within_DateTimeOffset_ShouldMatchWhenWithinTolerance(int offse await That(result).IsEqualTo(expectMatch); } - [Theory] - [InlineData(4.85, false)] - [InlineData(4.9, true)] - [InlineData(5.0, true)] - [InlineData(5.1, true)] - [InlineData(5.15, false)] + [Test] + [Arguments(4.85, false)] + [Arguments(4.9, true)] + [Arguments(5.0, true)] + [Arguments(5.1, true)] + [Arguments(5.15, false)] public async Task Within_Decimal_ShouldMatchWhenWithinTolerance(double value, bool expectMatch) { IParameter sut = It.Is(5.0m).Within(0.1m); @@ -130,12 +130,12 @@ public async Task Within_Decimal_ShouldMatchWhenWithinTolerance(double value, bo await That(result).IsEqualTo(expectMatch); } - [Theory] - [InlineData(4.85, false)] - [InlineData(4.9, true)] - [InlineData(5.0, true)] - [InlineData(5.1, true)] - [InlineData(5.15, false)] + [Test] + [Arguments(4.85, false)] + [Arguments(4.9, true)] + [Arguments(5.0, true)] + [Arguments(5.1, true)] + [Arguments(5.15, false)] public async Task Within_Double_ShouldMatchWhenWithinTolerance(double value, bool expectMatch) { IParameter sut = It.Is(5.0).Within(0.1); @@ -145,10 +145,10 @@ public async Task Within_Double_ShouldMatchWhenWithinTolerance(double value, boo await That(result).IsEqualTo(expectMatch); } - [Theory] - [InlineData(double.NaN)] - [InlineData(double.PositiveInfinity)] - [InlineData(double.NegativeInfinity)] + [Test] + [Arguments(double.NaN)] + [Arguments(double.PositiveInfinity)] + [Arguments(double.NegativeInfinity)] public async Task Within_Double_WithNonFiniteValue_ShouldMatchItself(double value) { IParameter sut = It.Is(value).Within(0.1); @@ -158,12 +158,12 @@ public async Task Within_Double_WithNonFiniteValue_ShouldMatchItself(double valu await That(result).IsTrue(); } - [Theory] - [InlineData(4.85f, false)] - [InlineData(4.9f, true)] - [InlineData(5.0f, true)] - [InlineData(5.1f, true)] - [InlineData(5.15f, false)] + [Test] + [Arguments(4.85f, false)] + [Arguments(4.9f, true)] + [Arguments(5.0f, true)] + [Arguments(5.1f, true)] + [Arguments(5.15f, false)] public async Task Within_Float_ShouldMatchWhenWithinTolerance(float value, bool expectMatch) { IParameter sut = It.Is(5.0f).Within(0.1f); @@ -173,10 +173,10 @@ public async Task Within_Float_ShouldMatchWhenWithinTolerance(float value, bool await That(result).IsEqualTo(expectMatch); } - [Theory] - [InlineData(float.NaN)] - [InlineData(float.PositiveInfinity)] - [InlineData(float.NegativeInfinity)] + [Test] + [Arguments(float.NaN)] + [Arguments(float.PositiveInfinity)] + [Arguments(float.NegativeInfinity)] public async Task Within_Float_WithNonFiniteValue_ShouldMatchItself(float value) { IParameter sut = It.Is(value).Within(0.1f); @@ -186,7 +186,7 @@ public async Task Within_Float_WithNonFiniteValue_ShouldMatchItself(float value) await That(result).IsTrue(); } - [Fact] + [Test] public async Task Within_NaNTolerance_ShouldThrowArgumentOutOfRangeException() { await That(() => It.Is(5.0).Within(double.NaN)).Throws() @@ -195,7 +195,7 @@ await That(() => It.Is(5.0f).Within(float.NaN)).Throws It.Is(5.0).Within(-0.1)).Throws() @@ -210,7 +210,7 @@ await That(() => It.Is(TimeSpan.Zero).Within(TimeSpan.FromSeconds(-1))) .Throws().WithParamName("tolerance"); } - [Fact] + [Test] public async Task Within_Nullable_ShouldMatchWhenWithinTolerance() { DateTime dateTime = new(2024, 5, 6, 7, 8, 9, DateTimeKind.Utc); @@ -234,7 +234,7 @@ await That(((IParameterMatch)timeSpanMatcher).Matches(timeSpan.Add(Ti .IsTrue(); } - [Fact] + [Test] public async Task Within_Nullable_ShouldOnlyMatchNullWithNull() { IParameter nullMatcher = It.Is(null).Within(0.1); @@ -246,7 +246,7 @@ public async Task Within_Nullable_ShouldOnlyMatchNullWithNull() await That(((IParameterMatch)valueMatcher).Matches(4.85)).IsFalse(); } - [Fact] + [Test] public async Task Within_ShouldVerifyMockInvocation() { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -257,7 +257,7 @@ public async Task Within_ShouldVerifyMockInvocation() await That(sut.Mock.Verify.DoSomethingWithDouble(It.Is(5.0).Within(0.01))).Never(); } - [Fact] + [Test] public async Task Within_ShouldVerifyMockInvocationWithNullableParameter() { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -268,7 +268,7 @@ public async Task Within_ShouldVerifyMockInvocationWithNullableParameter() await That(sut.Mock.Verify.DoSomethingWithNullableDouble(It.Is(5.0).Within(0.01))).Never(); } - [Fact] + [Test] public async Task Within_ThenUsing_ShouldReplaceTheTolerance() { // Within() does not return an It.IIsParameter, so Using() can only be reached via the original reference. @@ -282,12 +282,12 @@ public async Task Within_ThenUsing_ShouldReplaceTheTolerance() await That(sut.ToString()).IsEqualTo("It.Is(5.0).Using(EqualityComparer.Default)"); } - [Theory] - [InlineData(-11, false)] - [InlineData(-10, true)] - [InlineData(0, true)] - [InlineData(10, true)] - [InlineData(11, false)] + [Test] + [Arguments(-11, false)] + [Arguments(-10, true)] + [Arguments(0, true)] + [Arguments(10, true)] + [Arguments(11, false)] public async Task Within_TimeSpan_ShouldMatchWhenWithinTolerance(int offsetInSeconds, bool expectMatch) { TimeSpan expected = TimeSpan.FromMinutes(3); @@ -298,7 +298,7 @@ public async Task Within_TimeSpan_ShouldMatchWhenWithinTolerance(int offsetInSec await That(result).IsEqualTo(expectMatch); } - [Fact] + [Test] public async Task Within_ToString_ShouldReturnExpectedValue() { double tolerance = 0.1; @@ -310,7 +310,7 @@ public async Task Within_ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Within_WithExtremeValues_ShouldNotOverflow() { IParameter decimalMatcher = It.Is(decimal.MaxValue).Within(1m); diff --git a/Tests/Mockolate.Tests/ItTests.IsTrueTests.cs b/Tests/Mockolate.Tests/ItTests.IsTrueTests.cs index 7b415263d..625cf19e1 100644 --- a/Tests/Mockolate.Tests/ItTests.IsTrueTests.cs +++ b/Tests/Mockolate.Tests/ItTests.IsTrueTests.cs @@ -6,7 +6,7 @@ public sealed partial class ItTests { public sealed class IsTrueTests { - [Fact] + [Test] public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentUsage() { _ = It.IsTrue().Do(_ => throw new InvalidOperationException("callback leaked from prior use")); @@ -16,7 +16,7 @@ public async Task CachedMatcher_CallbackFromPriorDo_ShouldNotLeakIntoSubsequentU await That(() => ((IParameterMatch)subsequent).InvokeCallbacks(true)).DoesNotThrow(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.IsTrue(); @@ -27,9 +27,9 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Theory] - [InlineData(true, 1)] - [InlineData(false, 0)] + [Test] + [Arguments(true, 1)] + [Arguments(false, 0)] public async Task True_ShouldMatchWhenTrue(bool value, int expectedCount) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); diff --git a/Tests/Mockolate.Tests/ItTests.MatchesTests.cs b/Tests/Mockolate.Tests/ItTests.MatchesTests.cs index baf8ae040..9936e4317 100644 --- a/Tests/Mockolate.Tests/ItTests.MatchesTests.cs +++ b/Tests/Mockolate.Tests/ItTests.MatchesTests.cs @@ -9,11 +9,11 @@ public sealed partial class ItTests { public sealed class MatchesTests { - [Theory] - [InlineData("foo", "F[aeiou]+o", 0)] - [InlineData("foo", "f[aeiou]+o", 1)] - [InlineData("foobar", "f[aeiou]*BAR", 0)] - [InlineData("foobar", "f[aeiou]*bar", 1)] + [Test] + [Arguments("foo", "F[aeiou]+o", 0)] + [Arguments("foo", "f[aeiou]+o", 1)] + [Arguments("foobar", "f[aeiou]*BAR", 0)] + [Arguments("foobar", "f[aeiou]*bar", 1)] public async Task AsRegex_CaseSensitive_ShouldMatchRegexCaseSensitive( string value, string regex, int expectedCount) { @@ -25,11 +25,11 @@ await That(sut.Mock.Verify.DoSomethingWithString(It.Matches(regex).AsRegex().Cas .Exactly(expectedCount); } - [Theory] - [InlineData("foo", "g[aeiou]+o", 0)] - [InlineData("foo", "F[aeiou]+o", 1)] - [InlineData("foobar", "f[aeiou]*baz", 0)] - [InlineData("foobar", "f[aeiou]*BAR", 1)] + [Test] + [Arguments("foo", "g[aeiou]+o", 0)] + [Arguments("foo", "F[aeiou]+o", 1)] + [Arguments("foobar", "f[aeiou]*baz", 0)] + [Arguments("foobar", "f[aeiou]*BAR", 1)] public async Task AsRegex_ShouldMatchRegexCaseInsensitive(string value, string regex, int expectedCount) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -40,7 +40,7 @@ await That(sut.Mock.Verify.DoSomethingWithString(It.Matches(regex).AsRegex())) .Exactly(expectedCount); } - [Fact] + [Test] public async Task AsRegex_WithRegexOptions_ShouldUseRegexOption() { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -52,7 +52,7 @@ await That(sut.Mock.Verify.DoSomethingWithString( .Exactly(1); } - [Fact] + [Test] public async Task AsRegex_WithTimeout_ShouldApplyTimeoutToRegex() { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -69,13 +69,13 @@ await That(Act) .WithParamName("matchTimeout"); } - [Theory] - [InlineData("foo", "F?o", 0)] - [InlineData("foo", "f?o", 1)] - [InlineData("foobar", "f*BAR", 0)] - [InlineData("foobar", "f*bar", 1)] - [InlineData("foobar", "f?bar", 0)] - [InlineData("foobar", "f??bar", 1)] + [Test] + [Arguments("foo", "F?o", 0)] + [Arguments("foo", "f?o", 1)] + [Arguments("foobar", "f*BAR", 0)] + [Arguments("foobar", "f*bar", 1)] + [Arguments("foobar", "f?bar", 0)] + [Arguments("foobar", "f??bar", 1)] public async Task CaseSensitive_ShouldMatchWildcardCaseSensitive( string value, string wildcard, int expectedCount) { @@ -87,7 +87,7 @@ await That(sut.Mock.Verify.DoSomethingWithString(It.Matches(wildcard).CaseSensit .Exactly(expectedCount); } - [Fact] + [Test] public async Task ShouldFreezeValuesOnFirstMatch() { It.IParameterMatches match = It.Matches("F*o"); @@ -104,13 +104,13 @@ public async Task ShouldFreezeValuesOnFirstMatch() await That(result2).IsFalse(); } - [Theory] - [InlineData("foo", "g?o", 0)] - [InlineData("foo", "F?o", 1)] - [InlineData("foobar", "f*baz", 0)] - [InlineData("foobar", "f*BAR", 1)] - [InlineData("foobar", "f??baz", 0)] - [InlineData("foobar", "f??bar", 1)] + [Test] + [Arguments("foo", "g?o", 0)] + [Arguments("foo", "F?o", 1)] + [Arguments("foobar", "f*baz", 0)] + [Arguments("foobar", "f*BAR", 1)] + [Arguments("foobar", "f??baz", 0)] + [Arguments("foobar", "f??bar", 1)] public async Task ShouldMatchWildcardCaseInsensitive(string value, string wildcard, int expectedCount) { IMyServiceWithNullable sut = IMyServiceWithNullable.CreateMock(); @@ -120,7 +120,7 @@ public async Task ShouldMatchWildcardCaseInsensitive(string value, string wildca await That(sut.Mock.Verify.DoSomethingWithString(It.Matches(wildcard))).Exactly(expectedCount); } - [Fact] + [Test] public async Task ToString_AsRegex_CaseSensitive_ShouldReturnExpectedValue() { IParameter sut = It.Matches("F\"[aeiou]+o").AsRegex().CaseSensitive(); @@ -131,7 +131,7 @@ public async Task ToString_AsRegex_CaseSensitive_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_AsRegex_ShouldReturnExpectedValue() { IParameter sut = It.Matches("F\"[aeiou]+o").AsRegex(); @@ -142,7 +142,7 @@ public async Task ToString_AsRegex_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_AsRegex_WithInfiniteMatchTimeout_ShouldReturnExpectedValue() { IParameter sut = It.Matches("F[aeiou]+o").AsRegex(timeout: Regex.InfiniteMatchTimeout); @@ -153,7 +153,7 @@ public async Task ToString_AsRegex_WithInfiniteMatchTimeout_ShouldReturnExpected await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_AsRegex_WithOptions_ShouldReturnExpectedValue() { IParameter sut = It.Matches("F[aeiou]+o").AsRegex(RegexOptions.Compiled | RegexOptions.ECMAScript); @@ -165,7 +165,7 @@ public async Task ToString_AsRegex_WithOptions_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_AsRegex_WithOptionsAndTimeout_ShouldReturnExpectedValue() { IParameter sut = It.Matches("F[aeiou]+o") @@ -178,7 +178,7 @@ public async Task ToString_AsRegex_WithOptionsAndTimeout_ShouldReturnExpectedVal await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_AsRegex_WithTimeout_ShouldReturnExpectedValue() { IParameter sut = It.Matches("F[aeiou]+o").AsRegex(timeout: 2.Seconds()); @@ -189,7 +189,7 @@ public async Task ToString_AsRegex_WithTimeout_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_CaseSensitive_ShouldReturnExpectedValue() { IParameter sut = It.Matches("f*\"oo").CaseSensitive(); @@ -200,7 +200,7 @@ public async Task ToString_CaseSensitive_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.Matches("f*\"oo"); diff --git a/Tests/Mockolate.Tests/ItTests.SatisfiesTests.cs b/Tests/Mockolate.Tests/ItTests.SatisfiesTests.cs index 86d312627..3109efbbe 100644 --- a/Tests/Mockolate.Tests/ItTests.SatisfiesTests.cs +++ b/Tests/Mockolate.Tests/ItTests.SatisfiesTests.cs @@ -6,9 +6,9 @@ public sealed partial class ItTests { public sealed class SatisfiesTests { - [Theory] - [InlineData(null, true)] - [InlineData(1, false)] + [Test] + [Arguments(null, true)] + [Arguments(1, false)] public async Task CheckForNull_ShouldMatchForExpectedResult(int? value, bool expectedResult) { IParameter sut = It.Satisfies(v => v is null); @@ -18,9 +18,9 @@ public async Task CheckForNull_ShouldMatchForExpectedResult(int? value, bool exp await That(result).IsEqualTo(expectedResult); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task ShouldMatchForExpectedResult(bool predicateValue) { IParameter sut = It.Satisfies(_ => predicateValue); @@ -30,7 +30,7 @@ public async Task ShouldMatchForExpectedResult(bool predicateValue) await That(result).IsEqualTo(predicateValue); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInSetup() { IMyService sut = IMyService.CreateMock(); @@ -46,7 +46,7 @@ public async Task ShouldSupportCovarianceInSetup() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldSupportCovarianceInVerify() { IMyService sut = IMyService.CreateMock(); @@ -64,7 +64,7 @@ public async Task ShouldSupportCovarianceInVerify() await That(sut.Mock.Verify.DoSomething(It.Satisfies(_ => true))).Never(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.Satisfies(x => x.Length == 3); diff --git a/Tests/Mockolate.Tests/ItTests.SequenceEqualsTests.cs b/Tests/Mockolate.Tests/ItTests.SequenceEqualsTests.cs index 63df8bb15..999109a5f 100644 --- a/Tests/Mockolate.Tests/ItTests.SequenceEqualsTests.cs +++ b/Tests/Mockolate.Tests/ItTests.SequenceEqualsTests.cs @@ -8,7 +8,7 @@ public sealed partial class ItTests { public sealed class SequenceEqualsTests { - [Fact] + [Test] public async Task ShouldMatchArrayParameter() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -21,7 +21,7 @@ public async Task ShouldMatchArrayParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchEnumerableParameter() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -34,7 +34,7 @@ public async Task ShouldMatchEnumerableParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchListParameter() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -47,7 +47,7 @@ public async Task ShouldMatchListParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchQueueParameter() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -60,7 +60,7 @@ public async Task ShouldMatchQueueParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchReadOnlyListParameter() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -73,7 +73,7 @@ public async Task ShouldMatchReadOnlyListParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchStackParameter() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -86,7 +86,7 @@ public async Task ShouldMatchStackParameter() await That(miss).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldMatchWhenSequencesEqual() { IParameter> sut = It.SequenceEquals(1, 2, 3); @@ -96,7 +96,7 @@ public async Task ShouldMatchWhenSequencesEqual() await That(result).IsTrue(); } - [Fact] + [Test] public async Task ShouldNotMatchWhenLengthsDiffer() { IParameter> sut = It.SequenceEquals(1, 2, 3); @@ -106,7 +106,7 @@ public async Task ShouldNotMatchWhenLengthsDiffer() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldNotMatchWhenSequencesDiffer() { IParameter> sut = It.SequenceEquals(1, 2, 3); @@ -116,7 +116,7 @@ public async Task ShouldNotMatchWhenSequencesDiffer() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldNotMatchWhenValueIsNotCollection() { IParameter> sut = It.SequenceEquals(1, 2, 3); @@ -126,7 +126,7 @@ public async Task ShouldNotMatchWhenValueIsNotCollection() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldSupportVerify() { ISequenceCollectionConsumer sut = ISequenceCollectionConsumer.CreateMock(); @@ -139,7 +139,7 @@ public async Task ShouldSupportVerify() await That(sut.Mock.Verify.WithArray(It.SequenceEquals(9, 9, 9))).Once(); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameter sut = It.SequenceEquals(1, 2, 3); @@ -150,7 +150,7 @@ public async Task ToString_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_Using_ShouldReturnExpectedValue() { IParameter sut = It.SequenceEquals(1, 2, 3).Using(new AllEqualComparer()); @@ -161,7 +161,7 @@ public async Task ToString_Using_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithNullElement_ShouldRenderNullToken() { IParameter sut = It.SequenceEquals("foo", null, 3); @@ -172,7 +172,7 @@ public async Task ToString_WithNullElement_ShouldRenderNullToken() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task ToString_WithStringValues_ShouldReturnExpectedValue() { IParameter sut = It.SequenceEquals("foo", "bar"); @@ -183,7 +183,7 @@ public async Task ToString_WithStringValues_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task WithComparer_ShouldUseComparer() { IParameter sut = It.SequenceEquals(1, 2, 3).Using(new AllEqualComparer()); @@ -193,7 +193,7 @@ public async Task WithComparer_ShouldUseComparer() await That(result).IsTrue(); } - [Fact] + [Test] public async Task TypedArrayMatch_WithNullValue_ShouldNotMatch() { IParameter sut = It.SequenceEquals(1, 2, 3); @@ -205,7 +205,7 @@ public async Task TypedArrayMatch_WithNullValue_ShouldNotMatch() public sealed class DoTests { - [Fact] + [Test] public async Task Do_MultipleRegistrations_ShouldAllInvoke() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -221,7 +221,7 @@ public async Task Do_MultipleRegistrations_ShouldAllInvoke() await That(secondCount).IsEqualTo(1); } - [Fact] + [Test] public async Task Do_RegistersCallbackForArray() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -234,7 +234,7 @@ public async Task Do_RegistersCallbackForArray() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForICollection() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -247,7 +247,7 @@ public async Task Do_RegistersCallbackForICollection() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIEnumerable() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -260,7 +260,7 @@ public async Task Do_RegistersCallbackForIEnumerable() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIList() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -273,7 +273,7 @@ public async Task Do_RegistersCallbackForIList() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIReadOnlyCollection() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -286,7 +286,7 @@ public async Task Do_RegistersCallbackForIReadOnlyCollection() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForIReadOnlyList() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -299,7 +299,7 @@ public async Task Do_RegistersCallbackForIReadOnlyList() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForList() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -312,7 +312,7 @@ public async Task Do_RegistersCallbackForList() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForQueue() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); @@ -326,7 +326,7 @@ public async Task Do_RegistersCallbackForQueue() await That(captured).IsSameAs(source); } - [Fact] + [Test] public async Task Do_RegistersCallbackForStack() { It.ISequenceEqualsParameter sut = It.SequenceEquals(1, 2, 3); diff --git a/Tests/Mockolate.Tests/ItTests.cs b/Tests/Mockolate.Tests/ItTests.cs index e970e7e61..e35199f75 100644 --- a/Tests/Mockolate.Tests/ItTests.cs +++ b/Tests/Mockolate.Tests/ItTests.cs @@ -7,7 +7,7 @@ namespace Mockolate.Tests; public sealed partial class ItTests { - [Fact] + [Test] public async Task InvokeCallbacks_NonGeneric_WithMatchingType_ShouldInvokeCallback() { int isCalled = 0; @@ -19,7 +19,7 @@ public async Task InvokeCallbacks_NonGeneric_WithMatchingType_ShouldInvokeCallba await That(isCalled).IsEqualTo(7); } - [Fact] + [Test] public async Task InvokeCallbacks_NonGeneric_WithMismatchedType_ShouldNotInvokeCallback() { int isCalled = 0; @@ -31,7 +31,7 @@ public async Task InvokeCallbacks_NonGeneric_WithMismatchedType_ShouldNotInvokeC await That(isCalled).IsEqualTo(0); } - [Fact] + [Test] public async Task InvokeCallbacks_NonGeneric_WithNullForNonNullableValueType_ShouldNotInvokeCallback() { int isCalled = 0; @@ -43,7 +43,7 @@ public async Task InvokeCallbacks_NonGeneric_WithNullForNonNullableValueType_Sho await That(isCalled).IsEqualTo(0); } - [Fact] + [Test] public async Task InvokeCallbacks_NonGeneric_WithNullForNullableValueType_ShouldInvokeCallbackWithDefault() { int isCalled = 0; @@ -61,7 +61,7 @@ public async Task InvokeCallbacks_NonGeneric_WithNullForNullableValueType_Should await That(capturedValue).IsNull(); } - [Fact] + [Test] public async Task InvokeCallbacks_NonGeneric_WithNullForReferenceType_ShouldInvokeCallbackWithDefault() { int isCalled = 0; @@ -79,7 +79,7 @@ public async Task InvokeCallbacks_NonGeneric_WithNullForReferenceType_ShouldInvo await That(capturedValue).IsNull(); } - [Fact] + [Test] public async Task InvokeCallbacks_WithCorrectType_ShouldInvokeCallback() { int isCalled = 0; @@ -91,7 +91,7 @@ public async Task InvokeCallbacks_WithCorrectType_ShouldInvokeCallback() await That(isCalled).IsEqualTo(5); } - [Fact] + [Test] public async Task ShouldOnlyHaveOneParameterlessPrivateConstructor() { ConstructorInfo[] constructors = typeof(Match) diff --git a/Tests/Mockolate.Tests/MatchExtensionsTests.cs b/Tests/Mockolate.Tests/MatchExtensionsTests.cs index 89b15858d..ae16810f8 100644 --- a/Tests/Mockolate.Tests/MatchExtensionsTests.cs +++ b/Tests/Mockolate.Tests/MatchExtensionsTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests; public sealed class MatchExtensionsTests { - [Fact] + [Test] public async Task OutParameterMonitor_MultipleMonitors_ShouldAllMonitorValues() { int idx = 1; @@ -23,7 +23,7 @@ public async Task OutParameterMonitor_MultipleMonitors_ShouldAllMonitorValues() await That(monitor2.Values).IsEqualTo([1, 2, 3,]); } - [Fact] + [Test] public async Task OutParameterMonitor_ShouldMonitorReceivedValues() { int idx = 1; @@ -37,7 +37,7 @@ public async Task OutParameterMonitor_ShouldMonitorReceivedValues() await That(monitor.Values).IsEqualTo([1, 2,]); } - [Fact] + [Test] public async Task ParameterMonitor_MultipleMonitors_ShouldAllMonitorValues() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -56,7 +56,7 @@ public async Task ParameterMonitor_MultipleMonitors_ShouldAllMonitorValues() await That(monitorB2.Values).IsEqualTo([5, 6,]); } - [Fact] + [Test] public async Task ParameterMonitor_ShouldMonitorReceivedValues() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -68,7 +68,7 @@ public async Task ParameterMonitor_ShouldMonitorReceivedValues() await That(monitor.Values).IsEqualTo(["Dark", "White",]); } - [Fact] + [Test] public async Task ParameterMonitor_WithFilter_ShouldMonitorMatchingValues() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -86,7 +86,7 @@ public async Task ParameterMonitor_WithFilter_ShouldMonitorMatchingValues() await That(monitor.Values).IsEqualTo([5, 6, 7, 8,]); } - [Fact] + [Test] public async Task RefParameterMonitor_MultipleMonitors_ShouldAllMonitorValues() { IMyService sut = IMyService.CreateMock(); @@ -103,7 +103,7 @@ public async Task RefParameterMonitor_MultipleMonitors_ShouldAllMonitorValues() await That(monitor2.Values).IsEqualTo([6, 14,]); } - [Fact] + [Test] public async Task RefParameterMonitor_ShouldMonitorReceivedValues() { IMyService sut = IMyService.CreateMock(); @@ -118,7 +118,7 @@ public async Task RefParameterMonitor_ShouldMonitorReceivedValues() await That(monitor.Values).IsEqualTo([6, 14,]); } - [Fact] + [Test] public async Task RefParameterMonitor_WithFilter_ShouldMonitorMatchingValues() { IMyService sut = IMyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MatchTests.AnyParametersTests.cs b/Tests/Mockolate.Tests/MatchTests.AnyParametersTests.cs index cd38f3804..a737c042a 100644 --- a/Tests/Mockolate.Tests/MatchTests.AnyParametersTests.cs +++ b/Tests/Mockolate.Tests/MatchTests.AnyParametersTests.cs @@ -6,7 +6,7 @@ public sealed partial class MatchTests { public sealed class AnyParametersTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameters sut = Match.AnyParameters(); diff --git a/Tests/Mockolate.Tests/MatchTests.ParametersTests.cs b/Tests/Mockolate.Tests/MatchTests.ParametersTests.cs index b2eb3c31e..f496d8a4f 100644 --- a/Tests/Mockolate.Tests/MatchTests.ParametersTests.cs +++ b/Tests/Mockolate.Tests/MatchTests.ParametersTests.cs @@ -6,13 +6,13 @@ public sealed partial class MatchTests { public sealed class ParametersTests { - [Theory] - [InlineData(true, null, null)] - [InlineData(true, "", 1)] - [InlineData(true, "foo", null)] - [InlineData(false, null, null)] - [InlineData(false, "", 1)] - [InlineData(false, "foo", null)] + [Test] + [Arguments(true, null, null)] + [Arguments(true, "", 1)] + [Arguments(true, "foo", null)] + [Arguments(false, null, null)] + [Arguments(false, "", 1)] + [Arguments(false, "foo", null)] public async Task ShouldMatchWhenPredicateReturnsTrue(bool expectedResult, string? value1, int? value2) { IParameters sut = Match.Parameters(_ => expectedResult); @@ -23,7 +23,7 @@ public async Task ShouldMatchWhenPredicateReturnsTrue(bool expectedResult, strin await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IParameters sut = Match.Parameters(_ => true); diff --git a/Tests/Mockolate.Tests/MatchTests.WithDefaultParametersTests.cs b/Tests/Mockolate.Tests/MatchTests.WithDefaultParametersTests.cs index d0e6ec17f..e6e05c6e0 100644 --- a/Tests/Mockolate.Tests/MatchTests.WithDefaultParametersTests.cs +++ b/Tests/Mockolate.Tests/MatchTests.WithDefaultParametersTests.cs @@ -6,7 +6,7 @@ public sealed partial class MatchTests { public sealed class WithDefaultParametersTests { - [Fact] + [Test] public async Task ToString_ShouldReturnExpectedValue() { IDefaultEventParameters sut = Match.WithDefaultParameters(); diff --git a/Tests/Mockolate.Tests/MockBehaviorExtensionsTests.cs b/Tests/Mockolate.Tests/MockBehaviorExtensionsTests.cs index e568b8721..4aca24e6e 100644 --- a/Tests/Mockolate.Tests/MockBehaviorExtensionsTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorExtensionsTests.cs @@ -2,7 +2,7 @@ namespace Mockolate.Tests; public sealed class MockBehaviorExtensionsTests { - [Fact] + [Test] public async Task SkippingBaseClass_ShouldSetSkipBaseClass() { MockBehavior sut = MockBehavior.Default; @@ -12,7 +12,7 @@ public async Task SkippingBaseClass_ShouldSetSkipBaseClass() await That(result.SkipBaseClass).IsTrue(); } - [Fact] + [Test] public async Task SkippingBaseClass_WithFalse_ShouldUpdateSkipBaseClass() { bool initializedValue = true; @@ -23,7 +23,7 @@ public async Task SkippingBaseClass_WithFalse_ShouldUpdateSkipBaseClass() await That(result.SkipBaseClass).IsFalse(); } - [Fact] + [Test] public async Task ThrowingWhenNotSetup_ShouldSetThrowWhenNotSetup() { MockBehavior sut = MockBehavior.Default; @@ -33,7 +33,7 @@ public async Task ThrowingWhenNotSetup_ShouldSetThrowWhenNotSetup() await That(result.ThrowWhenNotSetup).IsTrue(); } - [Fact] + [Test] public async Task ThrowingWhenNotSetup_WithFalse_ShouldUpdateThrowWhenNotSetup() { bool initializedValue = true; diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.DefaultValueTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.DefaultValueTests.cs index 844dc9342..96965cfce 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.DefaultValueTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.DefaultValueTests.cs @@ -10,7 +10,7 @@ public sealed partial class MockBehaviorTests { public sealed class DefaultValueTests { - [Fact] + [Test] public async Task Recursive_ShouldReturnNull() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -20,7 +20,7 @@ public async Task Recursive_ShouldReturnNull() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithArray_ShouldReturnEmptyArray() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -30,7 +30,7 @@ public async Task WithArray_ShouldReturnEmptyArray() await That(result).HasCount(0); } - [Fact] + [Test] public async Task WithCancellationToken_ShouldReturnNone() { MockBehavior sut = MockBehavior.Default; @@ -40,7 +40,7 @@ public async Task WithCancellationToken_ShouldReturnNone() await That(result).IsEqualTo(CancellationToken.None); } - [Fact] + [Test] public async Task WithCombination_ShouldReturnNotNullValues() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -52,7 +52,7 @@ public async Task WithCombination_ShouldReturnNotNullValues() await That(result.Item3).IsEqualTo(""); } - [Fact] + [Test] public async Task WithHttpResponseMessage_ShouldReturnEmptyResponseWithNotImplementedStatusCode() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -63,7 +63,7 @@ public async Task WithHttpResponseMessage_ShouldReturnEmptyResponseWithNotImplem await That(result.Content.ReadAsStringAsync()).IsEmpty(); } - [Fact] + [Test] public async Task WithIEnumerable_ShouldReturnEmptyEnumerable() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -73,7 +73,7 @@ public async Task WithIEnumerable_ShouldReturnEmptyEnumerable() await That(result).HasCount(0); } - [Fact] + [Test] public async Task WithIEnumerableOfInt_ShouldReturnEmptyEnumerable() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -83,7 +83,7 @@ public async Task WithIEnumerableOfInt_ShouldReturnEmptyEnumerable() await That(result).HasCount(0); } - [Fact] + [Test] public async Task WithInt_ShouldReturnZero() { MockBehavior sut = MockBehavior.Default; @@ -93,7 +93,7 @@ public async Task WithInt_ShouldReturnZero() await That(result).IsEqualTo(0); } - [Fact] + [Test] public async Task WithMultidimensionalArray_ShouldReturnEmptyArray() { MockBehavior.Default.DefaultValue.Generate(default(int[,])!); @@ -105,7 +105,7 @@ public async Task WithMultidimensionalArray_ShouldReturnEmptyArray() await That(result).HasCount(0); } - [Fact] + [Test] public async Task WithNullableInt_ShouldReturnNull() { MockBehavior sut = MockBehavior.Default; @@ -115,7 +115,7 @@ public async Task WithNullableInt_ShouldReturnNull() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithObject_ShouldReturnNull() { MockBehavior sut = MockBehavior.Default; @@ -125,7 +125,7 @@ public async Task WithObject_ShouldReturnNull() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithString_ShouldReturnEmptyString() { MockBehavior sut = MockBehavior.Default; @@ -135,7 +135,7 @@ public async Task WithString_ShouldReturnEmptyString() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task WithStruct_ShouldReturnDefault() { MockBehavior sut = MockBehavior.Default; @@ -145,7 +145,7 @@ public async Task WithStruct_ShouldReturnDefault() await That(result).IsEqualTo(DateTime.MinValue); } - [Fact] + [Test] public async Task WithTask_ShouldReturnCompletedTask() { MockBehavior sut = MockBehavior.Default; @@ -157,7 +157,7 @@ public async Task WithTask_ShouldReturnCompletedTask() await That(result.IsFaulted).IsFalse(); } - [Fact] + [Test] public async Task WithTaskInt_ShouldReturnZero() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -168,7 +168,7 @@ public async Task WithTaskInt_ShouldReturnZero() await That(result).IsEqualTo(0); } - [Fact] + [Test] public async Task WithTaskIntArray_ShouldReturnZero() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -179,7 +179,7 @@ public async Task WithTaskIntArray_ShouldReturnZero() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task WithValueTaskInt_ShouldReturnZero() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -191,7 +191,7 @@ public async Task WithValueTaskInt_ShouldReturnZero() } #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task WithValueTaskIntArray_ShouldReturnZero() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -203,7 +203,7 @@ public async Task WithValueTaskIntArray_ShouldReturnZero() } #endif - [Fact] + [Test] public async Task WithValueTuple_ShouldReturnValueTupleWithDefaultValues() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); @@ -214,7 +214,7 @@ public async Task WithValueTuple_ShouldReturnValueTupleWithDefaultValues() await That(result.V2).IsEqualTo(""); } - [Fact] + [Test] public async Task WithValueTuple8_ShouldReturnValueTupleWithDefaultValues() { IDefaultValueGeneratorProperties sut = IDefaultValueGeneratorProperties.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.InitializeTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.InitializeTests.cs index b7a36d82b..6421b54e1 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.InitializeTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.InitializeTests.cs @@ -6,7 +6,7 @@ public sealed partial class MockBehaviorTests { public sealed class InitializeTests { - [Fact] + [Test] public async Task Initialize_DirectSetupsTakePrecedence() { MockBehavior behavior = MockBehavior.Default.Initialize(setup @@ -26,7 +26,7 @@ public async Task Initialize_DirectSetupsTakePrecedence() await That(noneMatchResult).IsEqualTo(0); } - [Fact] + [Test] public async Task Initialize_OtherType_ShouldIgnoreInitializations() { MockBehavior behavior = @@ -41,7 +41,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Initialize_ShouldApplySetupToCreatedMock() { MockBehavior behavior = diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.SkipInteractionRecordingTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.SkipInteractionRecordingTests.cs index 5ff3151b4..9ec0b5fad 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.SkipInteractionRecordingTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.SkipInteractionRecordingTests.cs @@ -7,7 +7,7 @@ public sealed partial class MockBehaviorTests { public sealed class SkipInteractionRecordingTests { - [Fact] + [Test] public async Task Default_ShouldBeFalse() { MockBehavior sut = MockBehavior.Default; @@ -15,7 +15,7 @@ public async Task Default_ShouldBeFalse() await That(sut.SkipInteractionRecording).IsFalse(); } - [Fact] + [Test] public async Task SkippingInteractionRecording_ShouldSupportFluentSyntax() { MockBehavior sut = MockBehavior.Default.SkippingInteractionRecording(); @@ -23,7 +23,7 @@ public async Task SkippingInteractionRecording_ShouldSupportFluentSyntax() await That(sut.SkipInteractionRecording).IsTrue(); } - [Fact] + [Test] public async Task SkippingInteractionRecording_WithFalse_ShouldEnableRecording() { MockBehavior sut = MockBehavior.Default @@ -33,7 +33,7 @@ public async Task SkippingInteractionRecording_WithFalse_ShouldEnableRecording() await That(sut.SkipInteractionRecording).IsFalse(); } - [Fact] + [Test] public async Task WhenSkipping_Indexer_ShouldStillStoreAndReturnValue() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -44,7 +44,7 @@ public async Task WhenSkipping_Indexer_ShouldStillStoreAndReturnValue() await That(result).IsEqualTo("hello"); } - [Fact] + [Test] public async Task WhenSkipping_Method_ShouldStillReturnSetupValue() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -55,7 +55,7 @@ public async Task WhenSkipping_Method_ShouldStillReturnSetupValue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task WhenSkipping_NoInteractionsAreRecorded() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -70,7 +70,7 @@ public async Task WhenSkipping_NoInteractionsAreRecorded() await That(interactions.Count).IsEqualTo(0); } - [Fact] + [Test] public async Task WhenSkipping_PropertyGetter_ShouldStillReturnSetupValue() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -81,7 +81,7 @@ public async Task WhenSkipping_PropertyGetter_ShouldStillReturnSetupValue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task WhenSkipping_PropertySetter_ShouldStillStoreValue() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -93,7 +93,7 @@ public async Task WhenSkipping_PropertySetter_ShouldStillStoreValue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task WhenSkipping_Verify_ShouldThrow() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -106,7 +106,7 @@ await That(async () => await That(sut.Mock.Verify.SomeFlag.Got()).Exactly(1)) .WithMessage("*SkipInteractionRecording*").AsWildcard(); } - [Fact] + [Test] public async Task WithRecordingEnabled_ShouldRecordAsBefore() { IMyService sut = IMyService.CreateMock(MockBehavior.Default); diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.SkippingBaseClassTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.SkippingBaseClassTests.cs index 5b94cdaf3..45b02ab13 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.SkippingBaseClassTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.SkippingBaseClassTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockBehaviorTests { public sealed class SkippingBaseClassTests { - [Fact] + [Test] public async Task DefaultBehavior_ForRefAndOutParameter_WhenMethodNotSetup_ShouldUseDefaultValues() { MyBaseClassWithVirtualCalls sut = @@ -19,7 +19,7 @@ public async Task DefaultBehavior_ForRefAndOutParameter_WhenMethodNotSetup_Shoul await That(sut.VirtualMethodWithRefAndOutParametersCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_ForRefAndOutParameter_WhenMethodSetup_ShouldUseSetupValues() { MyBaseClassWithVirtualCalls sut = @@ -36,7 +36,7 @@ public async Task DefaultBehavior_ForRefAndOutParameter_WhenMethodSetup_ShouldUs await That(sut.VirtualMethodWithRefAndOutParametersCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_WhenIndexerNotSetup_ShouldInitializeIndexerValuesFromBaseClass() { MyBaseClassWithVirtualCalls sut = @@ -54,7 +54,7 @@ public async Task DefaultBehavior_WhenIndexerNotSetup_ShouldInitializeIndexerVal await That(sut.VirtualIndexerSetterCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_WhenIndexerSetup_ShouldUseSetupValues() { MyBaseClassWithVirtualCalls sut = @@ -71,7 +71,7 @@ public async Task DefaultBehavior_WhenIndexerSetup_ShouldUseSetupValues() await That(sut.VirtualIndexerSetterCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_WhenMethodNotSetup_ShouldReturnBaseValues() { MyBaseClassWithVirtualCalls sut = @@ -83,7 +83,7 @@ public async Task DefaultBehavior_WhenMethodNotSetup_ShouldReturnBaseValues() await That(sut.VirtualMethodCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_WhenMethodSetup_ShouldReturnSetupValues() { MyBaseClassWithVirtualCalls sut = @@ -96,7 +96,7 @@ public async Task DefaultBehavior_WhenMethodSetup_ShouldReturnSetupValues() await That(sut.VirtualMethodCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_WhenPropertyNotSetup_ShouldInitializePropertyWithValueFromBaseClass() { MyBaseClassWithVirtualCalls sut = @@ -113,7 +113,7 @@ public async Task DefaultBehavior_WhenPropertyNotSetup_ShouldInitializePropertyW await That(sut.VirtualPropertySetterCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task DefaultBehavior_WhenPropertySetup_ShouldUseSetupValues() { MyBaseClassWithVirtualCalls sut = @@ -131,7 +131,7 @@ public async Task DefaultBehavior_WhenPropertySetup_ShouldUseSetupValues() await That(sut.VirtualPropertySetterCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task SkippingBaseClass_ForRefAndOutParameter_WhenMethodNotSetup_ShouldSetToPreviousOrDefaultValues() { @@ -147,7 +147,7 @@ public async Task await That(sut.VirtualMethodWithRefAndOutParametersCallCount).IsEqualTo(0); } - [Fact] + [Test] public async Task SkippingBaseClass_ShouldNotCallIndexersOfBaseClass() { MyBaseClassWithVirtualCalls sut = @@ -163,7 +163,7 @@ public async Task SkippingBaseClass_ShouldNotCallIndexersOfBaseClass() await That(sut.VirtualIndexerSetterCallCount).IsEqualTo(0); } - [Fact] + [Test] public async Task SkippingBaseClass_ShouldNotCallMethodOfBaseClass() { MyBaseClassWithVirtualCalls sut = @@ -174,7 +174,7 @@ public async Task SkippingBaseClass_ShouldNotCallMethodOfBaseClass() await That(sut.VirtualMethodCallCount).IsEqualTo(0); } - [Fact] + [Test] public async Task SkippingBaseClass_ShouldNotCallPropertiesOfBaseClass() { MyBaseClassWithVirtualCalls sut = diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.ThrowWhenNotSetupTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.ThrowWhenNotSetupTests.cs index b6a209539..f9bd5bc67 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.ThrowWhenNotSetupTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.ThrowWhenNotSetupTests.cs @@ -7,7 +7,7 @@ public sealed partial class MockBehaviorTests { public sealed class ThrowWhenNotSetupTests { - [Fact] + [Test] public async Task WhenFalse_ShouldReturnDefaultValueInNotSetupMethods() { IMyService sut = IMyService.CreateMock(MockBehavior.Default with @@ -20,7 +20,7 @@ public async Task WhenFalse_ShouldReturnDefaultValueInNotSetupMethods() await That(result).IsEqualTo(""); } - [Fact] + [Test] public async Task WhenTrue_ShouldThrowMockNotSetupException() { IMyService sut = IMyService.CreateMock(MockBehavior.Default with diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.UseConstructorParametersForTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.UseConstructorParametersForTests.cs index ea668d3d2..99b8e6223 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.UseConstructorParametersForTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.UseConstructorParametersForTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockBehaviorTests { public sealed class UseConstructorParametersForTests { - [Fact] + [Test] public async Task TryGetConstructorParameters_Predicate_IsEvaluatedOnEachCall() { int invocationCount = 0; @@ -24,7 +24,7 @@ public async Task TryGetConstructorParameters_Predicate_IsEvaluatedOnEachCall() await That(second).IsEqualTo(expectedSecond); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WhenNoneRegistered_ShouldReturnFalse() { IMockBehaviorAccess sut = MockBehavior.Default; @@ -35,7 +35,7 @@ public async Task TryGetConstructorParameters_WhenNoneRegistered_ShouldReturnFal await That(parameters).IsNull(); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WhenRegisteredForBaseType_ShouldNotMatchDerivedType() { IMockBehaviorAccess sut = MockBehavior.Default @@ -47,7 +47,7 @@ public async Task TryGetConstructorParameters_WhenRegisteredForBaseType_ShouldNo await That(parameters).IsNull(); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WhenRegisteredForDerivedType_ShouldNotMatchBaseType() { IMockBehaviorAccess sut = MockBehavior.Default @@ -59,7 +59,7 @@ public async Task TryGetConstructorParameters_WhenRegisteredForDerivedType_Shoul await That(parameters).IsNull(); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WhenRegisteredForDifferentType_ShouldReturnFalse() { IMockBehaviorAccess sut = MockBehavior.Default @@ -71,7 +71,7 @@ public async Task TryGetConstructorParameters_WhenRegisteredForDifferentType_Sho await That(parameters).IsNull(); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WithMultipleRegistrationsForSameType_Predicate_ShouldReturnLatest() { IMockBehaviorAccess sut = MockBehavior.Default @@ -85,7 +85,7 @@ public async Task TryGetConstructorParameters_WithMultipleRegistrationsForSameTy await That(parameters).IsEqualTo(expected); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WithMultipleRegistrationsForSameType_ShouldReturnLatest() { IMockBehaviorAccess sut = MockBehavior.Default @@ -99,7 +99,7 @@ public async Task TryGetConstructorParameters_WithMultipleRegistrationsForSameTy await That(parameters).IsEqualTo(expected); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WithMultipleRegistrationsForSameType_UsedByMock_ShouldUseLatest() { MockBehavior behavior = MockBehavior.Default @@ -111,7 +111,7 @@ public async Task TryGetConstructorParameters_WithMultipleRegistrationsForSameTy await That(mock.Value).IsEqualTo(2); } - [Fact] + [Test] public async Task TryGetConstructorParameters_WithRegistrationsForDifferentTypes_ShouldReturnEachCorrectly() { IMockBehaviorAccess sut = MockBehavior.Default @@ -129,7 +129,7 @@ public async Task TryGetConstructorParameters_WithRegistrationsForDifferentTypes await That(otherParameters).IsEqualTo(expectedForOther); } - [Fact] + [Test] public async Task WithExplicitConstructorParameters_ShouldIgnoreConstructorParametersFromBehavior() { MockBehavior behavior = MockBehavior.Default @@ -142,7 +142,7 @@ public async Task WithExplicitConstructorParameters_ShouldIgnoreConstructorParam await That(value).IsEqualTo(7); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldUseConstructorParametersFromBehavior() { @@ -161,7 +161,7 @@ MyServiceWithMultipleConstructors mockWithCustomBehavior await That(valueWithCustomBehavior).IsEqualTo(5); } - [Fact] + [Test] public async Task WithPredicate_ShouldUseConstructorParametersFromBehavior() { MockBehavior behavior = MockBehavior.Default diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.WithDefaultValueForTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.WithDefaultValueForTests.cs index 8ad7798f1..c12992c5f 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.WithDefaultValueForTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.WithDefaultValueForTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockBehaviorTests { public sealed class WithDefaultValueForTests { - [Fact] + [Test] public async Task MultipleTypedFactories_ShouldSupportAll() { MockBehavior behavior = MockBehavior.Default @@ -20,7 +20,7 @@ await That(mockWithBehavior.InheritedValue) .Whose(x => x.OtherValue, it => it.IsEqualTo(7)); } - [Fact] + [Test] public async Task WithExplicitDefaultValueFactory_ShouldApplyThisFactory() { DefaultValueFactory defaultValueFactory = new( @@ -38,7 +38,7 @@ await That(mockWithBehavior.InheritedValue) .Whose(x => x.OtherValue, it => it.IsEqualTo(7)); } - [Fact] + [Test] public async Task WithTypedFactory_ShouldRequireExactTypeMatch() { MockBehavior behavior1 = MockBehavior.Default @@ -59,7 +59,7 @@ await That(mockWithBehavior2.InheritedValue) await That(mockWithBehavior2.Value).IsNull(); } - [Fact] + [Test] public async Task WithTypedFactory_ShouldUseDefaultValueFactoryFromBehavior() { MockBehavior behavior = MockBehavior.Default diff --git a/Tests/Mockolate.Tests/MockBehaviorTests.cs b/Tests/Mockolate.Tests/MockBehaviorTests.cs index 3560f5aef..ce278549d 100644 --- a/Tests/Mockolate.Tests/MockBehaviorTests.cs +++ b/Tests/Mockolate.Tests/MockBehaviorTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests; public sealed partial class MockBehaviorTests { - [Fact] + [Test] public async Task Default_ShouldInitializeCorrectly() { IMyService sut = IMyService.CreateMock(); @@ -15,7 +15,7 @@ public async Task Default_ShouldInitializeCorrectly() await That(behavior.DefaultValue).IsNotNull(); } - [Fact] + [Test] public async Task ShouldSupportCustomDefaultValueGenerator() { MockBehavior sut = new(new MyDefaultValueGenerator()); @@ -26,7 +26,7 @@ public async Task ShouldSupportCustomDefaultValueGenerator() await That(sut.DefaultValue.Generate(0)).IsEqualTo(0); } - [Fact] + [Test] public async Task ShouldSupportWithSyntax() { MockBehavior sut = MockBehavior.Default with @@ -42,7 +42,7 @@ public async Task ShouldSupportWithSyntax() await That(sut.DefaultValue.Generate(0)).IsEqualTo(0); } - [Fact] + [Test] public async Task ToString_Default_ShouldReturnDefault() { MockBehavior sut = MockBehavior.Default; @@ -52,7 +52,7 @@ public async Task ToString_Default_ShouldReturnDefault() await That(result).IsEqualTo("Default"); } - [Fact] + [Test] public async Task ToString_SkippingBaseClass_ShouldReturnExpectedValue() { MockBehavior sut = MockBehavior.Default.SkippingBaseClass(); @@ -62,7 +62,7 @@ public async Task ToString_SkippingBaseClass_ShouldReturnExpectedValue() await That(result).IsEqualTo("SkippingBaseClass"); } - [Fact] + [Test] public async Task ToString_SkippingBaseClassAndThrowingWhenNotSetup_ShouldReturnExpectedValue() { MockBehavior sut = MockBehavior.Default with @@ -76,7 +76,7 @@ public async Task ToString_SkippingBaseClassAndThrowingWhenNotSetup_ShouldReturn await That(result).IsEqualTo("ThrowingWhenNotSetup and SkippingBaseClass"); } - [Fact] + [Test] public async Task ToString_ThrowingWhenNotSetup_ShouldReturnExpectedValue() { MockBehavior sut = MockBehavior.Default.ThrowingWhenNotSetup(); @@ -86,7 +86,7 @@ public async Task ToString_ThrowingWhenNotSetup_ShouldReturnExpectedValue() await That(result).IsEqualTo("ThrowingWhenNotSetup"); } - [Fact] + [Test] public async Task ToString_WithSetups_ShouldReturnExpectedValue() { MockBehavior sut = MockBehavior.Default.SkippingBaseClass() @@ -99,7 +99,7 @@ public async Task ToString_WithSetups_ShouldReturnExpectedValue() await That(result).IsEqualTo("SkippingBaseClass with 2 constructor parameter registrations with 1 setup registrations"); } - [Fact] + [Test] public async Task ToString_WithUseConstructorParametersFor_ShouldReturnExpectedValue() { MockBehavior sut = MockBehavior.Default @@ -111,7 +111,7 @@ public async Task ToString_WithUseConstructorParametersFor_ShouldReturnExpectedV await That(result).IsEqualTo("Default with 2 constructor parameter registrations"); } - [Fact] + [Test] public async Task WithMultipleFlags_ShouldKeepAllPartsInOutput() { MockBehavior behavior = MockBehavior.Default diff --git a/Tests/Mockolate.Tests/MockDelegates/DelegateTests.SpanTests.cs b/Tests/Mockolate.Tests/MockDelegates/DelegateTests.SpanTests.cs index cbfca682f..627b96de2 100644 --- a/Tests/Mockolate.Tests/MockDelegates/DelegateTests.SpanTests.cs +++ b/Tests/Mockolate.Tests/MockDelegates/DelegateTests.SpanTests.cs @@ -6,7 +6,7 @@ public partial class DelegateTests { public sealed class SpanTests { - [Fact] + [Test] public async Task ReadOnlySpanParameter_ShouldSupportSetup() { ReadOnlySpanConsumer sut = ReadOnlySpanConsumer.CreateMock(); @@ -19,7 +19,7 @@ await That(result).IsEqualTo(42) "a by-value ReadOnlySpan parameter flows through ReadOnlySpanWrapper, so the delegate keeps its setup surface instead of degrading to a NotSupportedException stub"); } - [Fact] + [Test] public async Task SpanParameter_ShouldSupportSetup() { SpanConsumer sut = SpanConsumer.CreateMock(); @@ -32,7 +32,7 @@ await That(result).IsEqualTo(42) "a by-value Span parameter flows through SpanWrapper, so the delegate keeps its setup surface instead of degrading to a NotSupportedException stub"); } - [Fact] + [Test] public async Task SpanParameter_ShouldSupportVerify() { SpanConsumer sut = SpanConsumer.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockDelegates/DelegateTests.cs b/Tests/Mockolate.Tests/MockDelegates/DelegateTests.cs index d71180393..194ae2e69 100644 --- a/Tests/Mockolate.Tests/MockDelegates/DelegateTests.cs +++ b/Tests/Mockolate.Tests/MockDelegates/DelegateTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockDelegates; public partial class DelegateTests { - [Fact] + [Test] public async Task Action_ShouldBeTreatedAsVoidDelegate() { bool isCalled = false; @@ -17,9 +17,9 @@ public async Task Action_ShouldBeTreatedAsVoidDelegate() await That(isCalled).IsTrue(); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task CreateMockWithBehavior_ShouldApplyBehavior(bool throwWhenNotSetup) { Func sut = Func.CreateMock(MockBehavior.Default.ThrowingWhenNotSetup(throwWhenNotSetup)); @@ -33,7 +33,7 @@ await That(Act).Throws().OnlyIf(throwWhenNotSetup) .WithMessage("The method 'global::System.Func.Invoke()' was invoked without prior setup."); } - [Fact] + [Test] public async Task CreateMockWithSetup_ShouldApplySetups() { Func sut = Func.CreateMock(mock => mock.Setup().Returns(3)); @@ -43,7 +43,7 @@ public async Task CreateMockWithSetup_ShouldApplySetups() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task Func_ShouldBeTreatedAsReturnDelegate() { bool isCalled = false; @@ -57,7 +57,7 @@ public async Task Func_ShouldBeTreatedAsReturnDelegate() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task WithCustomDelegate_SetupShouldWork() { DoSomething sut = DoSomething.CreateMock(); @@ -74,7 +74,7 @@ public async Task WithCustomDelegate_SetupShouldWork() await That(result3).IsEqualTo(3); } - [Fact] + [Test] public async Task WithCustomDelegate_VerifyShouldWork() { DoSomething sut = DoSomething.CreateMock(); @@ -85,7 +85,7 @@ public async Task WithCustomDelegate_VerifyShouldWork() await That(sut.Mock.Verify(It.IsAny(), It.IsAny(), It.IsAny())).Twice(); } - [Fact] + [Test] public async Task WithCustomDelegateWithInts_SetupWithExplicitParameter_ShouldWork() { DoSomethingWithInts sut = DoSomethingWithInts.CreateMock(); @@ -98,7 +98,7 @@ public async Task WithCustomDelegateWithInts_SetupWithExplicitParameter_ShouldWo await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task WithCustomDelegateWithInts_VerifyWithExplicitParameter_ShouldWork() { DoSomethingWithInts sut = DoSomethingWithInts.CreateMock(); @@ -110,7 +110,7 @@ public async Task WithCustomDelegateWithInts_VerifyWithExplicitParameter_ShouldW await That(sut.Mock.Verify(3, It.IsAny(), It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithCustomDelegateWithRefAndOut_SetupShouldWork() { DoSomethingWithRefAndOut sut = DoSomethingWithRefAndOut.CreateMock(); @@ -124,7 +124,7 @@ public async Task WithCustomDelegateWithRefAndOut_SetupShouldWork() await That(value2).IsEqualTo(10); } - [Fact] + [Test] public async Task WithCustomDelegateWithRefAndOut_VerifyShouldWork() { DoSomethingWithRefAndOut sut = DoSomethingWithRefAndOut.CreateMock(); @@ -136,7 +136,7 @@ public async Task WithCustomDelegateWithRefAndOut_VerifyShouldWork() await That(value).IsEqualTo(5); } - [Fact] + [Test] public async Task WithCustomGenericDelegate_SetupShouldWork() { DoGeneric sut = DoGeneric.CreateMock(); @@ -153,7 +153,7 @@ public async Task WithCustomGenericDelegate_SetupShouldWork() await That(result3).IsEqualTo(3); } - [Fact] + [Test] public async Task WithCustomGenericDelegate_VerifyShouldWork() { DoGeneric sut = DoGeneric.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingBaseTests.cs b/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingBaseTests.cs index cf60f7e27..f99d93774 100644 --- a/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingBaseTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingBaseTests.cs @@ -4,7 +4,7 @@ public sealed partial class InteractionsTests { public sealed class ThrowingBaseTests { - [Fact] + [Test] public async Task BaseClass_InvokesEvent_AfterUnsubscribe_ShouldNotForwardToSubscribers() { BroadcastingService sut = BroadcastingService.CreateMock(); @@ -22,7 +22,7 @@ void Handler(int value) await That(received).IsEqualTo(-1); } - [Fact] + [Test] public async Task BaseClass_InvokesEvent_ShouldForwardToSubscribers() { BroadcastingService sut = BroadcastingService.CreateMock(); @@ -34,7 +34,7 @@ public async Task BaseClass_InvokesEvent_ShouldForwardToSubscribers() await That(received).IsEqualTo(42); } - [Fact] + [Test] public async Task BaseClass_InvokesEvent_WhenSkipBaseClass_ShouldNotForwardToSubscribers() { BroadcastingService sut = BroadcastingService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -46,7 +46,7 @@ public async Task BaseClass_InvokesEvent_WhenSkipBaseClass_ShouldNotForwardToSub await That(received).IsEqualTo(-1); } - [Fact] + [Test] public async Task EventSubscribe_WhenBaseClassThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordSubscription() { @@ -66,7 +66,7 @@ static void Handler(int value) } } - [Fact] + [Test] public async Task EventSubscribe_WhenBaseClassThrows_ShouldStillRecordSubscription() { ThrowingBaseEventService sut = ThrowingBaseEventService.CreateMock(); @@ -84,7 +84,7 @@ static void Handler(int value) } } - [Fact] + [Test] public async Task EventUnsubscribe_WhenBaseClassThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordUnsubscription() { @@ -104,7 +104,7 @@ static void Handler(int value) } } - [Fact] + [Test] public async Task EventUnsubscribe_WhenBaseClassThrows_ShouldStillRecordUnsubscription() { ThrowingBaseEventService sut = ThrowingBaseEventService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingCallbackTests.cs b/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingCallbackTests.cs index 90fbad1db..5fc662376 100644 --- a/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingCallbackTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/InteractionsTests.ThrowingCallbackTests.cs @@ -4,7 +4,7 @@ public sealed partial class InteractionsTests { public sealed class ThrowingCallbackTests { - [Fact] + [Test] public async Task EventSubscribe_WhenSetupCallbackThrows_ShouldStillRecordSubscription() { ThrowingCallbackEventService sut = ThrowingCallbackEventService.CreateMock(); @@ -24,7 +24,7 @@ static void Handler(int value) } } - [Fact] + [Test] public async Task EventUnsubscribe_WhenSetupCallbackThrows_ShouldStillRecordUnsubscription() { ThrowingCallbackEventService sut = ThrowingCallbackEventService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockEvents/InteractionsTests.cs b/Tests/Mockolate.Tests/MockEvents/InteractionsTests.cs index 624fb5adb..ccf6aef66 100644 --- a/Tests/Mockolate.Tests/MockEvents/InteractionsTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/InteractionsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockEvents; public sealed partial class InteractionsTests { - [Fact] + [Test] public async Task EventSubscription_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -15,7 +15,7 @@ public async Task EventSubscription_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task EventUnsubscription_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); diff --git a/Tests/Mockolate.Tests/MockEvents/RaiseTests.ProtectedTests.cs b/Tests/Mockolate.Tests/MockEvents/RaiseTests.ProtectedTests.cs index 91392b7c8..0458ac471 100644 --- a/Tests/Mockolate.Tests/MockEvents/RaiseTests.ProtectedTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/RaiseTests.ProtectedTests.cs @@ -4,7 +4,7 @@ public sealed partial class RaiseTests { public sealed class ProtectedTests { - [Fact] + [Test] public async Task Subscription_ShouldBeRegistered() { MyRaiseEvent sut = MyRaiseEvent.CreateMock(); @@ -17,7 +17,7 @@ public async Task Subscription_ShouldBeRegistered() await That(sut.Mock.VerifyProtected.SomeEvent.Unsubscribed()).Never(); } - [Fact] + [Test] public async Task Unsubscription_ShouldBeRegistered() { MyRaiseEvent sut = MyRaiseEvent.CreateMock(); @@ -29,7 +29,7 @@ public async Task Unsubscription_ShouldBeRegistered() await That(sut.Mock.VerifyProtected.SomeEvent.Unsubscribed()).Once(); } - [Fact] + [Test] public async Task WhenUsingRaise_AnyParameters_ShouldInvokeEvent() { int callCount = 0; @@ -46,7 +46,7 @@ public async Task WhenUsingRaise_AnyParameters_ShouldInvokeEvent() await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task WhenUsingRaise_ShouldInvokeEvent() { int callCount = 0; diff --git a/Tests/Mockolate.Tests/MockEvents/RaiseTests.cs b/Tests/Mockolate.Tests/MockEvents/RaiseTests.cs index d8ed17835..b360d3804 100644 --- a/Tests/Mockolate.Tests/MockEvents/RaiseTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/RaiseTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockEvents; public sealed partial class RaiseTests { - [Fact] + [Test] public async Task AddEvent_WithoutMethod_ShouldThrowMockException() { IRaiseEvent sut = IRaiseEvent.CreateMock(); @@ -19,7 +19,7 @@ await That(Act).Throws() .WithMessage("The method of an event subscription may not be null."); } - [Fact] + [Test] public async Task RemoveEvent_WithoutMethod_ShouldThrowMockException() { IRaiseEvent sut = IRaiseEvent.CreateMock(); @@ -34,7 +34,7 @@ await That(Act).Throws() .WithMessage("The method of an event unsubscription may not be null."); } - [Fact] + [Test] public async Task Subscription_ShouldBeRegistered() { IRaiseEvent sut = IRaiseEvent.CreateMock(); @@ -47,7 +47,7 @@ public async Task Subscription_ShouldBeRegistered() await That(sut.Mock.Verify.SomeEvent.Unsubscribed()).Never(); } - [Fact] + [Test] public async Task Unsubscription_ShouldBeRegistered() { IRaiseEvent sut = IRaiseEvent.CreateMock(); @@ -59,7 +59,7 @@ public async Task Unsubscription_ShouldBeRegistered() await That(sut.Mock.Verify.SomeEvent.Unsubscribed()).Once(); } - [Fact] + [Test] public async Task WhenMockInheritsEventMultipleTimes() { IMyEventService sut = IMyEventService.CreateMock().Implementing(); @@ -79,7 +79,7 @@ void Subject_SomeEvent(object? sender, string e) } } - [Fact] + [Test] public async Task WhenSubscribedToOtherEvent_ShouldNotTrigger() { int callCount = 0; @@ -96,7 +96,7 @@ public async Task WhenSubscribedToOtherEvent_ShouldNotTrigger() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task WhenSubscriptionThrows_ShouldNotWrapException() { IMyEventService sut = IMyEventService.CreateMock().Implementing(); @@ -116,7 +116,7 @@ void SubscriptionThrowingException(object? sender, string e) } } - [Fact] + [Test] public async Task WhenUnsubscribedFromOtherEvent_ShouldNotAffectOtherSubscriptions() { int callCount = 0; @@ -140,7 +140,7 @@ public async Task WhenUnsubscribedFromOtherEvent_ShouldNotAffectOtherSubscriptio await That(otherCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task WhenUsingRaise_AnyParameters_ShouldInvokeEvent() { int callCount = 0; @@ -157,7 +157,7 @@ public async Task WhenUsingRaise_AnyParameters_ShouldInvokeEvent() await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task WhenUsingRaise_ShouldInvokeEvent() { int callCount = 0; @@ -174,7 +174,7 @@ public async Task WhenUsingRaise_ShouldInvokeEvent() await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task WhenUsingRaise_WithoutRegistration_ShouldNotThrow() { IRaiseEvent sut = IRaiseEvent.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockEvents/SetupEventTests.InScenarioTests.cs b/Tests/Mockolate.Tests/MockEvents/SetupEventTests.InScenarioTests.cs index f0acc633c..add5f8f29 100644 --- a/Tests/Mockolate.Tests/MockEvents/SetupEventTests.InScenarioTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/SetupEventTests.InScenarioTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupEventTests { public sealed class InScenarioTests { - [Fact] + [Test] public async Task WithMatchingScopedAndGlobalSubscribedSetups_OnlyScopedShouldFire() { int scopedCount = 0; @@ -23,7 +23,7 @@ public async Task WithMatchingScopedAndGlobalSubscribedSetups_OnlyScopedShouldFi await That(globalCount).IsEqualTo(0); } - [Fact] + [Test] public async Task WithMatchingScopedAndGlobalUnsubscribedSetups_OnlyScopedShouldFire() { int scopedCount = 0; @@ -41,7 +41,7 @@ public async Task WithMatchingScopedAndGlobalUnsubscribedSetups_OnlyScopedShould await That(globalCount).IsEqualTo(0); } - [Fact] + [Test] public async Task WithScopedBucketButNoScopedEventSetup_GlobalShouldStillFire() { int globalCount = 0; diff --git a/Tests/Mockolate.Tests/MockEvents/SetupEventTests.cs b/Tests/Mockolate.Tests/MockEvents/SetupEventTests.cs index b906e165c..88caaad5d 100644 --- a/Tests/Mockolate.Tests/MockEvents/SetupEventTests.cs +++ b/Tests/Mockolate.Tests/MockEvents/SetupEventTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests.MockEvents; public sealed partial class SetupEventTests { - [Fact] + [Test] public async Task Forever_Extension_RepeatsIndefinitely() { int callCount = 0; @@ -25,7 +25,7 @@ public async Task Forever_Extension_RepeatsIndefinitely() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task MultipleSetups_AreAllInvoked() { int callCount1 = 0; @@ -43,7 +43,7 @@ public async Task MultipleSetups_AreAllInvoked() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnlyOnce_Extension_StopsAfterSingleInvocation() { int callCount = 0; @@ -60,7 +60,7 @@ public async Task OnlyOnce_Extension_StopsAfterSingleInvocation() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_Do_Action_IsInvokedOnSubscribe() { int callCount = 0; @@ -76,7 +76,7 @@ public async Task OnSubscribed_Do_Action_IsInvokedOnSubscribe() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_Do_TargetMethod_ReceivesCorrectValues() { List received = []; @@ -92,7 +92,7 @@ public async Task OnSubscribed_Do_TargetMethod_ReceivesCorrectValues() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_DoesNotFireOnUnsubscribe() { int callCount = 0; @@ -107,7 +107,7 @@ void Handler(string type, int amount) { } await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task OnSubscribed_For_RepeatsCallbackNTimes() { int count1 = 0; @@ -128,7 +128,7 @@ public async Task OnSubscribed_For_RepeatsCallbackNTimes() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_For2_HoldsFirstCallbackForTwoSubscriptionsBeforeAdvancing() { int count1 = 0; @@ -150,7 +150,7 @@ public async Task OnSubscribed_For2_HoldsFirstCallbackForTwoSubscriptionsBeforeA void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_InParallel_RunsAlongsideNextCallback() { int count1 = 0; @@ -170,7 +170,7 @@ public async Task OnSubscribed_InParallel_RunsAlongsideNextCallback() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_Only_StopsAfterNInvocations() { int callCount = 0; @@ -188,7 +188,7 @@ public async Task OnSubscribed_Only_StopsAfterNInvocations() void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnSubscribed_When_OnlyFires_WhenPredicateMatches() { int callCount = 0; @@ -207,7 +207,7 @@ await That(callCount).IsEqualTo(3) void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnUnsubscribed_Do_Action_IsInvokedOnUnsubscribe() { int callCount = 0; @@ -224,7 +224,7 @@ void Handler(string type, int amount) { } await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task OnUnsubscribed_Do_TargetMethod_ReceivesCorrectValues() { List received = []; @@ -241,7 +241,7 @@ void Handler(string type, int amount) { } await That(received[0].Name).Contains("Handler"); } - [Fact] + [Test] public async Task OnUnsubscribed_DoesNotFireOnSubscribe() { int callCount = 0; @@ -255,7 +255,7 @@ void Handler(string type, int amount) { } await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task OnUnsubscribed_For_RepeatsCallbackNTimes() { int count1 = 0; @@ -276,7 +276,7 @@ void Handler(string type, int amount) { } await That(count2).IsEqualTo(1); } - [Fact] + [Test] public async Task OnUnsubscribed_For2_HoldsFirstCallbackForTwoUnsubscriptionsBeforeAdvancing() { int count1 = 0; @@ -298,7 +298,7 @@ public async Task OnUnsubscribed_For2_HoldsFirstCallbackForTwoUnsubscriptionsBef void Handler(string type, int amount) { } } - [Fact] + [Test] public async Task OnUnsubscribed_Forever_Extension_RepeatsIndefinitely() { int callCount = 0; @@ -317,7 +317,7 @@ void Handler(string type, int amount) { } await That(callCount).IsEqualTo(10); } - [Fact] + [Test] public async Task OnUnsubscribed_InParallel_RunsAlongsideNextCallback() { int count1 = 0; @@ -337,7 +337,7 @@ void Handler(string type, int amount) { } await That(count2).IsEqualTo(2); } - [Fact] + [Test] public async Task OnUnsubscribed_Only_StopsAfterNInvocations() { int callCount = 0; @@ -355,7 +355,7 @@ void Handler(string type, int amount) { } await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task OnUnsubscribed_OnlyOnce_Extension_StopsAfterSingleInvocation() { int callCount = 0; @@ -372,7 +372,7 @@ void Handler(string type, int amount) { } await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task OnUnsubscribed_When_OnlyFires_WhenPredicateMatches() { int callCount = 0; @@ -391,7 +391,7 @@ await That(callCount).IsEqualTo(3) .Because("the unsubscriptions at index 0, 2 and 4 pass the predicate"); } - [Fact] + [Test] public async Task SetupDoesNotInterfereWithVerification() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockExtensionsTests.ClearAllInteractionsTests.cs b/Tests/Mockolate.Tests/MockExtensionsTests.ClearAllInteractionsTests.cs index 353a65359..0acd7c9ef 100644 --- a/Tests/Mockolate.Tests/MockExtensionsTests.ClearAllInteractionsTests.cs +++ b/Tests/Mockolate.Tests/MockExtensionsTests.ClearAllInteractionsTests.cs @@ -7,7 +7,7 @@ public sealed partial class MockExtensionsTests { public sealed class ClearAllInteractionsTests { - [Fact] + [Test] public async Task Monitor_WhenRunning_ShouldClearAllInteractions() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -34,7 +34,7 @@ public async Task Monitor_WhenRunning_ShouldClearAllInteractions() await That(monitor.Verify.Dispense(It.Is("Light"), It.Is(4))).Never(); } - [Fact] + [Test] public async Task Monitor_WhenRunning_ShouldContinueAfterClearAllInteractions() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -61,7 +61,7 @@ public async Task Monitor_WhenRunning_ShouldContinueAfterClearAllInteractions() await That(monitor.Verify.Dispense(It.Is("Light"), It.Is(4))).Never(); } - [Fact] + [Test] public async Task Monitor_WhenStopped_ShouldIgnoreClearAllInteractions() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -88,7 +88,7 @@ public async Task Monitor_WhenStopped_ShouldIgnoreClearAllInteractions() await That(monitor.Verify.Dispense(It.Is("Light"), It.Is(4))).Never(); } - [Fact] + [Test] public async Task ShouldClearRecordedInteractions() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockExtensionsTests.InvokedSetupTests.cs b/Tests/Mockolate.Tests/MockExtensionsTests.InvokedSetupTests.cs index 76a645c89..1404bf14f 100644 --- a/Tests/Mockolate.Tests/MockExtensionsTests.InvokedSetupTests.cs +++ b/Tests/Mockolate.Tests/MockExtensionsTests.InvokedSetupTests.cs @@ -9,7 +9,7 @@ public sealed partial class MockExtensionsTests { public sealed class InvokedSetupTests { - [Fact] + [Test] public async Task WhenMethodSetupIsNotVerifiable_ShouldThrowMockException() { MyServiceBase sut = MyServiceBase.CreateMock(); @@ -24,7 +24,7 @@ await That(Act).Throws() .WithMessage("The setup is not verifiable."); } - [Fact] + [Test] public async Task WhenSubjectIsNoMock_ShouldThrowMockException() { MyServiceBase mock = MyServiceBase.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.ThrowingBaseTests.cs b/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.ThrowingBaseTests.cs index c15938dcc..e7f85cfbe 100644 --- a/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.ThrowingBaseTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.ThrowingBaseTests.cs @@ -6,7 +6,7 @@ public sealed partial class InteractionsTests { public sealed class ThrowingBaseTests { - [Fact] + [Test] public async Task IndexerGetter_WhenBaseThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -20,7 +20,7 @@ void Act() await That(sut.Mock.Verify[1].Got()).Once(); } - [Fact] + [Test] public async Task IndexerGetterWith1Parameter_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -35,7 +35,7 @@ void Act() await That(v1.Values).HasSingle().Which.IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerGetterWith1Parameter_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -49,7 +49,7 @@ void Act() await That(sut.Mock.Verify[1].Got()).Once(); } - [Fact] + [Test] public async Task IndexerGetterWith2Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -68,7 +68,7 @@ void Act() await That(v2.Values).HasSingle().Which.IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerGetterWith2Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -82,7 +82,7 @@ void Act() await That(sut.Mock.Verify[1, 2].Got()).Once(); } - [Fact] + [Test] public async Task IndexerGetterWith3Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -103,7 +103,7 @@ void Act() await That(v3.Values).HasSingle().Which.IsEqualTo(3); } - [Fact] + [Test] public async Task IndexerGetterWith3Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -117,7 +117,7 @@ void Act() await That(sut.Mock.Verify[1, 2, 3].Got()).Once(); } - [Fact] + [Test] public async Task IndexerGetterWith4Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -140,7 +140,7 @@ void Act() await That(v4.Values).HasSingle().Which.IsEqualTo(4); } - [Fact] + [Test] public async Task IndexerGetterWith4Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -154,7 +154,7 @@ void Act() await That(sut.Mock.Verify[1, 2, 3, 4].Got()).Once(); } - [Fact] + [Test] public async Task IndexerGetterWith5Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -179,7 +179,7 @@ void Act() await That(v5.Values).HasSingle().Which.IsEqualTo(5); } - [Fact] + [Test] public async Task IndexerGetterWith5Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -193,7 +193,7 @@ void Act() await That(sut.Mock.Verify[1, 2, 3, 4, 5].Got()).Once(); } - [Fact] + [Test] public async Task IndexerSetter_WhenBaseThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -207,7 +207,7 @@ void Act() await That(sut.Mock.Verify[1].Set("value")).Once(); } - [Fact] + [Test] public async Task IndexerSetterWith1Parameter_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -222,7 +222,7 @@ void Act() await That(v1.Values).HasSingle().Which.IsEqualTo(1); } - [Fact] + [Test] public async Task IndexerSetterWith1Parameter_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -236,7 +236,7 @@ void Act() await That(sut.Mock.Verify[1].Set("value")).Once(); } - [Fact] + [Test] public async Task IndexerSetterWith2Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -255,7 +255,7 @@ void Act() await That(v2.Values).HasSingle().Which.IsEqualTo(2); } - [Fact] + [Test] public async Task IndexerSetterWith2Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -269,7 +269,7 @@ void Act() await That(sut.Mock.Verify[1, 2].Set("value")).Once(); } - [Fact] + [Test] public async Task IndexerSetterWith3Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -290,7 +290,7 @@ void Act() await That(v3.Values).HasSingle().Which.IsEqualTo(3); } - [Fact] + [Test] public async Task IndexerSetterWith3Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -304,7 +304,7 @@ void Act() await That(sut.Mock.Verify[1, 2, 3].Set("value")).Once(); } - [Fact] + [Test] public async Task IndexerSetterWith4Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -327,7 +327,7 @@ void Act() await That(v4.Values).HasSingle().Which.IsEqualTo(4); } - [Fact] + [Test] public async Task IndexerSetterWith4Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -341,7 +341,7 @@ void Act() await That(sut.Mock.Verify[1, 2, 3, 4].Set("value")).Once(); } - [Fact] + [Test] public async Task IndexerSetterWith5Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); @@ -366,7 +366,7 @@ void Act() await That(v5.Values).HasSingle().Which.IsEqualTo(5); } - [Fact] + [Test] public async Task IndexerSetterWith5Parameters_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseIndexerService sut = ThrowingBaseIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.cs b/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.cs index 9aecc96a5..829dc4c65 100644 --- a/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/InteractionsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockIndexers; public sealed partial class InteractionsTests { - [Fact] + [Test] public async Task IndexerGetterAccess1_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -17,7 +17,7 @@ public async Task IndexerGetterAccess1_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess1_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -30,7 +30,7 @@ public async Task IndexerGetterAccess1_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess2_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -44,7 +44,7 @@ public async Task IndexerGetterAccess2_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess2_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -58,7 +58,7 @@ public async Task IndexerGetterAccess2_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess3_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -73,7 +73,7 @@ public async Task IndexerGetterAccess3_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess3_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -88,7 +88,7 @@ public async Task IndexerGetterAccess3_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess4_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -104,7 +104,7 @@ public async Task IndexerGetterAccess4_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess4_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -120,7 +120,7 @@ public async Task IndexerGetterAccess4_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess5_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -137,7 +137,7 @@ public async Task IndexerGetterAccess5_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerGetterAccess5_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -154,7 +154,7 @@ public async Task IndexerGetterAccess5_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess1_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -168,7 +168,7 @@ public async Task IndexerSetterAccess1_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess1_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -182,7 +182,7 @@ public async Task IndexerSetterAccess1_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess2_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -197,7 +197,7 @@ public async Task IndexerSetterAccess2_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess2_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -212,7 +212,7 @@ public async Task IndexerSetterAccess2_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess3_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -228,7 +228,7 @@ public async Task IndexerSetterAccess3_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess3_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -244,7 +244,7 @@ public async Task IndexerSetterAccess3_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess4_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -261,7 +261,7 @@ public async Task IndexerSetterAccess4_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess4_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -278,7 +278,7 @@ public async Task IndexerSetterAccess4_ToString_WithNull_ShouldReturnExpectedVal await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess5_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -296,7 +296,7 @@ public async Task IndexerSetterAccess5_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task IndexerSetterAccess5_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.AccessorRestrictedTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.AccessorRestrictedTests.cs index 647477fce..2aca8df9a 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.AccessorRestrictedTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.AccessorRestrictedTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Mockolate.Setup; +using Mockolate.Tests.TestHelpers; using Mockolate.Verify; namespace Mockolate.Tests.MockIndexers; @@ -8,7 +9,7 @@ public sealed partial class SetupIndexerTests { public sealed class AccessorRestrictedTests { - [Fact] + [Test] public async Task SetOnlyIndexer_OnSet_ShouldFireAndRecordTheWrite() { IAccessorService sut = IAccessorService.CreateMock(); @@ -22,7 +23,7 @@ await That(sut.Mock.Verify[It.Is("name")].Set("Ada")).Once() .Because("the setter facade must be keyed on the setter member id, not the getter's"); } - [Fact] + [Test] public async Task SetOnlyIndexer_VerifyOtherValue_ShouldNotMatch() { IAccessorService sut = IAccessorService.CreateMock(); @@ -32,7 +33,7 @@ public async Task SetOnlyIndexer_VerifyOtherValue_ShouldNotMatch() await That(sut.Mock.Verify[It.Is("name")].Set("Grace")).Never(); } - [Fact] + [Test] public async Task SetOnlyIndexer_VerifyWithParameterMatcher_ShouldMatch() { IAccessorService sut = IAccessorService.CreateMock(); @@ -42,9 +43,9 @@ public async Task SetOnlyIndexer_VerifyWithParameterMatcher_ShouldMatch() await That(sut.Mock.Verify[It.IsAny()].Set(It.IsAny())).Once(); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task SetOnlyClassIndexer_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -56,7 +57,7 @@ public async Task SetOnlyClassIndexer_ShouldSkipCallingBaseWhenRequested(bool sk await That(sut.SetterCallCount).IsEqualTo(expectedCallCount); } - [Fact] + [Test] public async Task GetOnlyIndexer_ChainedReturns_ShouldStayOnGetterOnlySurface() { IAccessorService sut = IAccessorService.CreateMock(); @@ -68,7 +69,7 @@ public async Task GetOnlyIndexer_ChainedReturns_ShouldStayOnGetterOnlySurface() await That(sut[1]).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyIndexer_ReturnsForever_ShouldUseTheLastValueForever() { IAccessorService sut = IAccessorService.CreateMock(); @@ -85,7 +86,7 @@ public async Task GetOnlyIndexer_ReturnsForever_ShouldUseTheLastValueForever() await That(result).IsEqualTo([2, 4, 4, 4,]); } - [Fact] + [Test] public async Task GetOnlyIndexer_ReturnsWhen_ShouldOnlyUseValueWhenPredicateIsTrue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -99,7 +100,7 @@ public async Task GetOnlyIndexer_ReturnsWhen_ShouldOnlyUseValueWhenPredicateIsTr await That(result2).IsEqualTo(4); } - [Fact] + [Test] public async Task GetOnlyIndexer_ReturnsCallbackWithValue_ShouldReturnExpectedValue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -112,7 +113,7 @@ public async Task GetOnlyIndexer_ReturnsCallbackWithValue_ShouldReturnExpectedVa await That(result).IsEqualTo(12); } - [Fact] + [Test] public async Task GetOnlyIndexer_InitializeWithGenerator_ShouldSeedTheReadValue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -123,7 +124,7 @@ public async Task GetOnlyIndexer_InitializeWithGenerator_ShouldSeedTheReadValue( await That(sut[5]).IsEqualTo(50); } - [Fact] + [Test] public async Task GetOnlyIndexer_Throws_ShouldIterateThroughAllRegisteredExceptions() { IAccessorService sut = IAccessorService.CreateMock(); @@ -137,17 +138,17 @@ public async Task GetOnlyIndexer_Throws_ShouldIterateThroughAllRegisteredExcepti void Act() => _ = sut[6]; await That(Act).Throws(); - Exception? result2 = Record.Exception(Act); - Exception? result3 = Record.Exception(Act); - Exception? result4 = Record.Exception(Act); - Exception? result5 = Record.Exception(Act); + Exception? result2 = Catch.Exception(Act); + Exception? result3 = Catch.Exception(Act); + Exception? result4 = Catch.Exception(Act); + Exception? result5 = Catch.Exception(Act); await That(result2).HasMessage("foo"); await That(result3).HasMessage("bar"); await That(result4).HasMessage("baz-6"); await That(result5).HasMessage("qux-6-0"); } - [Fact] + [Test] public async Task GetOnlyIndexer_OnGetChain_ShouldStayOnGetterOnlySurface() { int callCount1 = 0; @@ -168,7 +169,7 @@ public async Task GetOnlyIndexer_OnGetChain_ShouldStayOnGetterOnlySurface() await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task GetOnlyIndexer_OnGetWhen_ShouldOnlyInvokeCallbackWhenPredicateIsTrue() { int callCount = 0; @@ -183,7 +184,7 @@ public async Task GetOnlyIndexer_OnGetWhen_ShouldOnlyInvokeCallbackWhenPredicate await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyIndexer_OnGetInParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -205,7 +206,7 @@ public async Task GetOnlyIndexer_OnGetInParallel_ShouldInvokeParallelCallbacksAl await That(callCount3).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyIndexer_OnGetFor_ShouldRepeatCallbackTheGivenNumberOfTimes() { int callCount1 = 0; @@ -224,7 +225,7 @@ public async Task GetOnlyIndexer_OnGetFor_ShouldRepeatCallbackTheGivenNumberOfTi await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyIndexer_OnGetTransitionTo_ShouldSwitchScenario() { IAccessorService sut = IAccessorService.CreateMock(); @@ -238,7 +239,7 @@ public async Task GetOnlyIndexer_OnGetTransitionTo_ShouldSwitchScenario() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task SetOnlyIndexer_OnSetChain_ShouldStayOnSetterOnlySurface() { int callCount1 = 0; @@ -258,7 +259,7 @@ public async Task SetOnlyIndexer_OnSetChain_ShouldStayOnSetterOnlySurface() await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task SetOnlyIndexer_OnSetWhen_ShouldOnlyInvokeCallbackWhenPredicateIsTrue() { int callCount = 0; @@ -273,7 +274,7 @@ public async Task SetOnlyIndexer_OnSetWhen_ShouldOnlyInvokeCallbackWhenPredicate await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyIndexer_OnSetInParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -295,7 +296,7 @@ public async Task SetOnlyIndexer_OnSetInParallel_ShouldInvokeParallelCallbacksAl await That(callCount3).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyIndexer_OnSetFor_ShouldRepeatCallbackTheGivenNumberOfTimes() { int callCount1 = 0; @@ -314,7 +315,7 @@ public async Task SetOnlyIndexer_OnSetFor_ShouldRepeatCallbackTheGivenNumberOfTi await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyIndexer_OnSetTransitionTo_ShouldSwitchScenario() { IAccessorService sut = IAccessorService.CreateMock(); @@ -328,7 +329,7 @@ public async Task SetOnlyIndexer_OnSetTransitionTo_ShouldSwitchScenario() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task GetOnlyIndexer_Got_ShouldMatchOnlyMatchingKeys() { IAccessorService sut = IAccessorService.CreateMock(); @@ -339,7 +340,7 @@ public async Task GetOnlyIndexer_Got_ShouldMatchOnlyMatchingKeys() await That(sut.Mock.Verify[It.Is(2)].Got()).Never(); } - [Fact] + [Test] public async Task GetOnlyTwoKeyIndexer_ReturnsAndGot_ShouldUseTheNarrowedSurface() { IAccessorService sut = IAccessorService.CreateMock(); @@ -353,7 +354,7 @@ public async Task GetOnlyTwoKeyIndexer_ReturnsAndGot_ShouldUseTheNarrowedSurface await That(sut.Mock.Verify[It.Is(20), It.Is(23)].Got()).Never(); } - [Fact] + [Test] public async Task SetOnlyTwoKeyIndexer_OnSetAndVerify_ShouldUseTheNarrowedSurface() { List written = new(); @@ -368,7 +369,7 @@ public async Task SetOnlyTwoKeyIndexer_OnSetAndVerify_ShouldUseTheNarrowedSurfac await That(sut.Mock.Verify[It.Is("a"), It.Is("b")].Set("d")).Never(); } - [Fact] + [Test] public async Task SetOnlyFourKeyIndexer_Set_ShouldVerifyTheWrite() { IAccessorService sut = IAccessorService.CreateMock(); @@ -379,7 +380,7 @@ public async Task SetOnlyFourKeyIndexer_Set_ShouldVerifyTheWrite() await That(sut.Mock.Verify[It.Is(1), It.Is(2), It.Is(3), It.Is(5)].Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_ChainedReturns_ShouldStayOnGetterOnlySurface() { IAccessorService sut = IAccessorService.CreateMock(); @@ -395,7 +396,7 @@ await That(sut.Mock.Verify[It.Is(1), It.Is(2), It.Is(3), It.Is(4), It.Is(5)].Got await That(sut.Mock.Verify[It.Is(1), It.Is(2), It.Is(3), It.Is(4), It.Is(6)].Got()).Never(); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_ReturnsForever_ShouldUseTheLastValueForever() { IAccessorService sut = IAccessorService.CreateMock(); @@ -412,7 +413,7 @@ public async Task GetOnlyFiveKeyIndexer_ReturnsForever_ShouldUseTheLastValueFore await That(result).IsEqualTo([2, 4, 4, 4,]); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetAndVerify_ShouldUseTheNarrowedSurface() { List written = new(); @@ -428,7 +429,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetAndVerify_ShouldUseTheNarrowedSurfa await That(sut.Mock.Verify[It.Is("a"), It.Is("b"), It.Is("c"), It.Is("d"), It.Is("e")].Set("y")).Never(); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_Throws_ShouldIterateThroughAllRegisteredExceptions() { IAccessorService sut = IAccessorService.CreateMock(); @@ -442,17 +443,17 @@ public async Task GetOnlyFiveKeyIndexer_Throws_ShouldIterateThroughAllRegistered void Act() => _ = sut[1, 2, 3, 4, 5]; await That(Act).Throws(); - Exception? result2 = Record.Exception(Act); - Exception? result3 = Record.Exception(Act); - Exception? result4 = Record.Exception(Act); - Exception? result5 = Record.Exception(Act); + Exception? result2 = Catch.Exception(Act); + Exception? result3 = Catch.Exception(Act); + Exception? result4 = Catch.Exception(Act); + Exception? result5 = Catch.Exception(Act); await That(result2).HasMessage("foo"); await That(result3).HasMessage("bar"); await That(result4).HasMessage("baz-15"); await That(result5).HasMessage("qux-15-0"); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_InitializeWith_ShouldSeedTheReadValue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -463,7 +464,7 @@ public async Task GetOnlyFiveKeyIndexer_InitializeWith_ShouldSeedTheReadValue() await That(sut[1, 2, 3, 4, 5]).IsEqualTo(12); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_InitializeWithGenerator_ShouldSeedTheReadValue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -473,7 +474,7 @@ public async Task GetOnlyFiveKeyIndexer_InitializeWithGenerator_ShouldSeedTheRea await That(sut[1, 2, 3, 4, 5]).IsEqualTo(150); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_ReturnsWhen_ShouldOnlyUseValueWhenPredicateIsTrue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -487,7 +488,7 @@ public async Task GetOnlyFiveKeyIndexer_ReturnsWhen_ShouldOnlyUseValueWhenPredic await That(result2).IsEqualTo(4); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_SkippingBaseClass_ShouldStayOnGetterOnlySurface() { IAccessorService sut = IAccessorService.CreateMock(); @@ -499,7 +500,7 @@ public async Task GetOnlyFiveKeyIndexer_SkippingBaseClass_ShouldStayOnGetterOnly await That(sut[1, 2, 3, 4, 5]).IsEqualTo(7); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_OnGetChain_ShouldStayOnGetterOnlySurface() { int callCount1 = 0; @@ -521,7 +522,7 @@ public async Task GetOnlyFiveKeyIndexer_OnGetChain_ShouldStayOnGetterOnlySurface await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_OnGetWhen_ShouldOnlyInvokeCallbackWhenPredicateIsTrue() { int callCount = 0; @@ -536,7 +537,7 @@ public async Task GetOnlyFiveKeyIndexer_OnGetWhen_ShouldOnlyInvokeCallbackWhenPr await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_OnGetInParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -558,7 +559,7 @@ public async Task GetOnlyFiveKeyIndexer_OnGetInParallel_ShouldInvokeParallelCall await That(callCount3).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_OnGetFor_ShouldRepeatCallbackTheGivenNumberOfTimes() { int callCount1 = 0; @@ -577,7 +578,7 @@ public async Task GetOnlyFiveKeyIndexer_OnGetFor_ShouldRepeatCallbackTheGivenNum await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_OnGetDoWithCounter_ShouldReceiveTheAccessCounter() { List invocations = []; @@ -593,7 +594,7 @@ public async Task GetOnlyFiveKeyIndexer_OnGetDoWithCounter_ShouldReceiveTheAcces await That(invocations).IsEqualTo([0, 1, 2,]); } - [Fact] + [Test] public async Task GetOnlyFiveKeyIndexer_OnGetTransitionTo_ShouldSwitchScenario() { IAccessorService sut = IAccessorService.CreateMock(); @@ -608,7 +609,7 @@ public async Task GetOnlyFiveKeyIndexer_OnGetTransitionTo_ShouldSwitchScenario() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetChain_ShouldStayOnSetterOnlySurface() { int callCount1 = 0; @@ -630,7 +631,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetChain_ShouldStayOnSetterOnlySurface await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetWhen_ShouldOnlyInvokeCallbackWhenPredicateIsTrue() { int callCount = 0; @@ -647,7 +648,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetWhen_ShouldOnlyInvokeCallbackWhenPr await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetInParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -671,7 +672,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetInParallel_ShouldInvokeParallelCall await That(callCount3).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetFor_ShouldRepeatCallbackTheGivenNumberOfTimes() { int callCount1 = 0; @@ -692,7 +693,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetFor_ShouldRepeatCallbackTheGivenNum await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetDoWithCounter_ShouldReceiveTheAccessCounter() { List invocations = []; @@ -710,7 +711,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetDoWithCounter_ShouldReceiveTheAcces await That(invocations).IsEqualTo([0, 1, 2,]); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_OnSetTransitionTo_ShouldSwitchScenario() { IAccessorService sut = IAccessorService.CreateMock(); @@ -726,7 +727,7 @@ public async Task SetOnlyFiveKeyIndexer_OnSetTransitionTo_ShouldSwitchScenario() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task SetOnlyFiveKeyIndexer_SetExpectation_ShouldFormatTheValueLikeTheShippedSurface() { IAccessorService sut = IAccessorService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.CombinedMockTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.CombinedMockTests.cs index a43a2661a..88b592659 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.CombinedMockTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.CombinedMockTests.cs @@ -4,7 +4,7 @@ public sealed partial class SetupIndexerTests { public sealed class CombinedMockTests { - [Fact] + [Test] public async Task DistinctReturnTypes_SameParameterTypes_ShouldNotCollide() { IFooIndexer sut = IFooIndexer.CreateMock().Implementing().Implementing(); @@ -20,7 +20,7 @@ public async Task DistinctReturnTypes_SameParameterTypes_ShouldNotCollide() await That(bazView[1]).IsEqualTo(43); } - [Fact] + [Test] public async Task VirtualClassIndexer_AndExplicitInterfaceImplWithSameSignature_ShouldNotCollide() { BaseWithVirtualIndexer sut = BaseWithVirtualIndexer.CreateMock().Implementing(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InScenarioTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InScenarioTests.cs index 107b4ccc7..b6e09f59d 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InScenarioTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InScenarioTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupIndexerTests { public sealed class InScenarioTests { - [Fact] + [Test] public async Task OnGet_Arity1_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -21,7 +21,7 @@ public async Task OnGet_Arity1_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnGet_Arity2_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -36,7 +36,7 @@ public async Task OnGet_Arity2_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnGet_Arity3_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -51,7 +51,7 @@ public async Task OnGet_Arity3_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnGet_Arity4_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -66,7 +66,7 @@ public async Task OnGet_Arity4_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnSet_Arity1_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -81,7 +81,7 @@ public async Task OnSet_Arity1_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnSet_Arity2_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -96,7 +96,7 @@ public async Task OnSet_Arity2_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnSet_Arity3_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -111,7 +111,7 @@ public async Task OnSet_Arity3_ShouldTransitionEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task OnSet_Arity4_ShouldTransitionEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InitializeWithTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InitializeWithTests.cs index fe4023c5c..1237d15c3 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InitializeWithTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.InitializeWithTests.cs @@ -7,7 +7,7 @@ public sealed partial class SetupIndexerTests { public sealed class InitializeWithTests { - [Fact] + [Test] public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -23,7 +23,7 @@ public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Callback_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -39,7 +39,7 @@ await That(Act).Throws() .WithMessage("The indexer is already initialized. You cannot initialize it twice."); } - [Fact] + [Test] public async Task InitializeWith_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -55,7 +55,7 @@ public async Task InitializeWith_ShouldInitializeMatchingIndexers() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_ShouldSupportNull() { IIndexerService sut = IIndexerService.CreateMock(); @@ -71,7 +71,7 @@ public async Task InitializeWith_ShouldSupportNull() await That(result2).IsNull(); } - [Fact] + [Test] public async Task InitializeWith_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -89,7 +89,7 @@ await That(Act).Throws() public sealed class With2Levels { - [Fact] + [Test] public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -107,7 +107,7 @@ public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() await That(result41).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Callback_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -123,7 +123,7 @@ await That(Act).Throws() .WithMessage("The indexer is already initialized. You cannot initialize it twice."); } - [Fact] + [Test] public async Task InitializeWith_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -141,7 +141,7 @@ public async Task InitializeWith_ShouldInitializeMatchingIndexers() await That(result41).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -160,7 +160,7 @@ await That(Act).Throws() public sealed class With3Levels { - [Fact] + [Test] public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -181,7 +181,7 @@ public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() await That(result411).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Callback_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -198,7 +198,7 @@ await That(Act).Throws() .WithMessage("The indexer is already initialized. You cannot initialize it twice."); } - [Fact] + [Test] public async Task InitializeWith_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -219,7 +219,7 @@ public async Task InitializeWith_ShouldInitializeMatchingIndexers() await That(result411).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -239,7 +239,7 @@ await That(Act).Throws() public sealed class With4Levels { - [Fact] + [Test] public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -262,7 +262,7 @@ public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() await That(result4111).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Callback_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -279,7 +279,7 @@ await That(Act).Throws() .WithMessage("The indexer is already initialized. You cannot initialize it twice."); } - [Fact] + [Test] public async Task InitializeWith_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -302,7 +302,7 @@ public async Task InitializeWith_ShouldInitializeMatchingIndexers() await That(result4111).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -322,7 +322,7 @@ await That(Act).Throws() public sealed class With5Levels { - [Fact] + [Test] public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -347,7 +347,7 @@ public async Task InitializeWith_Callback_ShouldInitializeMatchingIndexers() await That(result61111).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Callback_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -365,7 +365,7 @@ await That(Act).Throws() .WithMessage("The indexer is already initialized. You cannot initialize it twice."); } - [Fact] + [Test] public async Task InitializeWith_ShouldInitializeMatchingIndexers() { IIndexerService sut = IIndexerService.CreateMock(); @@ -390,7 +390,7 @@ public async Task InitializeWith_ShouldInitializeMatchingIndexers() await That(result61111).IsEmpty(); } - [Fact] + [Test] public async Task InitializeWith_Twice_ShouldThrowMockException() { IIndexerService sut = IIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnGetTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnGetTests.cs index a9f621874..dd3801ba2 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnGetTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnGetTests.cs @@ -7,7 +7,7 @@ public sealed partial class SetupIndexerTests { public sealed class OnGetTests { - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -30,10 +30,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -50,7 +50,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -67,7 +67,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -85,7 +85,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -105,7 +105,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacks() { int callCount = 0; @@ -123,7 +123,7 @@ public async Task ShouldExecuteGetterCallbacks() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacksWithValue() { int callCount = 0; @@ -140,7 +140,7 @@ public async Task ShouldExecuteGetterCallbacksWithValue() await That(callCount).IsEqualTo(6); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -156,7 +156,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -176,7 +176,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -193,7 +193,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WhenLengthDoesNotMatch_ShouldIgnore() { int callCount = 0; @@ -208,7 +208,7 @@ public async Task WhenLengthDoesNotMatch_ShouldIgnore() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -235,7 +235,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -258,7 +258,7 @@ void ActOnly() public sealed class With2Levels { - [Fact] + [Test] public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() { int callCount = 0; @@ -273,7 +273,7 @@ public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -296,10 +296,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -316,7 +316,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -333,7 +333,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -351,7 +351,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -371,7 +371,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacks() { int callCount = 0; @@ -389,7 +389,7 @@ public async Task ShouldExecuteGetterCallbacks() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacksWithValue() { int callCount = 0; @@ -407,7 +407,7 @@ public async Task ShouldExecuteGetterCallbacksWithValue() await That(callCount).IsEqualTo(8); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -423,7 +423,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -443,7 +443,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -460,7 +460,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -488,7 +488,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -512,7 +512,7 @@ void ActOnly() public sealed class With3Levels { - [Fact] + [Test] public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() { int callCount = 0; @@ -528,7 +528,7 @@ public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -551,10 +551,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -571,7 +571,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -588,7 +588,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -606,7 +606,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -626,7 +626,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacks() { int callCount = 0; @@ -646,7 +646,7 @@ public async Task ShouldExecuteGetterCallbacks() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacksWithValue() { int callCount = 0; @@ -666,7 +666,7 @@ public async Task ShouldExecuteGetterCallbacksWithValue() await That(callCount).IsEqualTo(14); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -682,7 +682,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -702,7 +702,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -719,7 +719,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -746,7 +746,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -770,7 +770,7 @@ void ActOnly() public sealed class With4Levels { - [Fact] + [Test] public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() { int callCount = 0; @@ -786,7 +786,7 @@ public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -809,10 +809,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -829,7 +829,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -846,7 +846,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -864,7 +864,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -884,7 +884,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacks() { int callCount = 0; @@ -905,7 +905,7 @@ public async Task ShouldExecuteGetterCallbacks() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacksWithValue() { int callCount = 0; @@ -925,7 +925,7 @@ public async Task ShouldExecuteGetterCallbacksWithValue() await That(callCount).IsEqualTo(28); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -941,7 +941,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -961,7 +961,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -978,7 +978,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1005,7 +1005,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1029,7 +1029,7 @@ void ActOnly() public sealed class With5Levels { - [Fact] + [Test] public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() { int callCount = 0; @@ -1047,7 +1047,7 @@ public async Task Callback_WhenLengthDoesNotMatch_ShouldIgnore() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -1070,10 +1070,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -1090,7 +1090,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1107,7 +1107,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1125,7 +1125,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -1145,7 +1145,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacks() { int callCount = 0; @@ -1166,7 +1166,7 @@ public async Task ShouldExecuteGetterCallbacks() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldExecuteGetterCallbacksWithValue() { int callCount = 0; @@ -1187,7 +1187,7 @@ public async Task ShouldExecuteGetterCallbacksWithValue() await That(callCount).IsEqualTo(36); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -1203,7 +1203,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -1223,7 +1223,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -1240,7 +1240,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1267,7 +1267,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerGetterSetupCallbackWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnSetTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnSetTests.cs index 364f2123b..a1e127692 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnSetTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.OnSetTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupIndexerTests { public sealed class OnSetTests { - [Fact] + [Test] public async Task InParallel_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -29,10 +29,10 @@ public async Task InParallel_ShouldInvokeCallbacksInSequence() await That(callCount3).IsEqualTo(6 + 10); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -51,7 +51,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -68,7 +68,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -86,7 +86,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount = 0; @@ -106,7 +106,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(sum).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacks() { int callCount = 0; @@ -124,7 +124,7 @@ public async Task ShouldExecuteSetterCallbacks() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() { int callCount = 0; @@ -141,7 +141,7 @@ public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() await That(callCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -157,7 +157,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -177,7 +177,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6 + 10); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -196,7 +196,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() public sealed class With2Levels { - [Fact] + [Test] public async Task InParallel_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -219,10 +219,10 @@ public async Task InParallel_ShouldInvokeCallbacksInSequence() await That(callCount3).IsEqualTo(6 + 10); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -241,7 +241,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -258,7 +258,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -276,7 +276,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount = 0; @@ -296,7 +296,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(sum).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacks() { int callCount = 0; @@ -317,7 +317,7 @@ public async Task ShouldExecuteSetterCallbacks() await That(callCount).IsEqualTo(15); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() { int callCount = 0; @@ -335,7 +335,7 @@ public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() await That(callCount).IsEqualTo(4); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -351,7 +351,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -371,7 +371,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6 + 10); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -391,7 +391,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() public sealed class With3Levels { - [Fact] + [Test] public async Task InParallel_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -414,10 +414,10 @@ public async Task InParallel_ShouldInvokeCallbacksInSequence() await That(callCount3).IsEqualTo(6 + 10); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -436,7 +436,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -453,7 +453,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -471,7 +471,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount = 0; @@ -491,7 +491,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(sum).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacks() { int callCount = 0; @@ -513,7 +513,7 @@ public async Task ShouldExecuteSetterCallbacks() await That(callCount).IsEqualTo(15); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() { int callCount = 0; @@ -533,7 +533,7 @@ public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() await That(callCount).IsEqualTo(4); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -549,7 +549,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -569,7 +569,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6 + 10); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -589,7 +589,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() public sealed class With4Levels { - [Fact] + [Test] public async Task InParallel_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -612,10 +612,10 @@ public async Task InParallel_ShouldInvokeCallbacksInSequence() await That(callCount3).IsEqualTo(6 + 10); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -634,7 +634,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -651,7 +651,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -669,7 +669,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount = 0; @@ -689,7 +689,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(sum).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacks() { int callCount = 0; @@ -711,7 +711,7 @@ public async Task ShouldExecuteSetterCallbacks() await That(callCount).IsEqualTo(19); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() { int callCount = 0; @@ -731,7 +731,7 @@ public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() await That(callCount).IsEqualTo(5); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -747,7 +747,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -767,7 +767,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6 + 10); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -787,7 +787,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() public sealed class With5Levels { - [Fact] + [Test] public async Task InParallel_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -810,10 +810,10 @@ public async Task InParallel_ShouldInvokeCallbacksInSequence() await That(callCount3).IsEqualTo(6 + 10); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -832,7 +832,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -849,7 +849,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -867,7 +867,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount = 0; @@ -887,7 +887,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(sum).IsEqualTo(2); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacks() { int callCount = 0; @@ -909,7 +909,7 @@ public async Task ShouldExecuteSetterCallbacks() await That(callCount).IsEqualTo(24); } - [Fact] + [Test] public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() { int callCount = 0; @@ -929,7 +929,7 @@ public async Task ShouldExecuteSetterCallbacksWithoutAnyValue() await That(callCount).IsEqualTo(5); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -945,7 +945,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -965,7 +965,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6 + 10); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.ReturnsThrowsTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.ReturnsThrowsTests.cs index 2cd88a418..8d337f029 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.ReturnsThrowsTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.ReturnsThrowsTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Mockolate.Setup; +using Mockolate.Tests.TestHelpers; namespace Mockolate.Tests.MockIndexers; @@ -9,7 +10,7 @@ public sealed class ReturnsThrowsTests { public sealed class With1Level { - [Fact] + [Test] public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -32,7 +33,7 @@ public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValue await That(result15).IsEqualTo("a"); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IIndexerService sut = IIndexerService.CreateMock(); @@ -43,7 +44,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut[1]; - Exception? result2 = Record.Exception(() => _ = sut[2]); + Exception? result2 = Catch.Exception(() => _ = sut[2]); string result3 = sut[3]; await That(result1).IsEqualTo("a"); @@ -51,7 +52,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -70,7 +71,7 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo(["a", "b", "foo-2", "a", "b", "foo-5", "a", "b", "foo-8", "a",]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -83,7 +84,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -97,7 +98,7 @@ public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-3"); } - [Fact] + [Test] public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -111,7 +112,7 @@ public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedVal await That(result).IsEqualTo("foo-init-3"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -129,7 +130,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IIndexerService sut = IIndexerService.CreateMock(); @@ -148,7 +149,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -166,7 +167,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -179,7 +180,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -196,7 +197,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -217,7 +218,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IIndexerService sut = IIndexerService.CreateMock(); @@ -227,7 +228,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -239,7 +240,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -251,7 +252,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -267,7 +268,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithParameters_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -284,7 +285,7 @@ void Act() await That(Act).Throws().WithMessage("foo-3"); } - [Fact] + [Test] public async Task Throws_CallbackWithParametersAndValue_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -301,7 +302,7 @@ void Act() await That(Act).Throws().WithMessage("foo-init-3"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -317,7 +318,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -333,7 +334,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -354,7 +355,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -378,7 +379,7 @@ void ActOnly() public sealed class With2Levels { - [Fact] + [Test] public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -401,7 +402,7 @@ public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValue await That(result15).IsEqualTo("a"); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IIndexerService sut = IIndexerService.CreateMock(); @@ -412,7 +413,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut[1, 1]; - Exception? result2 = Record.Exception(() => _ = sut[2, 2]); + Exception? result2 = Catch.Exception(() => _ = sut[2, 2]); string result3 = sut[3, 3]; await That(result1).IsEqualTo("a"); @@ -420,7 +421,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -439,7 +440,7 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo(["a", "b", "foo-2-4", "a", "b", "foo-5-25", "a", "b", "foo-8-64", "a",]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -452,7 +453,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -466,7 +467,7 @@ public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-3-4"); } - [Fact] + [Test] public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -480,7 +481,7 @@ public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedVal await That(result).IsEqualTo("foo-init-3-4"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -498,7 +499,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IIndexerService sut = IIndexerService.CreateMock(); @@ -517,7 +518,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -535,7 +536,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -548,7 +549,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -565,7 +566,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -586,7 +587,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IIndexerService sut = IIndexerService.CreateMock(); @@ -596,7 +597,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -608,7 +609,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -620,7 +621,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -636,7 +637,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithParameters_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -653,7 +654,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2"); } - [Fact] + [Test] public async Task Throws_CallbackWithParametersAndValue_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -670,7 +671,7 @@ void Act() await That(Act).Throws().WithMessage("foo-init-1-2"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -686,7 +687,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -702,7 +703,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -723,7 +724,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -747,7 +748,7 @@ void ActOnly() public sealed class With3Levels { - [Fact] + [Test] public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -770,7 +771,7 @@ public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValue await That(result15).IsEqualTo("a"); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IIndexerService sut = IIndexerService.CreateMock(); @@ -781,7 +782,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut[1, 1, 1]; - Exception? result2 = Record.Exception(() => _ = sut[2, 2, 2]); + Exception? result2 = Catch.Exception(() => _ = sut[2, 2, 2]); string result3 = sut[3, 3, 3]; await That(result1).IsEqualTo("a"); @@ -789,7 +790,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -809,7 +810,7 @@ await That(result) .IsEqualTo(["a", "b", "foo-2-4-6", "a", "b", "foo-5-25-30", "a", "b", "foo-8-64-72", "a",]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -822,7 +823,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -836,7 +837,7 @@ public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-3-4-5"); } - [Fact] + [Test] public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -850,7 +851,7 @@ public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedVal await That(result).IsEqualTo("foo-init-3-4-5"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -868,7 +869,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IIndexerService sut = IIndexerService.CreateMock(); @@ -887,7 +888,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -905,7 +906,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -918,7 +919,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -935,7 +936,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -956,7 +957,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IIndexerService sut = IIndexerService.CreateMock(); @@ -966,7 +967,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task Returns_WithPredicate_ShouldApplyReturnWhenPredicateMatches() { List results = []; @@ -987,7 +988,7 @@ public async Task Returns_WithPredicate_ShouldApplyReturnWhenPredicateMatches() await That(results).IsEqualTo(["", "", "bar", "bar", "foo", "foo", "foo",]); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -999,7 +1000,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2-3"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -1011,7 +1012,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1027,7 +1028,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithParameters_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1044,7 +1045,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3"); } - [Fact] + [Test] public async Task Throws_CallbackWithParametersAndValue_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1061,7 +1062,7 @@ void Act() await That(Act).Throws().WithMessage("foo-init-1-2-3"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1077,7 +1078,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1093,7 +1094,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1114,7 +1115,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1138,7 +1139,7 @@ void ActOnly() public sealed class With4Levels { - [Fact] + [Test] public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1161,7 +1162,7 @@ public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValue await That(result15).IsEqualTo("a"); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1172,7 +1173,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut[1, 1, 1, 1]; - Exception? result2 = Record.Exception(() => _ = sut[2, 2, 2, 2]); + Exception? result2 = Catch.Exception(() => _ = sut[2, 2, 2, 2]); string result3 = sut[3, 3, 3, 3]; await That(result1).IsEqualTo("a"); @@ -1180,7 +1181,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1201,7 +1202,7 @@ await That(result).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1214,7 +1215,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1228,7 +1229,7 @@ public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-3-4-5-6"); } - [Fact] + [Test] public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1242,7 +1243,7 @@ public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedVal await That(result).IsEqualTo("foo-init-3-4-5-6"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1260,7 +1261,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1279,7 +1280,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1297,7 +1298,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1310,7 +1311,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1327,7 +1328,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1348,7 +1349,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1358,7 +1359,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -1370,7 +1371,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2-3-4"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -1382,7 +1383,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1398,7 +1399,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithParameters_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1415,7 +1416,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3-4"); } - [Fact] + [Test] public async Task Throws_CallbackWithParametersAndValue_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1432,7 +1433,7 @@ void Act() await That(Act).Throws().WithMessage("foo-init-1-2-3-4"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1448,7 +1449,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1464,7 +1465,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1485,7 +1486,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1509,7 +1510,7 @@ void ActOnly() public sealed class With5Levels { - [Fact] + [Test] public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1532,7 +1533,7 @@ public async Task IndexerReturns_WithSpecificParameter_ShouldIterateThroughValue await That(result15).IsEqualTo("a"); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1544,7 +1545,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut[1, 1, 1, 1, 1]; - Exception? result2 = Record.Exception(() => _ = sut[2, 2, 2, 2, 2]); + Exception? result2 = Catch.Exception(() => _ = sut[2, 2, 2, 2, 2]); string result3 = sut[3, 3, 3, 3, 3]; await That(result1).IsEqualTo("a"); @@ -1552,7 +1553,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1573,7 +1574,7 @@ await That(result).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1586,7 +1587,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1600,7 +1601,7 @@ public async Task Returns_CallbackWithParameters_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-3-4-5-6-7"); } - [Fact] + [Test] public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1614,7 +1615,7 @@ public async Task Returns_CallbackWithParametersAndValue_ShouldReturnExpectedVal await That(result).IsEqualTo("foo-init-3-4-5-6-7"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1632,7 +1633,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1651,7 +1652,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1669,7 +1670,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1682,7 +1683,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1699,7 +1700,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1720,7 +1721,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1730,7 +1731,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -1742,7 +1743,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { IndexerMethodSetupTest sut = IndexerMethodSetupTest.CreateMock(); @@ -1754,7 +1755,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1770,7 +1771,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithParameters_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1787,7 +1788,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task Throws_CallbackWithParametersAndValue_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1804,7 +1805,7 @@ void Act() await That(Act).Throws().WithMessage("foo-init-1-2-3-4-5"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1820,7 +1821,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1836,7 +1837,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -1857,7 +1858,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IIndexerSetupReturnWhenBuilder_ShouldNotThrow() { IIndexerService sut = IIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SkippingBaseClassTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SkippingBaseClassTests.cs index 39436acf8..433ad544b 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SkippingBaseClassTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SkippingBaseClassTests.cs @@ -4,9 +4,9 @@ public sealed partial class SetupIndexerTests { public sealed class SkippingBaseClassTests { - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith1Key_Getter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -18,9 +18,9 @@ public async Task IndexerWith1Key_Getter_ShouldSkipCallingBaseWhenRequested(bool await That(sut.MyIndexerWith1KeyGetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith1Key_Setter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -32,9 +32,9 @@ public async Task IndexerWith1Key_Setter_ShouldSkipCallingBaseWhenRequested(bool await That(sut.MyIndexerWith1KeySetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith2Keys_Getter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -46,9 +46,9 @@ public async Task IndexerWith2Keys_Getter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith2KeysGetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith2Keys_Setter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -60,9 +60,9 @@ public async Task IndexerWith2Keys_Setter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith2KeysSetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith3Keys_Getter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -74,9 +74,9 @@ public async Task IndexerWith3Keys_Getter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith3KeysGetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith3Keys_Setter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -88,9 +88,9 @@ public async Task IndexerWith3Keys_Setter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith3KeysSetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith4Keys_Getter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -102,9 +102,9 @@ public async Task IndexerWith4Keys_Getter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith4KeysGetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith4Keys_Setter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -116,9 +116,9 @@ public async Task IndexerWith4Keys_Setter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith4KeysSetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith5Keys_Getter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -131,9 +131,9 @@ public async Task IndexerWith5Keys_Getter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith5KeysGetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task IndexerWith5Keys_Setter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -146,7 +146,7 @@ public async Task IndexerWith5Keys_Setter_ShouldSkipCallingBaseWhenRequested(boo await That(sut.MyIndexerWith5KeysSetterCallCount).IsEqualTo(expectedCallCount); } - [Fact] + [Test] public async Task SetupSkippingBaseClassWithoutParameter_ShouldReturnDefaultValue() { MyIndexerService sut = MyIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SpanTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SpanTests.cs index e935efd67..710969c4f 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SpanTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.SpanTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupIndexerTests { public sealed class SpanTests { - [Fact] + [Test] public async Task Memory_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() { SpanMock sut = SpanMock.CreateMock(); @@ -17,7 +17,7 @@ public async Task Memory_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task Memory_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -28,7 +28,7 @@ public async Task Memory_WhenPredicateMatches_ShouldApplySetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Memory_WithoutPredicate_ShouldMatchAnySpan() { SpanMock sut = SpanMock.CreateMock(); @@ -39,7 +39,7 @@ public async Task Memory_WithoutPredicate_ShouldMatchAnySpan() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReadOnlySpan_IndexerReturnValueSetup_ShouldReturnExpectedSpan() { SpanMock sut = SpanMock.CreateMock(); @@ -54,7 +54,7 @@ public async Task ReadOnlySpan_IndexerReturnValueSetup_ShouldReturnExpectedSpan( await That(result).IsEqualTo(expectedData); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() { SpanMock sut = SpanMock.CreateMock(); @@ -65,7 +65,7 @@ public async Task ReadOnlySpan_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -76,7 +76,7 @@ public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReadOnlySpan_WithoutPredicate_ShouldMatchAnySpan() { SpanMock sut = SpanMock.CreateMock(); @@ -87,7 +87,7 @@ public async Task ReadOnlySpan_WithoutPredicate_ShouldMatchAnySpan() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Span_IndexerReturnValueSetup_ShouldReturnExpectedSpan() { SpanMock sut = SpanMock.CreateMock(); @@ -102,7 +102,7 @@ public async Task Span_IndexerReturnValueSetup_ShouldReturnExpectedSpan() await That(result).IsEqualTo(expectedData); } - [Fact] + [Test] public async Task Span_IndexerWithSpecificKey_ShouldMatchAndReturn() { SpanMock sut = SpanMock.CreateMock(); @@ -125,7 +125,7 @@ public async Task Span_IndexerWithSpecificKey_ShouldMatchAndReturn() await That(result2).IsEqualTo(key2Data); } - [Fact] + [Test] public async Task Span_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() { SpanMock sut = SpanMock.CreateMock(); @@ -136,7 +136,7 @@ public async Task Span_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task Span_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -147,7 +147,7 @@ public async Task Span_WhenPredicateMatches_ShouldApplySetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Span_WithoutPredicate_ShouldMatchAnySpan() { SpanMock sut = SpanMock.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.cs b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.cs index 9844db175..6b51a3234 100644 --- a/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/SetupIndexerTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests.MockIndexers; public sealed partial class SetupIndexerTests { - [Fact] + [Test] public async Task MultipleValues_ShouldAllStoreValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -29,7 +29,7 @@ public async Task MultipleValues_ShouldAllStoreValues() await That(result2B).IsEqualTo("y"); } - [Fact] + [Test] public async Task OverlappingSetups_ShouldUseLatestMatchingSetup() { IIndexerService sut = IIndexerService.CreateMock(); @@ -45,7 +45,7 @@ public async Task OverlappingSetups_ShouldUseLatestMatchingSetup() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task OverlappingSetups_WhenGeneralSetupIsLater_ShouldOnlyUseGeneralSetup() { IIndexerService sut = IIndexerService.CreateMock(); @@ -61,7 +61,7 @@ public async Task OverlappingSetups_WhenGeneralSetupIsLater_ShouldOnlyUseGeneral await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Parameter_Do_ShouldExecuteCallback() { List capturedValues = []; @@ -75,7 +75,7 @@ public async Task Parameter_Do_ShouldExecuteCallback() await That(capturedValues).IsEqualTo(["foo", "bar",]); } - [Fact] + [Test] public async Task Parameter_Do_ShouldOnlyExecuteCallbackWhenAllParametersMatch() { List capturedValues = []; @@ -89,7 +89,7 @@ public async Task Parameter_Do_ShouldOnlyExecuteCallbackWhenAllParametersMatch() await That(capturedValues).IsEqualTo(["foo",]); } - [Fact] + [Test] public async Task SetOnDifferentLevel_ShouldNotBeUsed() { IIndexerService sut = IIndexerService.CreateMock(); @@ -102,7 +102,7 @@ public async Task SetOnDifferentLevel_ShouldNotBeUsed() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task ShouldSupportNullAsParameter() { IIndexerService sut = IIndexerService.CreateMock(); @@ -115,7 +115,7 @@ public async Task ShouldSupportNullAsParameter() await That(result2).IsNull(); } - [Fact] + [Test] public async Task ShouldUseInitializedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -128,7 +128,7 @@ public async Task ShouldUseInitializedValue() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task StoredNullValue_ShouldNotFallBackToDefault() { IIndexerService sut = IIndexerService.CreateMock(); @@ -141,7 +141,7 @@ public async Task StoredNullValue_ShouldNotFallBackToDefault() await That(resultAfter).IsNull(); } - [Fact] + [Test] public async Task ThreeLevels_ShouldUseInitializedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -154,7 +154,7 @@ public async Task ThreeLevels_ShouldUseInitializedValue() await That(result2).IsNull(); } - [Fact] + [Test] public async Task ThreeLevels_WithoutSetup_ShouldStoreLastValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -173,7 +173,7 @@ public async Task ThreeLevels_WithoutSetup_ShouldStoreLastValue() await That(result4).IsNull(); } - [Fact] + [Test] public async Task TwoLevels_ShouldUseInitializedValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -186,7 +186,7 @@ public async Task TwoLevels_ShouldUseInitializedValue() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task TwoLevels_WithoutSetup_ShouldStoreLastValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -201,7 +201,7 @@ public async Task TwoLevels_WithoutSetup_ShouldStoreLastValue() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WhenTypeOfGetIndexerDoesNotMatch_ShouldReturnDefaultValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -221,7 +221,7 @@ public async Task WhenTypeOfGetIndexerDoesNotMatch_ShouldReturnDefaultValue() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task WithoutSetup_ShouldStoreLastValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -236,7 +236,7 @@ public async Task WithoutSetup_ShouldStoreLastValue() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithoutSetup_ThrowWhenNotSetup_ShouldThrowMockNotSetupException() { IIndexerService mock = IIndexerService.CreateMock(MockBehavior.Default with @@ -254,7 +254,7 @@ await That(Act).Throws() } #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task WithReadOnlySpanIndexerParameters_ShouldCompile() { ReadOnlySpan readOnlySpan123 = ((int[])[1, 2, 3,]).AsSpan(); @@ -274,7 +274,7 @@ public async Task WithReadOnlySpanIndexerParameters_ShouldCompile() #endif #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task WithSpanIndexerParameters_ShouldCompile() { Span fooSpan = "foo".ToCharArray().AsSpan(); @@ -301,7 +301,7 @@ public interface IMyServiceWithSpanIndexerParameters public class IndexerWith1Parameter { - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValue() { IIndexerService sut = IIndexerService.CreateMock(); @@ -314,7 +314,7 @@ public async Task ToString_ShouldIncludeParameterValue() await That(setup.ToString()).IsEqualTo("string this[1]"); } - [Fact] + [Test] public async Task WithExplicitParameter_ShouldWork() { IIndexerService sut = IIndexerService.CreateMock(); @@ -330,7 +330,7 @@ public async Task WithExplicitParameter_ShouldWork() public class IndexerWith2Parameters { - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -343,7 +343,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("string this[1, 2]"); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IIndexerService sut = IIndexerService.CreateMock(); @@ -356,7 +356,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IIndexerService sut = IIndexerService.CreateMock(); @@ -369,7 +369,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IIndexerService sut = IIndexerService.CreateMock(); @@ -387,7 +387,7 @@ public async Task WithExplicitParameters_ShouldWork() public class IndexerWith3Parameters { - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -403,7 +403,7 @@ public async Task ToString_ShouldIncludeParameterValues() public class IndexerWith4Parameters { - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -419,7 +419,7 @@ public async Task ToString_ShouldIncludeParameterValues() public class IndexerWith5Parameters { - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IIndexerService sut = IIndexerService.CreateMock(); @@ -436,7 +436,7 @@ public async Task ToString_ShouldIncludeParameterValues() public class NegativeArgumentValidation { - [Fact] + [Test] public async Task ApplyIndexerGetter_WithBaseValue_WithNegativeSignatureIndex_ShouldThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -452,7 +452,7 @@ await That(Act).Throws() .WithParamName("signatureIndex"); } - [Fact] + [Test] public async Task ApplyIndexerGetter_WithGenerator_WithNegativeSignatureIndex_ShouldThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -468,7 +468,7 @@ await That(Act).Throws() .WithParamName("signatureIndex"); } - [Fact] + [Test] public async Task ApplyIndexerSetter_WithNegativeSignatureIndex_ShouldThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -484,7 +484,7 @@ await That(Act).Throws() .WithParamName("signatureIndex"); } - [Fact] + [Test] public async Task ApplyIndexerSetup_WithNegativeSignatureIndex_ShouldThrow() { IIndexerService sut = IIndexerService.CreateMock(); @@ -502,7 +502,7 @@ await That(Act).Throws() .WithParamName("signatureIndex"); } - [Fact] + [Test] public async Task GetIndexerFallback_WithNegativeSignatureIndex_ShouldThrow() { IIndexerService sut = IIndexerService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.SpanTests.cs b/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.SpanTests.cs index bfd2a93e6..581664d8c 100644 --- a/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.SpanTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.SpanTests.cs @@ -6,7 +6,7 @@ public sealed partial class VerifyGotIndexerTests { public sealed class SpanTests { - [Fact] + [Test] public async Task Memory_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -18,7 +18,7 @@ public async Task Memory_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify[It.Satisfies>(v => v.Length == 4)].Got()).Never(); } - [Fact] + [Test] public async Task Memory_WithoutPredicate_ShouldApplyAllCalls() { SpanMock sut = SpanMock.CreateMock(); @@ -30,7 +30,7 @@ public async Task Memory_WithoutPredicate_ShouldApplyAllCalls() await That(sut.Mock.Verify[It.IsAny>()].Got()).Twice(); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -42,7 +42,7 @@ public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify[It.IsReadOnlySpan(v => v.Length == 4)].Got()).Never(); } - [Fact] + [Test] public async Task ReadOnlySpan_WithoutPredicate_ShouldApplyAllCalls() { SpanMock sut = SpanMock.CreateMock(); @@ -54,7 +54,7 @@ public async Task ReadOnlySpan_WithoutPredicate_ShouldApplyAllCalls() await That(sut.Mock.Verify[It.IsAnyReadOnlySpan()].Got()).Twice(); } - [Fact] + [Test] public async Task Span_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -66,7 +66,7 @@ public async Task Span_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify[It.IsSpan(v => v.Length == 4)].Got()).Never(); } - [Fact] + [Test] public async Task Span_WithoutPredicate_ShouldApplyAllCalls() { SpanMock sut = SpanMock.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.cs b/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.cs index e966f3da4..9118e4eb0 100644 --- a/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/VerifyGotIndexerTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockIndexers; public sealed partial class VerifyGotIndexerTests { - [Fact] + [Test] public async Task WhenNull_AndMatches_ShouldReturn() { IMyService sut = IMyService.CreateMock(); @@ -13,7 +13,7 @@ public async Task WhenNull_AndMatches_ShouldReturn() await That(sut.Mock.Verify[It.IsAny(), null, It.IsNull(), It.IsAny()].Got()).Once(); } - [Fact] + [Test] public async Task WhenParameterLengthDoesNotMatch_ShouldReturnNever() { IMyService sut = IMyService.CreateMock(); @@ -24,7 +24,7 @@ public async Task WhenParameterLengthDoesNotMatch_ShouldReturnNever() await That(sut.Mock.Verify[It.IsAny(), It.IsAny(), It.IsAny()].Got()).Never(); } - [Fact] + [Test] public async Task WhenParametersDontMatch_ShouldReturnNever() { IMyService sut = IMyService.CreateMock(); @@ -37,7 +37,7 @@ public async Task WhenParametersDontMatch_ShouldReturnNever() public class IndexerWith1Parameter { - [Fact] + [Test] public async Task WithExplicitParameter_ShouldWork() { IMyService sut = IMyService.CreateMock(); @@ -50,7 +50,7 @@ public async Task WithExplicitParameter_ShouldWork() public class IndexerWith2Parameters { - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IMyService sut = IMyService.CreateMock(); @@ -60,7 +60,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(sut.Mock.Verify[2, It.IsAny()].Got()).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IMyService sut = IMyService.CreateMock(); @@ -70,7 +70,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(sut.Mock.Verify[It.IsAny(), 2].Got()).Never(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IMyService sut = IMyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.SpanTests.cs b/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.SpanTests.cs index 99b77c542..b59cde04b 100644 --- a/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.SpanTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.SpanTests.cs @@ -6,7 +6,7 @@ public sealed partial class VerifySetIndexerTests { public sealed class SpanTests { - [Fact] + [Test] public async Task Memory_WhenPredicateMatches_ShouldApplySetup() { ISpanMock sut = ISpanMock.CreateMock(); @@ -18,7 +18,7 @@ public async Task Memory_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify[It.Satisfies>(v => v.Length == 4)].Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task Memory_WithoutPredicate_ShouldApplyAllCalls() { ISpanMock sut = ISpanMock.CreateMock(); @@ -30,7 +30,7 @@ public async Task Memory_WithoutPredicate_ShouldApplyAllCalls() await That(sut.Mock.Verify[It.IsAny>()].Set(It.IsAny())).Twice(); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() { ISpanMock sut = ISpanMock.CreateMock(); @@ -42,7 +42,7 @@ public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify[It.IsReadOnlySpan(v => v.Length == 4)].Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task ReadOnlySpan_WithoutPredicate_ShouldApplyAllCalls() { ISpanMock sut = ISpanMock.CreateMock(); @@ -54,7 +54,7 @@ public async Task ReadOnlySpan_WithoutPredicate_ShouldApplyAllCalls() await That(sut.Mock.Verify[It.IsAnyReadOnlySpan()].Set(It.IsAny())).Twice(); } - [Fact] + [Test] public async Task Span_WhenPredicateMatches_ShouldApplySetup() { ISpanMock sut = ISpanMock.CreateMock(); @@ -66,7 +66,7 @@ public async Task Span_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify[It.IsSpan(v => v.Length == 4)].Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task Span_WithoutPredicate_ShouldApplyAllCalls() { ISpanMock sut = ISpanMock.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.cs b/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.cs index c8592f33b..02ad0e81b 100644 --- a/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.cs +++ b/Tests/Mockolate.Tests/MockIndexers/VerifySetIndexerTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockIndexers; public sealed partial class VerifySetIndexerTests { - [Fact] + [Test] public async Task Set_WithExplicitParameter_ShouldCheckForEquality() { IMyService sut = IMyService.CreateMock(); @@ -16,7 +16,7 @@ public async Task Set_WithExplicitParameter_ShouldCheckForEquality() await That(sut.Mock.Verify[1].Set("FOO")).Never(); } - [Fact] + [Test] public async Task WhenNullParametersAndValue_AndMatches_ShouldReturn() { IMyService sut = IMyService.CreateMock(); @@ -25,7 +25,7 @@ public async Task WhenNullParametersAndValue_AndMatches_ShouldReturn() await That(sut.Mock.Verify[It.IsAny(), null, It.IsNull(), It.IsAny()].Set(null)).Once(); } - [Fact] + [Test] public async Task WhenParameterLengthDoesNotMatch_ShouldReturnNever() { IMyService sut = IMyService.CreateMock(); @@ -36,7 +36,7 @@ public async Task WhenParameterLengthDoesNotMatch_ShouldReturnNever() await That(sut.Mock.Verify[It.IsAny(), It.IsAny(), It.IsAny()].Set(It.Is("foo"))).Never(); } - [Fact] + [Test] public async Task WhenParametersDoNotMatch_ShouldReturnNever() { IMyService sut = IMyService.CreateMock(); @@ -49,7 +49,7 @@ public async Task WhenParametersDoNotMatch_ShouldReturnNever() public class IndexerWith1Parameter { - [Fact] + [Test] public async Task WithExplicitParameter_ShouldWork() { IMyService sut = IMyService.CreateMock(); @@ -63,7 +63,7 @@ public async Task WithExplicitParameter_ShouldWork() public class IndexerWith2Parameters { - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IMyService sut = IMyService.CreateMock(); @@ -73,7 +73,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(sut.Mock.Verify[2, It.IsAny()].Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IMyService sut = IMyService.CreateMock(); @@ -83,7 +83,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(sut.Mock.Verify[It.IsAny(), 2].Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IMyService sut = IMyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/InteractionsTests.CancellationTokenTests.cs b/Tests/Mockolate.Tests/MockMethods/InteractionsTests.CancellationTokenTests.cs index c619ec203..e8f7da858 100644 --- a/Tests/Mockolate.Tests/MockMethods/InteractionsTests.CancellationTokenTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/InteractionsTests.CancellationTokenTests.cs @@ -6,7 +6,7 @@ public sealed partial class InteractionsTests { public sealed class CancellationTokenTests { - [Fact] + [Test] public async Task WithMultipleParameters_WhenOneIsCanceled_ShouldReturnCanceledTask() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -17,7 +17,7 @@ public async Task WithMultipleParameters_WhenOneIsCanceled_ShouldReturnCanceledT await That(result.IsCanceled).IsTrue(); } - [Fact] + [Test] public async Task WithNonCanceledToken_ShouldReturnDefaultValue() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -29,7 +29,7 @@ public async Task WithNonCanceledToken_ShouldReturnDefaultValue() await That(result.IsCanceled).IsFalse(); } - [Fact] + [Test] public async Task WithSetup_ShouldUseSetupValue() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -43,7 +43,7 @@ public async Task WithSetup_ShouldUseSetupValue() await That(await result).IsEqualTo(42); } - [Fact] + [Test] public async Task WithTask_ShouldReturnCanceledTask() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -54,7 +54,7 @@ public async Task WithTask_ShouldReturnCanceledTask() await That(result.IsCanceled).IsTrue(); } - [Fact] + [Test] public async Task WithTaskOfInt_ShouldReturnCanceledTask() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -65,7 +65,7 @@ public async Task WithTaskOfInt_ShouldReturnCanceledTask() await That(result.IsCanceled).IsTrue(); } - [Fact] + [Test] public async Task WithTaskOfString_ShouldReturnCanceledTask() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -76,7 +76,7 @@ public async Task WithTaskOfString_ShouldReturnCanceledTask() await That(result.IsCanceled).IsTrue(); } - [Fact] + [Test] public async Task WithTupleContainingTask_ShouldCancelTaskElement() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -89,7 +89,7 @@ public async Task WithTupleContainingTask_ShouldCancelTaskElement() } #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task WithValueTask_ShouldReturnCanceledTask() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); @@ -102,7 +102,7 @@ public async Task WithValueTask_ShouldReturnCanceledTask() #endif #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task WithValueTaskOfInt_ShouldReturnCanceledTask() { IMockWithCancellationToken sut = IMockWithCancellationToken.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/InteractionsTests.ThrowingBaseTests.cs b/Tests/Mockolate.Tests/MockMethods/InteractionsTests.ThrowingBaseTests.cs index 82e829b9c..fa7cdc3f1 100644 --- a/Tests/Mockolate.Tests/MockMethods/InteractionsTests.ThrowingBaseTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/InteractionsTests.ThrowingBaseTests.cs @@ -6,7 +6,7 @@ public sealed partial class InteractionsTests { public sealed class ThrowingBaseTests { - [Fact] + [Test] public async Task ReturnMethod_WhenBaseThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -20,7 +20,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith0Parameters()).Once(); } - [Fact] + [Test] public async Task ReturnMethodWith0Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -34,7 +34,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith0Parameters()).Once(); } - [Fact] + [Test] public async Task ReturnMethodWith1Parameter_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -50,7 +50,7 @@ void Act() await That(v1.Values).HasSingle().Which.IsEqualTo(1); } - [Fact] + [Test] public async Task ReturnMethodWith1Parameter_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -64,7 +64,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith1Parameter(1)).Once(); } - [Fact] + [Test] public async Task ReturnMethodWith2Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -83,7 +83,7 @@ void Act() await That(v2.Values).HasSingle().Which.IsEqualTo(2); } - [Fact] + [Test] public async Task ReturnMethodWith2Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -97,7 +97,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith2Parameters(1, 2)).Once(); } - [Fact] + [Test] public async Task ReturnMethodWith3Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -118,7 +118,7 @@ void Act() await That(v3.Values).HasSingle().Which.IsEqualTo(3); } - [Fact] + [Test] public async Task ReturnMethodWith3Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -132,7 +132,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith3Parameters(1, 2, 3)).Once(); } - [Fact] + [Test] public async Task ReturnMethodWith4Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -155,7 +155,7 @@ void Act() await That(v4.Values).HasSingle().Which.IsEqualTo(4); } - [Fact] + [Test] public async Task ReturnMethodWith4Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -169,7 +169,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith4Parameters(1, 2, 3, 4)).Once(); } - [Fact] + [Test] public async Task ReturnMethodWith5Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -194,7 +194,7 @@ void Act() await That(v5.Values).HasSingle().Which.IsEqualTo(5); } - [Fact] + [Test] public async Task ReturnMethodWith5Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -208,7 +208,7 @@ void Act() await That(sut.Mock.Verify.ReturnMethodWith5Parameters(1, 2, 3, 4, 5)).Once(); } - [Fact] + [Test] public async Task VoidMethod_WhenBaseThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -222,7 +222,7 @@ void Act() await That(sut.Mock.Verify.VoidMethodWith0Parameters()).Once(); } - [Fact] + [Test] public async Task VoidMethodWith0Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -236,7 +236,7 @@ void Act() await That(sut.Mock.Verify.VoidMethodWith0Parameters()).Once(); } - [Fact] + [Test] public async Task VoidMethodWith1Parameter_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -252,7 +252,7 @@ void Act() await That(v1.Values).HasSingle().Which.IsEqualTo(1); } - [Fact] + [Test] public async Task VoidMethodWith1Parameter_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -266,7 +266,7 @@ void Act() await That(sut.Mock.Verify.VoidMethodWith1Parameter(1)).Once(); } - [Fact] + [Test] public async Task VoidMethodWith2Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -285,7 +285,7 @@ void Act() await That(v2.Values).HasSingle().Which.IsEqualTo(2); } - [Fact] + [Test] public async Task VoidMethodWith2Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -299,7 +299,7 @@ void Act() await That(sut.Mock.Verify.VoidMethodWith2Parameters(1, 2)).Once(); } - [Fact] + [Test] public async Task VoidMethodWith3Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -320,7 +320,7 @@ void Act() await That(v3.Values).HasSingle().Which.IsEqualTo(3); } - [Fact] + [Test] public async Task VoidMethodWith3Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -334,7 +334,7 @@ void Act() await That(sut.Mock.Verify.VoidMethodWith3Parameters(1, 2, 3)).Once(); } - [Fact] + [Test] public async Task VoidMethodWith4Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -357,7 +357,7 @@ void Act() await That(v4.Values).HasSingle().Which.IsEqualTo(4); } - [Fact] + [Test] public async Task VoidMethodWith4Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -371,7 +371,7 @@ void Act() await That(sut.Mock.Verify.VoidMethodWith4Parameters(1, 2, 3, 4)).Once(); } - [Fact] + [Test] public async Task VoidMethodWith5Parameters_WhenBaseThrows_ShouldRecordArgumentsPassedByCaller() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -396,7 +396,7 @@ void Act() await That(v5.Values).HasSingle().Which.IsEqualTo(5); } - [Fact] + [Test] public async Task VoidMethodWith5Parameters_WhenBaseThrows_ShouldStillRecordInvocation() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/InteractionsTests.cs b/Tests/Mockolate.Tests/MockMethods/InteractionsTests.cs index d3b1ec43b..2d64b99d4 100644 --- a/Tests/Mockolate.Tests/MockMethods/InteractionsTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/InteractionsTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockMethods; public sealed partial class InteractionsTests { - [Fact] + [Test] public async Task MethodInvocation_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -15,7 +15,7 @@ public async Task MethodInvocation_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation1_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -28,7 +28,7 @@ public async Task MethodInvocation1_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation1_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -41,7 +41,7 @@ public async Task MethodInvocation1_ToString_WithNull_ShouldReturnExpectedValue( await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation2_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -55,7 +55,7 @@ public async Task MethodInvocation2_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation2_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -69,7 +69,7 @@ public async Task MethodInvocation2_ToString_WithNull_ShouldReturnExpectedValue( await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation3_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -84,7 +84,7 @@ public async Task MethodInvocation3_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation3_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -99,7 +99,7 @@ public async Task MethodInvocation3_ToString_WithNull_ShouldReturnExpectedValue( await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation4_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -115,7 +115,7 @@ public async Task MethodInvocation4_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation4_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -131,7 +131,7 @@ public async Task MethodInvocation4_ToString_WithNull_ShouldReturnExpectedValue( await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation5_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -148,7 +148,7 @@ public async Task MethodInvocation5_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MethodInvocation5_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); diff --git a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.CallbackTests.cs b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.CallbackTests.cs index 60d9a0234..fa3f7f07c 100644 --- a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.CallbackTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.CallbackTests.cs @@ -10,7 +10,7 @@ public sealed class CallbackTests { public class ReturnMethodWith0Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -25,7 +25,7 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -39,7 +39,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task For_InParallel_ShouldLimitMatches() { List callIndices = []; @@ -58,7 +58,7 @@ public async Task For_InParallel_ShouldLimitMatches() await That(callIndices).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -82,10 +82,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(2); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 2)] - [InlineData(3, 3)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 2)] + [Arguments(3, 3)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int callCount = 0; @@ -102,7 +102,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(callCount).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldLimitMatches() { List callIndices = []; @@ -121,7 +121,7 @@ public async Task Only_ShouldLimitMatches() await That(callIndices).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -138,7 +138,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -156,7 +156,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -176,7 +176,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -197,7 +197,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -214,7 +214,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -241,7 +241,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -265,7 +265,7 @@ void ActOnly() public class ReturnMethodWith1Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -280,7 +280,7 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -295,7 +295,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenParameterDoesNotMatch() { int callCount = 0; @@ -309,7 +309,7 @@ public async Task Callback_ShouldNotExecuteWhenParameterDoesNotMatch() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -329,7 +329,7 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue).IsEqualTo(3); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -344,7 +344,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenParameterDoesNotMatch() { int callCount = 0; @@ -358,9 +358,9 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenParameterDoesNotMatch() await That(callCount).IsEqualTo(0); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -375,7 +375,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -398,9 +398,9 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -415,10 +415,10 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -435,7 +435,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -452,7 +452,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -470,7 +470,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -490,7 +490,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -506,7 +506,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values1.Values).IsEqualTo([1, 3,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -526,7 +526,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -543,7 +543,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -571,7 +571,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -596,7 +596,7 @@ void ActOnly() public class ReturnMethodWith2Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -611,10 +611,10 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] + [Test] + [Arguments(false, false)] + [Arguments(true, false)] + [Arguments(false, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2) { int callCount = 0; @@ -628,7 +628,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -643,7 +643,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -666,10 +666,10 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue2).IsEqualTo(4); } - [Theory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] + [Test] + [Arguments(false, false)] + [Arguments(true, false)] + [Arguments(false, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2) { @@ -684,7 +684,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -699,7 +699,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -722,10 +722,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -742,7 +742,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -759,7 +759,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -777,7 +777,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -797,7 +797,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -815,7 +815,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values2.Values).IsEqualTo([4, 3,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -835,7 +835,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -852,7 +852,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -880,7 +880,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -905,7 +905,7 @@ void ActOnly() public class ReturnMethodWith3Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -920,11 +920,11 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false, false)] - [InlineData(true, true, false)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] + [Test] + [Arguments(false, false, false)] + [Arguments(true, true, false)] + [Arguments(true, false, true)] + [Arguments(false, true, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3) { @@ -940,7 +940,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -955,7 +955,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -981,11 +981,11 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue3).IsEqualTo(6); } - [Theory] - [InlineData(false, false, false)] - [InlineData(true, true, false)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] + [Test] + [Arguments(false, false, false)] + [Arguments(true, true, false)] + [Arguments(true, false, true)] + [Arguments(false, true, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3) @@ -1002,7 +1002,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -1017,7 +1017,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -1040,10 +1040,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -1060,7 +1060,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1077,7 +1077,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1095,7 +1095,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -1115,7 +1115,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1136,7 +1136,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values3.Values).IsEqualTo([3, 4,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -1156,7 +1156,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -1173,7 +1173,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1201,7 +1201,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1226,7 +1226,7 @@ void ActOnly() public class ReturnMethodWith4Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -1241,12 +1241,12 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false, false, false)] - [InlineData(true, true, true, false)] - [InlineData(true, true, false, true)] - [InlineData(true, false, true, true)] - [InlineData(false, true, true, true)] + [Test] + [Arguments(false, false, false, false)] + [Arguments(true, true, true, false)] + [Arguments(true, true, false, true)] + [Arguments(true, false, true, true)] + [Arguments(false, true, true, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4) { @@ -1262,7 +1262,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -1277,7 +1277,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -1306,12 +1306,12 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue4).IsEqualTo(8); } - [Theory] - [InlineData(false, false, false, false)] - [InlineData(true, true, true, false)] - [InlineData(true, true, false, true)] - [InlineData(true, false, true, true)] - [InlineData(false, true, true, true)] + [Test] + [Arguments(false, false, false, false)] + [Arguments(true, true, true, false)] + [Arguments(true, true, false, true)] + [Arguments(true, false, true, true)] + [Arguments(false, true, true, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4) @@ -1328,7 +1328,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -1343,7 +1343,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -1366,10 +1366,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -1386,7 +1386,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1403,7 +1403,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1421,7 +1421,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -1441,7 +1441,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1466,7 +1466,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values4.Values).IsEqualTo([4, 5, 6,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -1486,7 +1486,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -1503,7 +1503,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1531,7 +1531,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1556,7 +1556,7 @@ void ActOnly() public class ReturnMethodWith5Parameters { - [Fact] + [Test] public async Task AnyParameters_Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -1571,7 +1571,7 @@ public async Task AnyParameters_Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task AnyParameters_CallbackWithValue_ShouldReceiveAllParameters() { int receivedValue1 = 0; @@ -1601,7 +1601,7 @@ public async Task AnyParameters_CallbackWithValue_ShouldReceiveAllParameters() await That(receivedValue5).IsEqualTo(10); } - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -1617,13 +1617,13 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false, false, false, false)] - [InlineData(true, true, true, true, false)] - [InlineData(true, true, true, false, true)] - [InlineData(true, true, false, true, true)] - [InlineData(true, false, true, true, true)] - [InlineData(false, true, true, true, true)] + [Test] + [Arguments(false, false, false, false, false)] + [Arguments(true, true, true, true, false)] + [Arguments(true, true, true, false, true)] + [Arguments(true, true, false, true, true)] + [Arguments(true, false, true, true, true)] + [Arguments(false, true, true, true, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4, bool isMatch5) { @@ -1640,7 +1640,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -1656,7 +1656,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -1689,13 +1689,13 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue5).IsEqualTo(10); } - [Theory] - [InlineData(false, false, false, false, false)] - [InlineData(true, true, true, true, false)] - [InlineData(true, true, true, false, true)] - [InlineData(true, true, false, true, true)] - [InlineData(true, false, true, true, true)] - [InlineData(false, true, true, true, true)] + [Test] + [Arguments(false, false, false, false, false)] + [Arguments(true, true, true, true, false)] + [Arguments(true, true, true, false, true)] + [Arguments(true, true, false, true, true)] + [Arguments(true, false, true, true, true)] + [Arguments(false, true, true, true, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4, bool isMatch5) @@ -1713,7 +1713,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -1729,7 +1729,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -1753,10 +1753,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -1774,7 +1774,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1792,7 +1792,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -1811,7 +1811,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -1832,7 +1832,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1861,7 +1861,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values5.Values).IsEqualTo([5, 6, 7, 8,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -1882,7 +1882,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -1900,7 +1900,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1928,7 +1928,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1953,7 +1953,7 @@ void ActOnly() public class VoidMethodWith0Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -1966,7 +1966,7 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -1980,7 +1980,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task For_InParallel_ShouldLimitMatches() { List callIndices = []; @@ -1998,7 +1998,7 @@ public async Task For_InParallel_ShouldLimitMatches() await That(callIndices).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -2022,10 +2022,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(2); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 2)] - [InlineData(3, 3)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 2)] + [Arguments(3, 3)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int callCount = 0; @@ -2042,7 +2042,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(callCount).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldLimitMatches() { List callIndices = []; @@ -2060,7 +2060,7 @@ public async Task Only_ShouldLimitMatches() await That(callIndices).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2077,7 +2077,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2095,7 +2095,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -2115,7 +2115,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -2136,7 +2136,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -2153,7 +2153,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2180,7 +2180,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2204,7 +2204,7 @@ void ActOnly() public class VoidMethodWith1Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -2218,7 +2218,7 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -2233,7 +2233,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenParameterDoesNotMatch() { int callCount = 0; @@ -2247,7 +2247,7 @@ public async Task Callback_ShouldNotExecuteWhenParameterDoesNotMatch() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -2267,7 +2267,7 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue).IsEqualTo(3); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -2282,7 +2282,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenParameterDoesNotMatch() { int callCount = 0; @@ -2296,7 +2296,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenParameterDoesNotMatch() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -2319,10 +2319,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -2339,7 +2339,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2356,7 +2356,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2374,7 +2374,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -2394,7 +2394,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2410,7 +2410,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values1.Values).IsEqualTo([1, 3,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -2430,7 +2430,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -2447,7 +2447,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2475,7 +2475,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2500,7 +2500,7 @@ void ActOnly() public class VoidMethodWith2Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -2514,10 +2514,10 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] + [Test] + [Arguments(false, false)] + [Arguments(true, false)] + [Arguments(false, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2) { int callCount = 0; @@ -2531,7 +2531,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -2546,7 +2546,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -2569,10 +2569,10 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue2).IsEqualTo(4); } - [Theory] - [InlineData(false, false)] - [InlineData(true, false)] - [InlineData(false, true)] + [Test] + [Arguments(false, false)] + [Arguments(true, false)] + [Arguments(false, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2) { @@ -2587,7 +2587,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -2602,7 +2602,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -2625,10 +2625,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -2645,7 +2645,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2662,7 +2662,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2680,7 +2680,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -2700,7 +2700,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2718,7 +2718,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values2.Values).IsEqualTo([4, 3,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -2738,7 +2738,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -2755,7 +2755,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2783,7 +2783,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2808,7 +2808,7 @@ void ActOnly() public class VoidMethodWith3Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -2822,11 +2822,11 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false, false)] - [InlineData(true, true, false)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] + [Test] + [Arguments(false, false, false)] + [Arguments(true, true, false)] + [Arguments(true, false, true)] + [Arguments(false, true, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3) { @@ -2842,7 +2842,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -2857,7 +2857,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -2883,11 +2883,11 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue3).IsEqualTo(6); } - [Theory] - [InlineData(false, false, false)] - [InlineData(true, true, false)] - [InlineData(true, false, true)] - [InlineData(false, true, true)] + [Test] + [Arguments(false, false, false)] + [Arguments(true, true, false)] + [Arguments(true, false, true)] + [Arguments(false, true, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3) @@ -2904,7 +2904,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -2919,7 +2919,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -2942,10 +2942,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -2962,7 +2962,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2979,7 +2979,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -2997,7 +2997,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -3017,7 +3017,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3038,7 +3038,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values3.Values).IsEqualTo([3, 4,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -3058,7 +3058,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -3075,7 +3075,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3103,7 +3103,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3128,7 +3128,7 @@ void ActOnly() public class VoidMethodWith4Parameters { - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -3142,12 +3142,12 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false, false, false)] - [InlineData(true, true, true, false)] - [InlineData(true, true, false, true)] - [InlineData(true, false, true, true)] - [InlineData(false, true, true, true)] + [Test] + [Arguments(false, false, false, false)] + [Arguments(true, true, true, false)] + [Arguments(true, true, false, true)] + [Arguments(true, false, true, true)] + [Arguments(false, true, true, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4) { @@ -3163,7 +3163,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -3178,7 +3178,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -3207,12 +3207,12 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue4).IsEqualTo(8); } - [Theory] - [InlineData(false, false, false, false)] - [InlineData(true, true, true, false)] - [InlineData(true, true, false, true)] - [InlineData(true, false, true, true)] - [InlineData(false, true, true, true)] + [Test] + [Arguments(false, false, false, false)] + [Arguments(true, true, true, false)] + [Arguments(true, true, false, true)] + [Arguments(true, false, true, true)] + [Arguments(false, true, true, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4) @@ -3229,7 +3229,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -3244,7 +3244,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -3267,10 +3267,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -3287,7 +3287,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -3304,7 +3304,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -3322,7 +3322,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -3342,7 +3342,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3367,7 +3367,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values4.Values).IsEqualTo([4, 5, 6,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -3387,7 +3387,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -3404,7 +3404,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3432,7 +3432,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3457,7 +3457,7 @@ void ActOnly() public class VoidMethodWith5Parameters { - [Fact] + [Test] public async Task AnyParameters_Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -3471,7 +3471,7 @@ public async Task AnyParameters_Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task AnyParameters_CallbackWithValue_ShouldReceiveAllParameters() { int receivedValue1 = 0; @@ -3500,7 +3500,7 @@ public async Task AnyParameters_CallbackWithValue_ShouldReceiveAllParameters() await That(receivedValue5).IsEqualTo(10); } - [Fact] + [Test] public async Task Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -3515,13 +3515,13 @@ public async Task Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Theory] - [InlineData(false, false, false, false, false)] - [InlineData(true, true, true, true, false)] - [InlineData(true, true, true, false, true)] - [InlineData(true, true, false, true, true)] - [InlineData(true, false, true, true, true)] - [InlineData(false, true, true, true, true)] + [Test] + [Arguments(false, false, false, false, false)] + [Arguments(true, true, true, true, false)] + [Arguments(true, true, true, false, true)] + [Arguments(true, true, false, true, true)] + [Arguments(true, false, true, true, true)] + [Arguments(false, true, true, true, true)] public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4, bool isMatch5) { @@ -3538,7 +3538,7 @@ public async Task Callback_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isM await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -3554,7 +3554,7 @@ public async Task Callback_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -3587,13 +3587,13 @@ public async Task CallbackWithValue_ShouldExecuteWhenInvoked() await That(receivedValue5).IsEqualTo(10); } - [Theory] - [InlineData(false, false, false, false, false)] - [InlineData(true, true, true, true, false)] - [InlineData(true, true, true, false, true)] - [InlineData(true, true, false, true, true)] - [InlineData(true, false, true, true, true)] - [InlineData(false, true, true, true, true)] + [Test] + [Arguments(false, false, false, false, false)] + [Arguments(true, true, true, true, false)] + [Arguments(true, true, true, false, true)] + [Arguments(true, true, false, true, true)] + [Arguments(true, false, true, true, true)] + [Arguments(false, true, true, true, true)] public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch(bool isMatch1, bool isMatch2, bool isMatch3, bool isMatch4, bool isMatch5) @@ -3611,7 +3611,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenAnyParameterDoesNotMatch await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() { int callCount = 0; @@ -3627,7 +3627,7 @@ public async Task CallbackWithValue_ShouldNotExecuteWhenOtherMethodIsInvoked() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -3651,10 +3651,10 @@ public async Task InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { int sum = 0; @@ -3672,7 +3672,7 @@ public async Task Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -3690,7 +3690,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -3709,7 +3709,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -3730,7 +3730,7 @@ public async Task OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3759,7 +3759,7 @@ public async Task ParameterCallbacks_ShouldOnlyBeInvokedWhenAllMatch() await That(values5.Values).IsEqualTo([5, 6, 7, 8,]); } - [Fact] + [Test] public async Task ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -3780,7 +3780,7 @@ public async Task ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -3798,7 +3798,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3826,7 +3826,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupCallbackWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.LiteralValuesTests.cs b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.LiteralValuesTests.cs index 0a040b716..dc4641b72 100644 --- a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.LiteralValuesTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.LiteralValuesTests.cs @@ -11,7 +11,7 @@ public sealed partial class SetupMethodTests /// public sealed class LiteralValuesTests { - [Fact] + [Test] public async Task LiteralValues_Arity1_Return_MatchesValue() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -24,7 +24,7 @@ public async Task LiteralValues_Arity1_Return_MatchesValue() await That(miss).IsEqualTo(string.Empty); } - [Fact] + [Test] public async Task LiteralValues_Arity1_Void_MatchesAndCounts() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -39,7 +39,7 @@ public async Task LiteralValues_Arity1_Void_MatchesAndCounts() await That(sut.Mock.Verify.Touch1(2)).Once(); } - [Fact] + [Test] public async Task LiteralValues_Arity1_AnyParameters_MatchesEverything() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -49,7 +49,7 @@ public async Task LiteralValues_Arity1_AnyParameters_MatchesEverything() await That(sut.Get1(99)).IsEqualTo("any"); } - [Fact] + [Test] public async Task LiteralValues_Arity1_EquivalentToItIs() { ILiteralFusedService literal = ILiteralFusedService.CreateMock(); @@ -61,7 +61,7 @@ public async Task LiteralValues_Arity1_EquivalentToItIs() await That(literal.Get1(8)).IsEqualTo(matcher.Get1(8)); } - [Fact] + [Test] public async Task LiteralValues_Arity2_Return_MatchesAllParameters() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -74,7 +74,7 @@ public async Task LiteralValues_Arity2_Return_MatchesAllParameters() await That(sut.Mock.Verify.Get2(2, "a")).Once(); } - [Fact] + [Test] public async Task LiteralValues_Arity2_Void_VerifiesByLiteralValues() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -87,7 +87,7 @@ public async Task LiteralValues_Arity2_Void_VerifiesByLiteralValues() await That(sut.Mock.Verify.Touch2(3, true)).Never(); } - [Fact] + [Test] public async Task LiteralValues_Arity3_Return_MatchesAllParameters() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -99,7 +99,7 @@ public async Task LiteralValues_Arity3_Return_MatchesAllParameters() await That(sut.Mock.Verify.Get3(1, "a", false)).Once(); } - [Fact] + [Test] public async Task LiteralValues_Arity3_Void_AnyParameters() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -112,7 +112,7 @@ public async Task LiteralValues_Arity3_Void_AnyParameters() await That(hits).IsEqualTo(2); } - [Fact] + [Test] public async Task LiteralValues_Arity4_Return_MatchesAllParameters() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); @@ -124,7 +124,7 @@ public async Task LiteralValues_Arity4_Return_MatchesAllParameters() await That(sut.Mock.Verify.Get4(1, "a", true, 0.6)).Once(); } - [Fact] + [Test] public async Task LiteralValues_Arity4_Void_EquivalentToMatcherSetup() { ILiteralFusedService literal = ILiteralFusedService.CreateMock(); @@ -142,7 +142,7 @@ public async Task LiteralValues_Arity4_Void_EquivalentToMatcherSetup() await That(literalHits).IsEqualTo(matcherHits); } - [Fact] + [Test] public async Task LiteralValues_ToString_UsesInvariantCulture() { ILiteralFusedService sut = ILiteralFusedService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.ReturnsThrowsTests.cs b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.ReturnsThrowsTests.cs index 02e989e43..bfc324c9b 100644 --- a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.ReturnsThrowsTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.ReturnsThrowsTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Mockolate.Setup; +using Mockolate.Tests.TestHelpers; namespace Mockolate.Tests.MockMethods; @@ -9,9 +10,9 @@ public sealed class ReturnsThrowsTests { public class ReturnMethodWith0Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -26,7 +27,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -37,7 +38,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut.Method0(); - Exception? result2 = Record.Exception(() => sut.Method0()); + Exception? result2 = Catch.Exception(() => sut.Method0()); string result3 = sut.Method0(); await That(result1).IsEqualTo("d"); @@ -45,7 +46,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -64,9 +65,9 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo(["d", "c", "b", "d", "c", "b", "d", "c", "b", "d",]); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -81,7 +82,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Only_ShouldLimitMatches() { List results = []; @@ -99,7 +100,7 @@ public async Task Only_ShouldLimitMatches() await That(results).IsEqualTo(["", "", "a", "a", "",]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -111,7 +112,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -129,7 +130,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -148,7 +149,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -166,7 +167,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -178,7 +179,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -195,7 +196,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -216,7 +217,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -226,7 +227,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -237,7 +238,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldReturnSetupValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -249,7 +250,7 @@ public async Task SetupWithReturn_ShouldReturnSetupValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -264,7 +265,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -279,7 +280,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -294,7 +295,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -315,7 +316,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -339,9 +340,9 @@ void ActOnly() public class ReturnMethodWith1Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -356,7 +357,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -367,7 +368,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut.Method1(1); - Exception? result2 = Record.Exception(() => sut.Method1(2)); + Exception? result2 = Catch.Exception(() => sut.Method1(2)); string result3 = sut.Method1(3); await That(result1).IsEqualTo("d"); @@ -375,7 +376,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -394,9 +395,9 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo(["d", "c", "foo-2", "d", "c", "foo-5", "d", "c", "foo-8", "d",]); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -411,7 +412,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -423,7 +424,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -435,7 +436,7 @@ public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-3"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -453,7 +454,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -472,7 +473,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -490,7 +491,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -502,7 +503,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -519,7 +520,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -540,7 +541,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -550,7 +551,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -561,7 +562,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldReturnSetupValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -573,7 +574,7 @@ public async Task SetupWithReturn_ShouldReturnSetupValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -589,7 +590,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -605,7 +606,7 @@ void Act() await That(Act).Throws().WithMessage("foo-42"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -621,7 +622,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -637,7 +638,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -653,7 +654,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -674,7 +675,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -698,9 +699,9 @@ void ActOnly() public class ReturnMethodWith2Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -715,7 +716,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -726,7 +727,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut.Method2(1, 2); - Exception? result2 = Record.Exception(() => sut.Method2(2, 3)); + Exception? result2 = Catch.Exception(() => sut.Method2(2, 3)); string result3 = sut.Method2(3, 4); await That(result1).IsEqualTo("d"); @@ -734,7 +735,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -753,9 +754,9 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo(["d", "c", "foo-2-4", "d", "c", "foo-5-10", "d", "c", "foo-8-16", "d",]); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -770,7 +771,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -782,7 +783,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -794,7 +795,7 @@ public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-2-3"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -812,7 +813,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -831,7 +832,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -849,7 +850,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -861,7 +862,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -878,7 +879,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -899,7 +900,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -909,7 +910,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -920,7 +921,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldReturnSetupValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -932,7 +933,7 @@ public async Task SetupWithReturn_ShouldReturnSetupValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -948,7 +949,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -964,7 +965,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -980,7 +981,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -996,7 +997,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -1012,7 +1013,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1034,7 +1035,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1059,9 +1060,9 @@ void ActOnly() public class ReturnMethodWith3Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1076,7 +1077,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1087,7 +1088,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut.Method3(1, 2, 3); - Exception? result2 = Record.Exception(() => sut.Method3(2, 3, 4)); + Exception? result2 = Catch.Exception(() => sut.Method3(2, 3, 4)); string result3 = sut.Method3(3, 4, 5); await That(result1).IsEqualTo("d"); @@ -1095,7 +1096,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1114,9 +1115,9 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo(["d", "c", "foo-2-4-6", "d", "c", "foo-5-10-15", "d", "c", "foo-8-16-24", "d",]); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1131,7 +1132,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1144,7 +1145,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1157,7 +1158,7 @@ public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-2-3-4"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1175,7 +1176,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1194,7 +1195,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1212,7 +1213,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1224,7 +1225,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1241,7 +1242,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1262,7 +1263,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1272,7 +1273,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -1283,7 +1284,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2-3"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldReturnSetupValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -1295,7 +1296,7 @@ public async Task SetupWithReturn_ShouldReturnSetupValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1311,7 +1312,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1327,7 +1328,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1343,7 +1344,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1359,7 +1360,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -1375,7 +1376,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1397,7 +1398,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1422,9 +1423,9 @@ void ActOnly() public class ReturnMethodWith4Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1439,7 +1440,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1450,7 +1451,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut.Method4(1, 2, 3, 4); - Exception? result2 = Record.Exception(() => sut.Method4(2, 3, 4, 5)); + Exception? result2 = Catch.Exception(() => sut.Method4(2, 3, 4, 5)); string result3 = sut.Method4(3, 4, 5, 6); await That(result1).IsEqualTo("d"); @@ -1458,7 +1459,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1479,9 +1480,9 @@ await That(result).IsEqualTo([ ]); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1496,7 +1497,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1509,7 +1510,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1522,7 +1523,7 @@ public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-2-3-4-5"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1540,7 +1541,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1559,7 +1560,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1577,7 +1578,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1590,7 +1591,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1607,7 +1608,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1628,7 +1629,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1638,7 +1639,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -1650,7 +1651,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2-3-4"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -1662,7 +1663,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1678,7 +1679,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1694,7 +1695,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3-4"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1710,7 +1711,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1726,7 +1727,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -1742,7 +1743,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1764,7 +1765,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1789,9 +1790,9 @@ void ActOnly() public class ReturnMethodWith5Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1807,7 +1808,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1819,7 +1820,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => "b"); string result1 = sut.Method5(1, 2, 3, 4, 5); - Exception? result2 = Record.Exception(() => sut.Method5(2, 3, 4, 5, 6)); + Exception? result2 = Catch.Exception(() => sut.Method5(2, 3, 4, 5, 6)); string result3 = sut.Method5(3, 4, 5, 6, 7); await That(result1).IsEqualTo("d"); @@ -1827,7 +1828,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo("b"); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1849,9 +1850,9 @@ await That(result).IsEqualTo([ ]); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1867,7 +1868,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1881,7 +1882,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1895,7 +1896,7 @@ public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("foo-2-3-4-5-6"); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1914,7 +1915,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1934,7 +1935,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1953,7 +1954,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1967,7 +1968,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo("d"); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1985,7 +1986,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2007,7 +2008,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2017,7 +2018,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEmpty(); } - [Fact] + [Test] public async Task SetupWithoutReturn_ShouldUseBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -2030,7 +2031,7 @@ public async Task SetupWithoutReturn_ShouldUseBaseValue() await That(result).IsEqualTo("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task SetupWithReturn_ShouldIgnoreBaseValue() { ReturnMethodSetupTest sut = ReturnMethodSetupTest.CreateMock(); @@ -2043,7 +2044,7 @@ public async Task SetupWithReturn_ShouldIgnoreBaseValue() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2060,7 +2061,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2077,7 +2078,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2094,7 +2095,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2111,7 +2112,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -2128,7 +2129,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2151,7 +2152,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IReturnMethodSetupReturnWhenBuilder_ShouldNotThrow() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -2176,9 +2177,9 @@ void ActOnly() public class VoidMethodWith0Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2193,7 +2194,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2204,19 +2205,19 @@ public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() .DoesNotThrow(); sut.Method0(); - Exception? result1 = Record.Exception(() => sut.Method0()); + Exception? result1 = Catch.Exception(() => sut.Method0()); sut.Method0(); sut.Method0(); - Exception? result2 = Record.Exception(() => sut.Method0()); + Exception? result2 = Catch.Exception(() => sut.Method0()); sut.Method0(); await That(result1).HasMessage("foo"); await That(result2).HasMessage("foo"); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2231,7 +2232,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Only_ShouldLimitMatches() { List results = []; @@ -2256,7 +2257,7 @@ public async Task Only_ShouldLimitMatches() await That(results).IsEqualTo(["", "", "a", "a", "",]); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2282,7 +2283,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2309,7 +2310,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(values).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2335,7 +2336,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2348,7 +2349,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(() => sut.Method0()).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2377,7 +2378,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2392,7 +2393,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2407,7 +2408,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2422,7 +2423,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2443,7 +2444,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2467,9 +2468,9 @@ void ActOnly() public class VoidMethodWith1Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2484,7 +2485,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2495,19 +2496,19 @@ public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() .DoesNotThrow(); sut.Method1(1); - Exception? result1 = Record.Exception(() => sut.Method1(2)); + Exception? result1 = Catch.Exception(() => sut.Method1(2)); sut.Method1(3); sut.Method1(4); - Exception? result2 = Record.Exception(() => sut.Method1(5)); + Exception? result2 = Catch.Exception(() => sut.Method1(5)); sut.Method1(6); await That(result1).HasMessage("foo"); await That(result2).HasMessage("foo"); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2522,7 +2523,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2548,7 +2549,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2575,7 +2576,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(values).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2601,7 +2602,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2614,7 +2615,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(() => sut.Method1(1)).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2643,7 +2644,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2658,7 +2659,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2673,7 +2674,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2689,7 +2690,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2705,7 +2706,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2726,7 +2727,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2750,9 +2751,9 @@ void ActOnly() public class VoidMethodWith2Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2767,7 +2768,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2778,19 +2779,19 @@ public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() .DoesNotThrow(); sut.Method2(1, 2); - Exception? result1 = Record.Exception(() => sut.Method2(2, 3)); + Exception? result1 = Catch.Exception(() => sut.Method2(2, 3)); sut.Method2(3, 4); sut.Method2(4, 5); - Exception? result2 = Record.Exception(() => sut.Method2(5, 6)); + Exception? result2 = Catch.Exception(() => sut.Method2(5, 6)); sut.Method2(6, 7); await That(result1).HasMessage("foo"); await That(result2).HasMessage("foo"); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2805,7 +2806,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2831,7 +2832,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2858,7 +2859,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(values).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2884,7 +2885,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2897,7 +2898,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(() => sut.Method2(1, 2)).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2926,7 +2927,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2942,7 +2943,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2958,7 +2959,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2974,7 +2975,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -2990,7 +2991,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3012,7 +3013,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3037,9 +3038,9 @@ void ActOnly() public class VoidMethodWith3Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3054,7 +3055,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3065,19 +3066,19 @@ public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() .DoesNotThrow(); sut.Method3(1, 2, 3); - Exception? result1 = Record.Exception(() => sut.Method3(2, 3, 4)); + Exception? result1 = Catch.Exception(() => sut.Method3(2, 3, 4)); sut.Method3(3, 4, 5); sut.Method3(4, 5, 6); - Exception? result2 = Record.Exception(() => sut.Method3(5, 6, 7)); + Exception? result2 = Catch.Exception(() => sut.Method3(5, 6, 7)); sut.Method3(6, 7, 8); await That(result1).HasMessage("foo"); await That(result2).HasMessage("foo"); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3092,7 +3093,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3118,7 +3119,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3145,7 +3146,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(values).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3171,7 +3172,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3184,7 +3185,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(() => sut.Method3(1, 2, 3)).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3213,7 +3214,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3229,7 +3230,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3245,7 +3246,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3261,7 +3262,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3277,7 +3278,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3299,7 +3300,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3324,9 +3325,9 @@ void ActOnly() public class VoidMethodWith4Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3341,7 +3342,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3352,19 +3353,19 @@ public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() .DoesNotThrow(); sut.Method4(1, 2, 3, 4); - Exception? result1 = Record.Exception(() => sut.Method4(2, 3, 4, 5)); + Exception? result1 = Catch.Exception(() => sut.Method4(2, 3, 4, 5)); sut.Method4(3, 4, 5, 6); sut.Method4(4, 5, 6, 7); - Exception? result2 = Record.Exception(() => sut.Method4(5, 6, 7, 8)); + Exception? result2 = Catch.Exception(() => sut.Method4(5, 6, 7, 8)); sut.Method4(6, 7, 8, 9); await That(result1).HasMessage("foo"); await That(result2).HasMessage("foo"); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3379,7 +3380,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3405,7 +3406,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3432,7 +3433,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(values).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3458,7 +3459,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3471,7 +3472,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(() => sut.Method4(1, 2, 3, 4)).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3500,7 +3501,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3516,7 +3517,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3532,7 +3533,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3-4"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3548,7 +3549,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3564,7 +3565,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3586,7 +3587,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3611,9 +3612,9 @@ void ActOnly() public class VoidMethodWith5Parameters { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3629,7 +3630,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3641,19 +3642,19 @@ public async Task MixDoesNotThrowAndThrow_ShouldIterateThroughBoth() .DoesNotThrow(); sut.Method5(1, 2, 3, 4, 5); - Exception? result1 = Record.Exception(() => sut.Method5(2, 3, 4, 5, 6)); + Exception? result1 = Catch.Exception(() => sut.Method5(2, 3, 4, 5, 6)); sut.Method5(3, 4, 5, 6, 7); sut.Method5(4, 5, 6, 7, 8); - Exception? result2 = Record.Exception(() => sut.Method5(5, 6, 7, 8, 9)); + Exception? result2 = Catch.Exception(() => sut.Method5(5, 6, 7, 8, 9)); sut.Method5(6, 7, 8, 9, 10); await That(result1).HasMessage("foo"); await That(result2).HasMessage("foo"); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3669,7 +3670,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3696,7 +3697,7 @@ public async Task Returns_For_ShouldRepeatUsage_ForTheSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3724,7 +3725,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(values).IsEqualTo(["a", "b", "c", "c", "c", "c", "c", "c", "c", "c",]); } - [Fact] + [Test] public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3751,7 +3752,7 @@ public async Task Returns_Only_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "bar", "foo", "bar", "bar", "", "", "", "", "",]); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3765,7 +3766,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(() => sut.Method5(1, 2, 3, 4, 5)).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3795,7 +3796,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3812,7 +3813,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3829,7 +3830,7 @@ void Act() await That(Act).Throws().WithMessage("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3846,7 +3847,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3863,7 +3864,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -3886,7 +3887,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IVoidMethodSetupReturnWhenBuilder_ShouldNotThrow() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SkippingBaseClassTests.cs b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SkippingBaseClassTests.cs index 33519614e..288f917c5 100644 --- a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SkippingBaseClassTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SkippingBaseClassTests.cs @@ -4,9 +4,9 @@ public sealed partial class SetupMethodTests { public sealed class SkippingBaseClassTests { - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyReturnMethodWith1Parameter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -18,9 +18,9 @@ public async Task MyReturnMethodWith1Parameter_ShouldSkipCallingBaseWhenRequeste await That(sut.MyReturnMethodWith1ParameterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyReturnMethodWith2Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -32,9 +32,9 @@ public async Task MyReturnMethodWith2Parameters_ShouldSkipCallingBaseWhenRequest await That(sut.MyReturnMethodWith2ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyReturnMethodWith3Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -47,9 +47,9 @@ public async Task MyReturnMethodWith3Parameters_ShouldSkipCallingBaseWhenRequest await That(sut.MyReturnMethodWith3ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyReturnMethodWith4Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -62,9 +62,9 @@ public async Task MyReturnMethodWith4Parameters_ShouldSkipCallingBaseWhenRequest await That(sut.MyReturnMethodWith4ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyReturnMethodWith5Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -77,9 +77,9 @@ public async Task MyReturnMethodWith5Parameters_ShouldSkipCallingBaseWhenRequest await That(sut.MyReturnMethodWith5ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyReturnMethodWithoutParameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -91,9 +91,9 @@ public async Task MyReturnMethodWithoutParameters_ShouldSkipCallingBaseWhenReque await That(sut.MyReturnMethodWithoutParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyVoidMethodWith1Parameter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -105,9 +105,9 @@ public async Task MyVoidMethodWith1Parameter_ShouldSkipCallingBaseWhenRequested( await That(sut.MyVoidMethodWith1ParameterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyVoidMethodWith2Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -119,9 +119,9 @@ public async Task MyVoidMethodWith2Parameters_ShouldSkipCallingBaseWhenRequested await That(sut.MyVoidMethodWith2ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyVoidMethodWith3Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -134,9 +134,9 @@ public async Task MyVoidMethodWith3Parameters_ShouldSkipCallingBaseWhenRequested await That(sut.MyVoidMethodWith3ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyVoidMethodWith4Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -149,9 +149,9 @@ public async Task MyVoidMethodWith4Parameters_ShouldSkipCallingBaseWhenRequested await That(sut.MyVoidMethodWith4ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyVoidMethodWith5Parameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -164,9 +164,9 @@ public async Task MyVoidMethodWith5Parameters_ShouldSkipCallingBaseWhenRequested await That(sut.MyVoidMethodWith5ParametersCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyVoidMethodWithoutParameters_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -178,7 +178,7 @@ public async Task MyVoidMethodWithoutParameters_ShouldSkipCallingBaseWhenRequest await That(sut.MyVoidMethodWithoutParametersCallCount).IsEqualTo(expectedCallCount); } - [Fact] + [Test] public async Task SetupSkippingBaseClassWithoutParameter_ShouldReturnDefaultValue() { MyMethodService sut = MyMethodService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SpanTests.cs b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SpanTests.cs index fe41d5379..96cc59dc8 100644 --- a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SpanTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.SpanTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupMethodTests { public sealed class SpanTests { - [Fact] + [Test] public async Task Memory_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() { SpanMock sut = SpanMock.CreateMock(); @@ -17,7 +17,7 @@ public async Task Memory_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task Memory_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -28,7 +28,7 @@ public async Task Memory_WhenPredicateMatches_ShouldApplySetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Memory_WithoutPredicate_ShouldMatchAnySpan() { SpanMock sut = SpanMock.CreateMock(); @@ -39,7 +39,7 @@ public async Task Memory_WithoutPredicate_ShouldMatchAnySpan() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReadOnlySpan_ReturnValueSetup_ShouldReturnExpectedSpan() { SpanMock sut = SpanMock.CreateMock(); @@ -51,7 +51,7 @@ public async Task ReadOnlySpan_ReturnValueSetup_ShouldReturnExpectedSpan() await That(result).IsEqualTo(expectedData); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() { SpanMock sut = SpanMock.CreateMock(); @@ -62,7 +62,7 @@ public async Task ReadOnlySpan_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -73,7 +73,7 @@ public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReadOnlySpan_WithoutPredicate_ShouldMatchAnySpan() { SpanMock sut = SpanMock.CreateMock(); @@ -84,7 +84,7 @@ public async Task ReadOnlySpan_WithoutPredicate_ShouldMatchAnySpan() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReadOnlySpan_WithParameter_ShouldMatchAndReturn() { SpanMock sut = SpanMock.CreateMock(); @@ -99,7 +99,7 @@ public async Task ReadOnlySpan_WithParameter_ShouldMatchAndReturn() await That(result).IsEqualTo(outputData); } - [Fact] + [Test] public async Task Span_MultipleReturnValues_ShouldCycleThroughValues() { SpanMock sut = SpanMock.CreateMock(); @@ -118,7 +118,7 @@ public async Task Span_MultipleReturnValues_ShouldCycleThroughValues() await That(thirdResult).IsEqualTo(firstData); } - [Fact] + [Test] public async Task Span_ReturnValueSetup_ShouldReturnExpectedSpan() { SpanMock sut = SpanMock.CreateMock(); @@ -130,7 +130,7 @@ public async Task Span_ReturnValueSetup_ShouldReturnExpectedSpan() await That(result).IsEqualTo(expectedData); } - [Fact] + [Test] public async Task Span_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() { SpanMock sut = SpanMock.CreateMock(); @@ -141,7 +141,7 @@ public async Task Span_WhenPredicateDoesNotMatch_ShouldUseDefaultValue() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task Span_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -152,7 +152,7 @@ public async Task Span_WhenPredicateMatches_ShouldApplySetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Span_WithCallback_ShouldExecuteCallback() { SpanMock sut = SpanMock.CreateMock(); @@ -169,7 +169,7 @@ public async Task Span_WithCallback_ShouldExecuteCallback() await That(result).IsEqualTo(returnData); } - [Fact] + [Test] public async Task Span_WithoutPredicate_ShouldMatchAnySpan() { SpanMock sut = SpanMock.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.cs b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.cs index 8d05dc929..4d2d80ead 100644 --- a/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/SetupMethodTests.cs @@ -9,7 +9,7 @@ namespace Mockolate.Tests.MockMethods; public sealed partial class SetupMethodTests { - [Fact] + [Test] public async Task Equals_ShouldWork() { object obj = new(); @@ -21,7 +21,7 @@ public async Task Equals_ShouldWork() await That(result).IsEqualTo(true); } - [Fact] + [Test] public async Task GenericMethod_SetupShouldWork() { IMethodService sut = IMethodService.CreateMock(); @@ -35,7 +35,7 @@ public async Task GenericMethod_SetupShouldWork() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task GenericMethods_ShouldConsiderGenericParameter() { IMethodService sut = IMethodService.CreateMock(); @@ -48,7 +48,7 @@ public async Task GenericMethods_ShouldConsiderGenericParameter() await That(notMatchingResult).IsEqualTo(0); } - [Fact] + [Test] public async Task GetHashCode_ShouldWork() { int expectedResult = Guid.NewGuid().GetHashCode(); @@ -60,7 +60,7 @@ public async Task GetHashCode_ShouldWork() await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task MultipleOnlyOnceCallbacks_ShouldExecuteInOrder() { List receivedCalls = []; @@ -82,7 +82,7 @@ public async Task MultipleOnlyOnceCallbacks_ShouldExecuteInOrder() await That(receivedCalls).IsEqualTo([1, 2, 3, 4, 5,]); } - [Fact] + [Test] public async Task OverlappingSetups_ShouldUseLatestMatchingSetup() { IMethodService sut = IMethodService.CreateMock(); @@ -98,7 +98,7 @@ public async Task OverlappingSetups_ShouldUseLatestMatchingSetup() await That(result3).IsEqualTo(1); } - [Fact] + [Test] public async Task OverlappingSetups_WhenGeneralSetupIsLater_ShouldOnlyUseGeneralSetup() { IMethodService sut = IMethodService.CreateMock(); @@ -114,7 +114,7 @@ public async Task OverlappingSetups_WhenGeneralSetupIsLater_ShouldOnlyUseGeneral await That(result3).IsEqualTo(1); } - [Fact] + [Test] public async Task Parameter_Do_ShouldExecuteCallback() { List capturedValues = []; @@ -129,7 +129,7 @@ public async Task Parameter_Do_ShouldExecuteCallback() await That(capturedValues).IsEqualTo([1, 2, 3,]); } - [Fact] + [Test] public async Task Parameter_Do_ShouldOnlyExecuteCallbackWhenAllParametersMatch() { List capturedValues = []; @@ -144,7 +144,7 @@ public async Task Parameter_Do_ShouldOnlyExecuteCallbackWhenAllParametersMatch() await That(capturedValues).IsEqualTo([1, 3,]); } - [Fact] + [Test] public async Task ParameterExplicitMixWithNull_ShouldWork() { IMethodService sut = IMethodService.CreateMock(); @@ -157,7 +157,7 @@ public async Task ParameterExplicitMixWithNull_ShouldWork() await That(sut.Mock.Verify.Combine(value, null!)).Once(); } - [Fact] + [Test] public async Task ParameterMixWithNull_ShouldWork() { IMethodService sut = IMethodService.CreateMock(); @@ -170,7 +170,7 @@ public async Task ParameterMixWithNull_ShouldWork() await That(sut.Mock.Verify.Combine(It.IsAny(), null)).Once(); } - [Fact] + [Test] public async Task Register_AfterInvocation_ShouldBeAppliedForFutureUse() { IMethodService sut = IMethodService.CreateMock(); @@ -183,7 +183,7 @@ public async Task Register_AfterInvocation_ShouldBeAppliedForFutureUse() await That(result1).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnMethod_Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -199,7 +199,7 @@ public async Task ReturnMethod_Callback_ShouldExecuteWhenInvoked() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task ReturnMethod_Verify_ShouldMatchAnyParameters() { int callCount = 0; @@ -216,7 +216,7 @@ public async Task ReturnMethod_Verify_ShouldMatchAnyParameters() await That(sut.Mock.Verify.MethodWithoutOtherOverloads(Match.AnyParameters())).Once(); } - [Fact] + [Test] public async Task ReturnMethod_WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -232,7 +232,7 @@ public async Task ReturnMethod_WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task Setup_ShouldUseNewestMatchingSetup() { IMethodService sut = IMethodService.CreateMock(); @@ -245,7 +245,7 @@ public async Task Setup_ShouldUseNewestMatchingSetup() await That(sut.MyIntMethodWithParameters(1, "")).IsEqualTo(20); } - [Fact] + [Test] public async Task Setup_WithOutParameter_ShouldUseCallbackToSetValue() { IMethodService sut = IMethodService.CreateMock(); @@ -256,7 +256,7 @@ public async Task Setup_WithOutParameter_ShouldUseCallbackToSetValue() await That(value).IsEqualTo(4); } - [Fact] + [Test] public async Task Setup_WithOutParameterWithoutCallback_ShouldUseDefaultValueSetValue() { IMethodService sut = IMethodService.CreateMock(); @@ -267,7 +267,7 @@ public async Task Setup_WithOutParameterWithoutCallback_ShouldUseDefaultValueSet await That(value).IsEqualTo(0); } - [Fact] + [Test] public async Task Setup_WithRefParameter_WithCallback_ShouldUseCallbackToSetValue() { IMethodService sut = IMethodService.CreateMock(); @@ -279,7 +279,7 @@ public async Task Setup_WithRefParameter_WithCallback_ShouldUseCallbackToSetValu await That(value).IsEqualTo(4); } - [Fact] + [Test] public async Task Setup_WithRefParameter_WithoutPredicateOrCallback_ShouldNotChangeValue() { IMethodService sut = IMethodService.CreateMock(); @@ -291,7 +291,7 @@ public async Task Setup_WithRefParameter_WithoutPredicateOrCallback_ShouldNotCha await That(value).IsEqualTo(2); } - [Fact] + [Test] public async Task Setup_WithRefParameter_WithPredicate_ShouldUseCallbackToSetValue() { IMethodService sut = IMethodService.CreateMock(); @@ -303,7 +303,7 @@ public async Task Setup_WithRefParameter_WithPredicate_ShouldUseCallbackToSetVal await That(value).IsEqualTo(2); } - [Fact] + [Test] public async Task Setup_WithRefParameter_WithPredicateAndCallback_ShouldUseCallbackToSetValueWhenPredicateMatches() { IMethodService sut = IMethodService.CreateMock(); @@ -318,7 +318,7 @@ public async Task Setup_WithRefParameter_WithPredicateAndCallback_ShouldUseCallb await That(value2).IsEqualTo(4); } - [Fact] + [Test] public async Task ToString_OutParameter_ShouldReturnExpectedValue() { IVerifyOutParameter sut = It.IsOut(); @@ -329,7 +329,7 @@ public async Task ToString_OutParameter_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_OutParameter_WithCallback_ShouldReturnExpectedValue() { IOutParameter sut = It.IsOut(() => 4); @@ -340,7 +340,7 @@ public async Task ToString_OutParameter_WithCallback_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_RefParameter_ShouldReturnExpectedValue() { IVerifyRefParameter sut = It.IsRef(); @@ -351,7 +351,7 @@ public async Task ToString_RefParameter_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_RefParameter_WithCallback_ShouldReturnExpectedValue() { IRefParameter sut = It.IsRef(_ => 4); @@ -362,7 +362,7 @@ public async Task ToString_RefParameter_WithCallback_ShouldReturnExpectedValue() await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_RefParameter_WithPredicate_ShouldReturnExpectedValue() { IRefParameter sut = It.IsRef(v => v > 4); @@ -373,7 +373,7 @@ public async Task ToString_RefParameter_WithPredicate_ShouldReturnExpectedValue( await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_RefParameter_WithPredicateAndCallback_ShouldReturnExpectedValue() { IRefParameter sut = It.IsRef(v => v > 4, v => v * 5); @@ -384,7 +384,7 @@ public async Task ToString_RefParameter_WithPredicateAndCallback_ShouldReturnExp await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ToString_ShouldWork() { string expectedResult = Guid.NewGuid().ToString(); @@ -396,7 +396,7 @@ public async Task ToString_ShouldWork() await That(result).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task VoidMethod_Callback_ShouldExecuteWhenInvoked() { int callCount = 0; @@ -410,7 +410,7 @@ public async Task VoidMethod_Callback_ShouldExecuteWhenInvoked() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task VoidMethod_Verify_ShouldMatchAnyParameters() { int callCount = 0; @@ -425,7 +425,7 @@ public async Task VoidMethod_Verify_ShouldMatchAnyParameters() await That(sut.Mock.Verify.MethodWithoutOtherOverloads(Match.AnyParameters())).Once(); } - [Fact] + [Test] public async Task WhenNotSetup_ShouldReturnDefaultValue() { IMethodService sut = IMethodService.CreateMock(); @@ -437,7 +437,7 @@ public async Task WhenNotSetup_ShouldReturnDefaultValue() await That(result2).IsEqualTo(0); } - [Fact] + [Test] public async Task WhenNotSetup_ThrowWhenNotSetup_ShouldThrowMockNotSetupException() { IMethodService mock = IMethodService.CreateMock(MockBehavior.Default with @@ -455,7 +455,7 @@ await That(Act).Throws() "The method 'global::Mockolate.Tests.MockMethods.SetupMethodTests.IMethodService.MyIntMethodWithoutParameters()' was invoked without prior setup."); } - [Fact] + [Test] public async Task WithInParameter_ShouldUseSetup() { IMethodSetupWithInAndRefReadonlyParameter sut = IMethodSetupWithInAndRefReadonlyParameter.CreateMock(); @@ -468,7 +468,7 @@ public async Task WithInParameter_ShouldUseSetup() await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task WithOptionalParameters_ShouldUseOptionalValueWhenNotSet() { IMyService sut = IMyService.CreateMock(); @@ -483,7 +483,7 @@ public async Task WithOptionalParameters_ShouldUseOptionalValueWhenNotSet() await That(result3).IsFalse(); } - [Fact] + [Test] public async Task WithParamsParameters_ExplicitArrayArgument_ShouldUseValueEquality() { IMyService sut = IMyService.CreateMock(); @@ -499,7 +499,7 @@ public async Task WithParamsParameters_ExplicitArrayArgument_ShouldUseValueEqual await That(result3).IsFalse(); } - [Fact] + [Test] public async Task WithParamsParameters_PerElementValues_ShouldMatchElementByElement() { IMyService sut = IMyService.CreateMock(); @@ -516,7 +516,7 @@ public async Task WithParamsParameters_PerElementValues_ShouldMatchElementByElem await That(result4).IsFalse(); } - [Fact] + [Test] public async Task WithParamsParameters_PerElementValues_ShouldSupportVerify() { IMyService sut = IMyService.CreateMock(); @@ -527,7 +527,7 @@ public async Task WithParamsParameters_PerElementValues_ShouldSupportVerify() await That(sut.Mock.Verify.MyMethodWithParams(It.IsAny(), true, true)).Never(); } - [Fact] + [Test] public async Task WithParamsParameters_ShouldSupportParams() { IMyService sut = IMyService.CreateMock(); @@ -544,7 +544,7 @@ public async Task WithParamsParameters_ShouldSupportParams() await That(result4).IsTrue(); } - [Fact] + [Test] public async Task WithParamsParameters_PerElementMatchers_ShouldMatchElementByElement() { IMyService sut = IMyService.CreateMock(); @@ -563,7 +563,7 @@ public async Task WithParamsParameters_PerElementMatchers_ShouldMatchElementByEl await That(result5).IsFalse(); } - [Fact] + [Test] public async Task WithParamsParameters_PerElementMatchers_ShouldSupportVerify() { IMyService sut = IMyService.CreateMock(); @@ -578,7 +578,7 @@ await That(sut.Mock.Verify.MyMethodWithParams( It.IsAny(), It.IsAny(), It.IsFalse())).Once(); } - [Fact] + [Test] public async Task WithRefReadonlyParameter_ShouldUseSetup() { IMethodSetupWithInAndRefReadonlyParameter sut = IMethodSetupWithInAndRefReadonlyParameter.CreateMock(); @@ -593,7 +593,7 @@ public async Task WithRefReadonlyParameter_ShouldUseSetup() public class ReturnMethodWith0Parameters { - [Fact] + [Test] public async Task Setup_ShouldBeVerifiable() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -604,7 +604,7 @@ public async Task Setup_ShouldBeVerifiable() await That(sut.Mock.VerifySetup(setup)).Once(); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo"); @@ -614,7 +614,7 @@ public async Task ToString_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo()"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -633,7 +633,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() public class ReturnMethodWith1Parameters { - [Fact] + [Test] public async Task AnyParameters_OnUntypedDefaultArgument_ShouldBindToValuesOverload() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -645,7 +645,7 @@ public async Task AnyParameters_OnUntypedDefaultArgument_ShouldBindToValuesOverl await That(sut.Method1(42)).IsEqualTo("foo"); } - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -660,9 +660,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(result2).IsEqualTo("foo"); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -673,7 +673,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1"); @@ -683,7 +683,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -696,7 +696,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("string Method1(1)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", (IParameterMatch)It.IsAny()); @@ -706,7 +706,7 @@ public async Task ToString_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(It.IsAny())"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -722,7 +722,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithExplicitParameter_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -740,7 +740,7 @@ public async Task WithExplicitParameter_ShouldWork() public class ReturnMethodWith2Parameters { - [Fact] + [Test] public async Task AnyParameters_OnUntypedDefaultArguments_ShouldBindToValuesOverload() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -752,7 +752,7 @@ public async Task AnyParameters_OnUntypedDefaultArguments_ShouldBindToValuesOver await That(sut.Method2(7, 9)).IsEqualTo("foo"); } - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -767,9 +767,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(result2).IsEqualTo("foo"); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -781,7 +781,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2"); @@ -791,7 +791,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -804,7 +804,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("string Method2(1, 2)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -816,7 +816,7 @@ public async Task ToString_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(It.IsAny(), It.IsAny())"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -832,7 +832,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -847,7 +847,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -862,7 +862,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -882,7 +882,7 @@ public async Task WithExplicitParameters_ShouldWork() public class ReturnMethodWith3Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -897,9 +897,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(result2).IsEqualTo("foo"); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -911,7 +911,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2", "p3"); @@ -921,7 +921,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -934,7 +934,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("string Method3(1, 2, 3)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -947,7 +947,7 @@ public async Task ToString_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(It.IsAny(), It.IsAny(), It.IsAny())"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -963,7 +963,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -978,7 +978,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -993,7 +993,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1008,7 +1008,7 @@ public async Task WithExplicitParameter3_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1027,7 +1027,7 @@ public async Task WithExplicitParameters_ShouldWork() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters1And2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1044,7 +1044,7 @@ public async Task WithExplicitParameters1And2_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters1And3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1061,7 +1061,7 @@ public async Task WithExplicitParameters1And3_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters2And3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1081,7 +1081,7 @@ public async Task WithExplicitParameters2And3_ShouldWork() public class ReturnMethodWith4Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1096,9 +1096,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(result2).IsEqualTo("foo"); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1110,7 +1110,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2", "p3", "p4"); @@ -1120,7 +1120,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1133,7 +1133,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("string Method4(1, 2, 3, 4)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1149,7 +1149,7 @@ await That(result) "int Foo(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -1165,7 +1165,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithExplicitParameter1_2And3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1184,7 +1184,7 @@ public async Task WithExplicitParameter1_2And3_ShouldWork() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter1_2And4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1203,7 +1203,7 @@ public async Task WithExplicitParameter1_2And4_ShouldWork() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter1_3And4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1222,7 +1222,7 @@ public async Task WithExplicitParameter1_3And4_ShouldWork() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1237,7 +1237,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter2_3And4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1256,7 +1256,7 @@ public async Task WithExplicitParameter2_3And4_ShouldWork() await That(result4).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1271,7 +1271,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1286,7 +1286,7 @@ public async Task WithExplicitParameter3_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameter4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1301,7 +1301,7 @@ public async Task WithExplicitParameter4_ShouldWork() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1322,7 +1322,7 @@ public async Task WithExplicitParameters_ShouldWork() await That(result5).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters1And2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1339,7 +1339,7 @@ public async Task WithExplicitParameters1And2_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters1And3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1356,7 +1356,7 @@ public async Task WithExplicitParameters1And3_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters1And4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1373,7 +1373,7 @@ public async Task WithExplicitParameters1And4_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters2And3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1390,7 +1390,7 @@ public async Task WithExplicitParameters2And3_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters2And4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1407,7 +1407,7 @@ public async Task WithExplicitParameters2And4_ShouldWork() await That(result3).IsEmpty(); } - [Fact] + [Test] public async Task WithExplicitParameters3And4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1427,7 +1427,7 @@ public async Task WithExplicitParameters3And4_ShouldWork() public class ReturnMethodWith5Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1442,9 +1442,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(result2).IsEqualTo("foo"); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1456,7 +1456,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2", "p3", "p4", "p5"); @@ -1466,7 +1466,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("int Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1479,7 +1479,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("string Method5(1, 2, 3, 4, 5)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { ReturnMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1496,7 +1496,7 @@ await That(result) "int Foo(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())"); } - [Fact] + [Test] public async Task WhenSetupWithNull_ShouldReturnDefaultValue() { int callCount = 0; @@ -1513,7 +1513,7 @@ public async Task WhenSetupWithNull_ShouldReturnDefaultValue() await That(result).IsNull(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -1541,7 +1541,7 @@ public async Task WithExplicitParameters_ShouldWork() public class VoidMethodWith0Parameters { - [Fact] + [Test] public async Task Setup_ShouldBeVerifiable() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1552,7 +1552,7 @@ public async Task Setup_ShouldBeVerifiable() await That(sut.Mock.VerifySetup(setup)).Once(); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo"); @@ -1565,7 +1565,7 @@ public async Task ToString_ShouldReturnMethodSignature() public class VoidMethodWith1Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { int callCount = 0; @@ -1580,9 +1580,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(callCount).IsEqualTo(2); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1593,7 +1593,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1"); @@ -1603,7 +1603,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("void Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1616,7 +1616,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("void Method1(1)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1630,7 +1630,7 @@ public async Task ToString_ShouldReturnMethodSignature() public class VoidMethodWith2Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { int callCount = 0; @@ -1645,9 +1645,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(callCount).IsEqualTo(2); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1659,7 +1659,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2"); @@ -1669,7 +1669,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("void Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1682,7 +1682,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("void Method2(1, 2)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1697,7 +1697,7 @@ public async Task ToString_ShouldReturnMethodSignature() public class VoidMethodWith3Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { int callCount = 0; @@ -1712,9 +1712,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(callCount).IsEqualTo(2); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1726,7 +1726,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2", "p3"); @@ -1736,7 +1736,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("void Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1749,7 +1749,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("void Method3(1, 2, 3)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1765,7 +1765,7 @@ public async Task ToString_ShouldReturnMethodSignature() public class VoidMethodWith4Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { int callCount = 0; @@ -1780,9 +1780,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(callCount).IsEqualTo(2); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1794,7 +1794,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2", "p3", "p4"); @@ -1804,7 +1804,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("void Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1817,7 +1817,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("void Method4(1, 2, 3, 4)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1836,7 +1836,7 @@ await That(result) public class VoidMethodWith5Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { int callCount = 0; @@ -1851,9 +1851,9 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(callCount).IsEqualTo(2); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallCount) { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1865,7 +1865,7 @@ public async Task Setup_ShouldBeVerifiable(int firstParameter, int expectedCallC await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task ToString_AnyParameters_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameters setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", Match.AnyParameters(), "p1", "p2", "p3", "p4", "p5"); @@ -1875,7 +1875,7 @@ public async Task ToString_AnyParameters_ShouldReturnMethodSignature() await That(result).IsEqualTo("void Foo(Match.AnyParameters())"); } - [Fact] + [Test] public async Task ToString_ShouldIncludeParameterValues() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -1888,7 +1888,7 @@ public async Task ToString_ShouldIncludeParameterValues() await That(setup.ToString()).IsEqualTo("void Method5(1, 2, 3, 4, 5)"); } - [Fact] + [Test] public async Task ToString_ShouldReturnMethodSignature() { VoidMethodSetup.WithParameterCollection setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo", @@ -1908,7 +1908,7 @@ await That(result) public class MethodWithDefaultParameter { - [Fact] + [Test] public async Task ParametersWithDefaultAsDefaultValue_ShouldNotHaveAnyErrors() { IMethodSetupWithDefaultParameter sut = IMethodSetupWithDefaultParameter.CreateMock(); @@ -2080,7 +2080,7 @@ public interface IVoidMethodSetupTest void UniqueMethodWith5Parameters(int p1, int p2, int p3, int p4, int p5); } - [Fact] + [Test] public async Task ReturnMethodWith17Parameters_ShouldStillAllowCallbackAndReturns() { int isCalled = 0; @@ -2102,7 +2102,7 @@ public async Task ReturnMethodWith17Parameters_ShouldStillAllowCallbackAndReturn await That(result).IsEqualTo(153); } - [Fact] + [Test] public async Task ReturnMethodWith18Parameters_ShouldStillAllowCallbackAndReturns() { int isCalled = 0; @@ -2124,7 +2124,7 @@ public async Task ReturnMethodWith18Parameters_ShouldStillAllowCallbackAndReturn await That(result).IsEqualTo(171); } - [Fact] + [Test] public async Task VoidMethodWith17Parameters_ShouldStillAllowCallbackAndReturns() { int isCalled = 0; @@ -2143,7 +2143,7 @@ public async Task VoidMethodWith17Parameters_ShouldStillAllowCallbackAndReturns( await That(isCalled).IsEqualTo(1); } - [Fact] + [Test] public async Task VoidMethodWith18Parameters_ShouldStillAllowCallbackAndReturns() { int isCalled = 0; diff --git a/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.SpanTests.cs b/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.SpanTests.cs index 80ec6a459..080b5ad53 100644 --- a/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.SpanTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.SpanTests.cs @@ -6,7 +6,7 @@ public sealed partial class VerifyInvokedTests { public sealed class SpanTests { - [Fact] + [Test] public async Task Memory_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -18,7 +18,7 @@ public async Task Memory_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify.MyMethod(It.Satisfies>(v => v.Length == 4))).Never(); } - [Fact] + [Test] public async Task Memory_WithoutPredicate_ShouldApplyAllCalls() { SpanMock sut = SpanMock.CreateMock(); @@ -30,7 +30,7 @@ public async Task Memory_WithoutPredicate_ShouldApplyAllCalls() await That(sut.Mock.Verify.MyMethod(It.IsAny>())).Twice(); } - [Fact] + [Test] public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -42,7 +42,7 @@ public async Task ReadOnlySpan_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify.MyMethod(It.IsReadOnlySpan(v => v.Length == 4))).Never(); } - [Fact] + [Test] public async Task ReadOnlySpan_WithoutPredicate_ShouldApplyAllCalls() { SpanMock sut = SpanMock.CreateMock(); @@ -54,7 +54,7 @@ public async Task ReadOnlySpan_WithoutPredicate_ShouldApplyAllCalls() await That(sut.Mock.Verify.MyMethod(It.IsAnyReadOnlySpan())).Twice(); } - [Fact] + [Test] public async Task Span_WhenPredicateMatches_ShouldApplySetup() { SpanMock sut = SpanMock.CreateMock(); @@ -66,7 +66,7 @@ public async Task Span_WhenPredicateMatches_ShouldApplySetup() await That(sut.Mock.Verify.MyMethod(It.IsSpan(v => v.Length == 4))).Never(); } - [Fact] + [Test] public async Task Span_WithoutPredicate_ShouldApplyAllCalls() { SpanMock sut = SpanMock.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.cs b/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.cs index b9b397ea5..097fa3127 100644 --- a/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.cs +++ b/Tests/Mockolate.Tests/MockMethods/VerifyInvokedTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests.MockMethods; public sealed partial class VerifyInvokedTests { - [Fact] + [Test] public async Task Equals_ShouldWork() { object obj = new(); @@ -17,7 +17,7 @@ public async Task Equals_ShouldWork() await That(sut.Mock.Verify.Equals(It.Is(obj))).Once(); } - [Fact] + [Test] public async Task Equals_ShouldWorkWithNull() { object? obj = null; @@ -28,7 +28,7 @@ public async Task Equals_ShouldWorkWithNull() await That(sut.Mock.Verify.Equals(It.Is(obj))).Once(); } - [Fact] + [Test] public async Task Equals_WithOtherOverload_ShouldWork() { object obj = new(); @@ -39,7 +39,7 @@ public async Task Equals_WithOtherOverload_ShouldWork() await That(sut.Mock.Verify.Equals(It.Is(obj))).Never(); } - [Fact] + [Test] public async Task GetHashCode_ShouldWork() { IMethodService sut = IMethodService.CreateMock(); @@ -49,9 +49,9 @@ public async Task GetHashCode_ShouldWork() await That(sut.Mock.Verify.GetHashCode()).Once(); } - [Theory] - [InlineData(-1, 0)] - [InlineData(1, 1)] + [Test] + [Arguments(-1, 0)] + [Arguments(1, 1)] public async Task InvokedSetup_ShouldVerifySameConditionAsSetup(int firstParameter, int expectedCallCount) { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -64,7 +64,7 @@ public async Task InvokedSetup_ShouldVerifySameConditionAsSetup(int firstParamet await That(sut.Mock.VerifySetup(setup)).Exactly(expectedCallCount); } - [Fact] + [Test] public async Task MethodWithDifferentName_ShouldNotMatch() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -75,7 +75,7 @@ public async Task MethodWithDifferentName_ShouldNotMatch() await That(sut.Mock.Verify.Subtract(It.IsAny(), It.IsAny())).Never(); } - [Fact] + [Test] public async Task MethodWithDifferentName_WithParameters_ShouldNotMatch() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -86,7 +86,7 @@ public async Task MethodWithDifferentName_WithParameters_ShouldNotMatch() await That(sut.Mock.Verify.Multiply(Match.AnyParameters())).Never(); } - [Fact] + [Test] public async Task MethodWithDifferentOverload_ShouldNotMatch() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -97,9 +97,9 @@ public async Task MethodWithDifferentOverload_ShouldNotMatch() await That(sut.Mock.Verify.Subtract(It.IsAny(), It.IsAny())).Never(); } - [Theory] - [InlineData(2)] - [InlineData(42)] + [Test] + [Arguments(2)] + [Arguments(42)] public async Task MethodWithReturnValue_ShouldBeRegistered(int numberOfInvocations) { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -113,7 +113,7 @@ public async Task MethodWithReturnValue_ShouldBeRegistered(int numberOfInvocatio await That(sut.Mock.Verify.Multiply(It.IsAny(), It.IsAny())).Exactly(numberOfInvocations); } - [Fact] + [Test] public async Task ToString_ShouldWork() { IMethodService sut = IMethodService.CreateMock(); @@ -123,9 +123,9 @@ public async Task ToString_ShouldWork() await That(sut.Mock.Verify.ToString()).Once(); } - [Theory] - [InlineData(2)] - [InlineData(42)] + [Test] + [Arguments(2)] + [Arguments(42)] public async Task VoidMethod_ShouldBeRegistered(int numberOfInvocations) { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -140,9 +140,9 @@ await That(sut.Mock.Verify.SetIsValid(It.IsAny(), It.IsAny?>()) .Exactly(numberOfInvocations); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task VoidMethod_ShouldThrowMockNotSetupExceptionWhenBehaviorIsSetToThrow( bool throwWhenNotSetup) { @@ -162,7 +162,7 @@ await That(Act).Throws().OnlyIf(throwWhenNotSetup) """); } - [Fact] + [Test] public async Task WhenBehaviorIsSetToThrow_ShouldThrowMockNotSetupException() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(MockBehavior.Default with @@ -181,7 +181,7 @@ await That(Act).Throws() """); } - [Fact] + [Test] public async Task WhenNotSetup_ShouldReturnDefaultValue() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -193,7 +193,7 @@ public async Task WhenNotSetup_ShouldReturnDefaultValue() public class ReturnMethodWith1Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -205,7 +205,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(sut.Mock.Verify.Method1(1).AnyParameters()).Twice(); } - [Fact] + [Test] public async Task WithExplicitParameter_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -216,7 +216,7 @@ public async Task WithExplicitParameter_ShouldWork() await That(sut.Mock.Verify.Method1(2)).Never(); } - [Fact] + [Test] public async Task WithIParameterOverload_ShouldStillWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -230,7 +230,7 @@ public async Task WithIParameterOverload_ShouldStillWork() public class ReturnMethodWith2Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -241,7 +241,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(sut.Mock.Verify.Method2(1, 2).AnyParameters()).Twice(); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -252,7 +252,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(sut.Mock.Verify.Method2(2, It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -263,7 +263,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(sut.Mock.Verify.Method2(It.IsAny(), 2)).Never(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -278,7 +278,7 @@ public async Task WithExplicitParameters_ShouldWork() public class ReturnMethodWith3Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -289,7 +289,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(sut.Mock.Verify.Method3(1, 2, 3).AnyParameters()).Twice(); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -300,7 +300,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(sut.Mock.Verify.Method3(2, It.IsAny(), It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -311,7 +311,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(sut.Mock.Verify.Method3(It.IsAny(), 2, It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -322,7 +322,7 @@ public async Task WithExplicitParameter3_ShouldWork() await That(sut.Mock.Verify.Method3(It.IsAny(), It.IsAny(), 2)).Never(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -338,7 +338,7 @@ public async Task WithExplicitParameters_ShouldWork() public class ReturnMethodWith5Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -349,7 +349,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(sut.Mock.Verify.Method5(1, 2, 3, 4, 5).AnyParameters()).Twice(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -367,7 +367,7 @@ public async Task WithExplicitParameters_ShouldWork() public class ReturnMethodWith4Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -378,7 +378,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() await That(sut.Mock.Verify.Method4(1, 2, 3, 4).AnyParameters()).Twice(); } - [Fact] + [Test] public async Task WithExplicitParameter1_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -389,7 +389,7 @@ public async Task WithExplicitParameter1_ShouldWork() await That(sut.Mock.Verify.Method4(2, It.IsAny(), It.IsAny(), It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter2_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -400,7 +400,7 @@ public async Task WithExplicitParameter2_ShouldWork() await That(sut.Mock.Verify.Method4(It.IsAny(), 2, It.IsAny(), It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter3_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -411,7 +411,7 @@ public async Task WithExplicitParameter3_ShouldWork() await That(sut.Mock.Verify.Method4(It.IsAny(), It.IsAny(), 2, It.IsAny())).Never(); } - [Fact] + [Test] public async Task WithExplicitParameter4_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -422,7 +422,7 @@ public async Task WithExplicitParameter4_ShouldWork() await That(sut.Mock.Verify.Method4(It.IsAny(), It.IsAny(), It.IsAny(), 2)).Never(); } - [Fact] + [Test] public async Task WithExplicitParameters_ShouldWork() { IReturnMethodSetupTest sut = IReturnMethodSetupTest.CreateMock(); @@ -439,7 +439,7 @@ public async Task WithExplicitParameters_ShouldWork() public class VoidMethodWith1Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -453,7 +453,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() public class VoidMethodWith2Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -467,7 +467,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() public class VoidMethodWith3Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -481,7 +481,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() public class VoidMethodWith4Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); @@ -495,7 +495,7 @@ public async Task AnyParameters_ShouldIgnoreExplicitParameters() public class VoidMethodWith5Parameters { - [Fact] + [Test] public async Task AnyParameters_ShouldIgnoreExplicitParameters() { IVoidMethodSetupTest sut = IVoidMethodSetupTest.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockProperties/InteractionsTests.ThrowingBaseTests.cs b/Tests/Mockolate.Tests/MockProperties/InteractionsTests.ThrowingBaseTests.cs index a2a1436da..5c03b153b 100644 --- a/Tests/Mockolate.Tests/MockProperties/InteractionsTests.ThrowingBaseTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/InteractionsTests.ThrowingBaseTests.cs @@ -4,7 +4,7 @@ public sealed partial class InteractionsTests { public sealed class ThrowingBaseTests { - [Fact] + [Test] public async Task VirtualPropertyGetter_WhenBaseThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordAccess() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -18,7 +18,7 @@ void Act() await That(sut.Mock.Verify.Value.Got()).Once(); } - [Fact] + [Test] public async Task VirtualPropertyGetter_WhenBaseThrows_ShouldStillExecuteOnGetCallback() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -34,7 +34,7 @@ void Act() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task VirtualPropertyGetter_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -48,7 +48,7 @@ void Act() await That(sut.Mock.Verify.Value.Got()).Once(); } - [Fact] + [Test] public async Task VirtualPropertySetter_WhenBaseThrows_AndSkipBaseClass_ShouldNotThrow_AndShouldRecordAccess() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(MockBehavior.Default.SkippingBaseClass()); @@ -62,7 +62,7 @@ void Act() await That(sut.Mock.Verify.Value.Set(It.Is(42))).Once(); } - [Fact] + [Test] public async Task VirtualPropertySetter_WhenBaseThrows_ShouldStillExecuteOnSetCallback() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); @@ -78,7 +78,7 @@ void Act() await That(receivedValue).IsEqualTo(42); } - [Fact] + [Test] public async Task VirtualPropertySetter_WhenBaseThrows_ShouldStillRecordAccess() { ThrowingBaseService sut = ThrowingBaseService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockProperties/InteractionsTests.cs b/Tests/Mockolate.Tests/MockProperties/InteractionsTests.cs index 872faf002..4c48ac9b3 100644 --- a/Tests/Mockolate.Tests/MockProperties/InteractionsTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/InteractionsTests.cs @@ -2,7 +2,7 @@ namespace Mockolate.Tests.MockProperties; public sealed partial class InteractionsTests { - [Fact] + [Test] public async Task PropertyGetterAccess_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -13,7 +13,7 @@ public async Task PropertyGetterAccess_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task PropertySetterAccess_ToString_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); @@ -24,7 +24,7 @@ public async Task PropertySetterAccess_ToString_ShouldReturnExpectedValue() await That(interaction.ToString()).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task PropertySetterAccess_ToString_WithNull_ShouldReturnExpectedValue() { FastMockInteractions interactions = new(0); diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.AccessorRestrictedTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.AccessorRestrictedTests.cs index 03faec94d..447c36533 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.AccessorRestrictedTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.AccessorRestrictedTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Mockolate.Setup; +using Mockolate.Tests.TestHelpers; namespace Mockolate.Tests.MockProperties; @@ -7,7 +8,7 @@ public sealed partial class SetupPropertyTests { public sealed class AccessorRestrictedTests { - [Fact] + [Test] public async Task SetOnlyProperty_OnSet_ShouldFireAndRecordTheWrite() { IAccessorService sut = IAccessorService.CreateMock(); @@ -21,7 +22,7 @@ await That(sut.Mock.Verify.WriteOnly.Set("Ada")).Once() .Because("the setter facade must be keyed on the setter member id, not the getter's"); } - [Fact] + [Test] public async Task SetOnlyProperty_VerifyOtherValue_ShouldNotMatch() { IAccessorService sut = IAccessorService.CreateMock(); @@ -31,7 +32,7 @@ public async Task SetOnlyProperty_VerifyOtherValue_ShouldNotMatch() await That(sut.Mock.Verify.WriteOnly.Set("Grace")).Never(); } - [Fact] + [Test] public async Task SetOnlyProperty_VerifyWithParameterMatcher_ShouldMatch() { IAccessorService sut = IAccessorService.CreateMock(); @@ -41,7 +42,7 @@ public async Task SetOnlyProperty_VerifyWithParameterMatcher_ShouldMatch() await That(sut.Mock.Verify.WriteOnly.Set(It.IsAny())).Once(); } - [Fact] + [Test] public async Task SetOnlyProperty_Register_ShouldAllowWriteWithoutSetup() { IAccessorService sut = IAccessorService.CreateMock(MockBehavior.Default.ThrowingWhenNotSetup()); @@ -52,7 +53,7 @@ public async Task SetOnlyProperty_Register_ShouldAllowWriteWithoutSetup() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task GetOnlyProperty_Register_ShouldAllowReadWithoutSetup() { IAccessorService sut = IAccessorService.CreateMock(MockBehavior.Default.ThrowingWhenNotSetup()); @@ -64,9 +65,9 @@ public async Task GetOnlyProperty_Register_ShouldAllowReadWithoutSetup() await That(sut.Mock.Verify.ReadOnly.Got()).Once(); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task SetOnlyClassProperty_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { @@ -78,7 +79,7 @@ public async Task SetOnlyClassProperty_ShouldSkipCallingBaseWhenRequested(bool s await That(sut.WriteOnlySetterCallCount).IsEqualTo(expectedCallCount); } - [Fact] + [Test] public async Task GetOnlyProperty_ChainedReturns_ShouldStayOnGetterOnlySurface() { IAccessorService sut = IAccessorService.CreateMock(); @@ -90,7 +91,7 @@ public async Task GetOnlyProperty_ChainedReturns_ShouldStayOnGetterOnlySurface() await That(sut.ReadOnly).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyProperty_ReturnsForever_ShouldUseTheLastValueForever() { IAccessorService sut = IAccessorService.CreateMock(); @@ -107,7 +108,7 @@ public async Task GetOnlyProperty_ReturnsForever_ShouldUseTheLastValueForever() await That(result).IsEqualTo([2, 4, 4, 4,]); } - [Fact] + [Test] public async Task GetOnlyProperty_ReturnsWhen_ShouldOnlyUseValueWhenPredicateIsTrue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -121,7 +122,7 @@ public async Task GetOnlyProperty_ReturnsWhen_ShouldOnlyUseValueWhenPredicateIsT await That(result2).IsEqualTo(4); } - [Fact] + [Test] public async Task GetOnlyProperty_ReturnsCallbackWithValue_ShouldReturnExpectedValue() { IAccessorService sut = IAccessorService.CreateMock(); @@ -134,7 +135,7 @@ public async Task GetOnlyProperty_ReturnsCallbackWithValue_ShouldReturnExpectedV await That(result).IsEqualTo(12); } - [Fact] + [Test] public async Task GetOnlyProperty_Throws_ShouldIterateThroughAllRegisteredExceptions() { IAccessorService sut = IAccessorService.CreateMock(); @@ -147,15 +148,15 @@ public async Task GetOnlyProperty_Throws_ShouldIterateThroughAllRegisteredExcept void Act() => _ = sut.ReadOnly; await That(Act).Throws(); - Exception? result2 = Record.Exception(Act); - Exception? result3 = Record.Exception(Act); - Exception? result4 = Record.Exception(Act); + Exception? result2 = Catch.Exception(Act); + Exception? result3 = Catch.Exception(Act); + Exception? result4 = Catch.Exception(Act); await That(result2).HasMessage("foo"); await That(result3).HasMessage("bar"); await That(result4).HasMessage("baz-0"); } - [Fact] + [Test] public async Task GetOnlyProperty_OnGetChain_ShouldStayOnGetterOnlySurface() { int callCount1 = 0; @@ -175,7 +176,7 @@ public async Task GetOnlyProperty_OnGetChain_ShouldStayOnGetterOnlySurface() await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task GetOnlyProperty_OnGetWhen_ShouldOnlyInvokeCallbackWhenPredicateIsTrue() { int callCount = 0; @@ -190,7 +191,7 @@ public async Task GetOnlyProperty_OnGetWhen_ShouldOnlyInvokeCallbackWhenPredicat await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyProperty_OnGetInParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -212,7 +213,7 @@ public async Task GetOnlyProperty_OnGetInParallel_ShouldInvokeParallelCallbacksA await That(callCount3).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyProperty_OnGetFor_ShouldRepeatCallbackTheGivenNumberOfTimes() { int callCount1 = 0; @@ -231,7 +232,7 @@ public async Task GetOnlyProperty_OnGetFor_ShouldRepeatCallbackTheGivenNumberOfT await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyProperty_OnGetTransitionTo_ShouldSwitchScenario() { IAccessorService sut = IAccessorService.CreateMock(); @@ -245,7 +246,7 @@ public async Task GetOnlyProperty_OnGetTransitionTo_ShouldSwitchScenario() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task SetOnlyProperty_OnSetChain_ShouldStayOnSetterOnlySurface() { int callCount1 = 0; @@ -265,7 +266,7 @@ public async Task SetOnlyProperty_OnSetChain_ShouldStayOnSetterOnlySurface() await That(callCount2).IsEqualTo(1); } - [Fact] + [Test] public async Task SetOnlyProperty_OnSetWhen_ShouldOnlyInvokeCallbackWhenPredicateIsTrue() { int callCount = 0; @@ -280,7 +281,7 @@ public async Task SetOnlyProperty_OnSetWhen_ShouldOnlyInvokeCallbackWhenPredicat await That(callCount).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyProperty_OnSetInParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -302,7 +303,7 @@ public async Task SetOnlyProperty_OnSetInParallel_ShouldInvokeParallelCallbacksA await That(callCount3).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyProperty_OnSetFor_ShouldRepeatCallbackTheGivenNumberOfTimes() { int callCount1 = 0; @@ -321,7 +322,7 @@ public async Task SetOnlyProperty_OnSetFor_ShouldRepeatCallbackTheGivenNumberOfT await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task SetOnlyProperty_OnSetTransitionTo_ShouldSwitchScenario() { IAccessorService sut = IAccessorService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.InitializeWithTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.InitializeWithTests.cs index d0b73bd68..4e01c0104 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.InitializeWithTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.InitializeWithTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupPropertyTests { public sealed class InitializeWithTests { - [Fact] + [Test] public async Task Returns_PredicateIsFalse_ShouldUseInitializedDefaultValue() { List results = []; @@ -28,7 +28,7 @@ public async Task Returns_PredicateIsFalse_ShouldUseInitializedDefaultValue() await That(results).IsEqualTo([2, 2, -3, -3, 4, 4, 4,]); } - [Fact] + [Test] public async Task WhenRead_ShouldReturnInitializedValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -39,7 +39,7 @@ public async Task WhenRead_ShouldReturnInitializedValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task WhenSet_ShouldUpdateValue_ShouldReturnInitializedValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -53,7 +53,7 @@ public async Task WhenSet_ShouldUpdateValue_ShouldReturnInitializedValue() await That(result2).IsEqualTo(100); } - [Fact] + [Test] public async Task WithNull_ShouldReturnNull() { IPropertyService sut = IPropertyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnGetTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnGetTests.cs index 2cc3942c8..06d283782 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnGetTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnGetTests.cs @@ -7,9 +7,9 @@ public sealed partial class SetupPropertyTests { public sealed class OnGetTests { - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task For_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IPropertyService sut = IPropertyService.CreateMock(); @@ -24,7 +24,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task MultipleOnGet_InParallel_ShouldInvokeParallelCallbacksAlways() { int callCount1 = 0; @@ -51,10 +51,10 @@ public async Task MultipleOnGet_InParallel_ShouldInvokeParallelCallbacksAlways() await That(callCount3).IsEqualTo(6); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task MultipleOnGet_Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -78,7 +78,7 @@ public async Task MultipleOnGet_Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTi await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MultipleOnGet_OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -102,7 +102,7 @@ public async Task MultipleOnGet_OnlyOnce_ShouldDeactivateCallbackAfterFirstExecu await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task MultipleOnGet_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -126,9 +126,9 @@ public async Task MultipleOnGet_ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6); } - [Theory] - [InlineData(-2)] - [InlineData(0)] + [Test] + [Arguments(-2)] + [Arguments(0)] public async Task Only_LessThanOne_ShouldThrowArgumentOutOfRangeException(int times) { IPropertyService sut = IPropertyService.CreateMock(); @@ -143,7 +143,7 @@ await That(Act).Throws() .WithMessage("Times must be greater than zero.").AsPrefix(); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -159,7 +159,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -177,7 +177,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task ShouldExecuteWhenPropertyIsRead() { int callCount = 0; @@ -191,7 +191,7 @@ public async Task ShouldExecuteWhenPropertyIsRead() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ShouldIncludeIncrementingAccessCounter() { List invocations = []; @@ -207,7 +207,7 @@ public async Task ShouldIncludeIncrementingAccessCounter() await That(invocations).IsEqualTo([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]); } - [Fact] + [Test] public async Task ShouldNotExecuteWhenPropertyIsWrittenToOrOtherPropertyIsRead() { int callCount = 0; @@ -222,7 +222,7 @@ public async Task ShouldNotExecuteWhenPropertyIsWrittenToOrOtherPropertyIsRead() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -240,7 +240,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([40, 50, 60, 70, 80,]); } - [Fact] + [Test] public async Task WithoutCallback_IPropertyGetterSetupCallbackBuilder_ShouldNotThrow() { IPropertyService sut = IPropertyService.CreateMock(); @@ -267,7 +267,7 @@ void ActInParallel() await That(ActInParallel).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IPropertyGetterSetupCallbackWhenBuilder_ShouldNotThrow() { IPropertyService sut = IPropertyService.CreateMock(); @@ -288,7 +288,7 @@ void ActOnly() await That(ActOnly).DoesNotThrow(); } - [Fact] + [Test] public async Task WithValue_ShouldExecuteWhenPropertyIsRead() { int callCount = 0; @@ -309,7 +309,7 @@ public async Task WithValue_ShouldExecuteWhenPropertyIsRead() await That(receivedValue).IsEqualTo(4); } - [Fact] + [Test] public async Task WithValue_ShouldNotExecuteWhenPropertyIsWrittenToOrOtherPropertyIsRead() { int callCount = 0; diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnSetTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnSetTests.cs index a3327a8e9..1dbb2cbde 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnSetTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.OnSetTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupPropertyTests { public sealed class OnSetTests { - [Fact] + [Test] public async Task MultipleOnSet_InParallel_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -30,10 +30,10 @@ public async Task MultipleOnSet_InParallel_ShouldInvokeCallbacksInSequence() await That(callCount3).IsEqualTo(6 + 10); } - [Theory] - [InlineData(1, 1)] - [InlineData(2, 3)] - [InlineData(3, 6)] + [Test] + [Arguments(1, 1)] + [Arguments(2, 3)] + [Arguments(3, 6)] public async Task MultipleOnSet_Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTimes(int times, int expectedValue) { @@ -52,7 +52,7 @@ public async Task MultipleOnSet_Only_ShouldInvokeCallbacksOnlyTheGivenNumberOfTi await That(sum).IsEqualTo(expectedValue); } - [Fact] + [Test] public async Task MultipleOnSet_OnlyOnce_ShouldDeactivateCallbackAfterFirstExecution() { int callCount1 = 0; @@ -72,7 +72,7 @@ public async Task MultipleOnSet_OnlyOnce_ShouldDeactivateCallbackAfterFirstExecu await That(callCount2).IsEqualTo(2); } - [Fact] + [Test] public async Task MultipleOnSet_ShouldInvokeCallbacksInSequence() { int callCount1 = 0; @@ -93,7 +93,7 @@ public async Task MultipleOnSet_ShouldInvokeCallbacksInSequence() await That(callCount2).IsEqualTo(6 + 10); } - [Fact] + [Test] public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -110,7 +110,7 @@ public async Task Only_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([0, 1, 2, 3,]); } - [Fact] + [Test] public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() { List invocations = []; @@ -128,7 +128,7 @@ public async Task Only_WithWhen_ShouldStopExecutingCallbackAfterTheGivenTimes() await That(invocations).IsEqualTo([3, 4, 5, 6,]); } - [Fact] + [Test] public async Task ShouldExecuteWhenPropertyIsWrittenTo() { int callCount = 0; @@ -142,7 +142,7 @@ public async Task ShouldExecuteWhenPropertyIsWrittenTo() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ShouldNotExecuteWhenPropertyIsReadOrOtherPropertyIsWrittenTo() { int callCount = 0; @@ -157,7 +157,7 @@ public async Task ShouldNotExecuteWhenPropertyIsReadOrOtherPropertyIsWrittenTo() await That(callCount).IsEqualTo(0); } - [Fact] + [Test] public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() { List invocations = []; @@ -174,7 +174,7 @@ public async Task When_ShouldOnlyExecuteCallbackWhenInvocationCountMatches() await That(invocations).IsEqualTo([4, 5, 6, 7, 8,]); } - [Fact] + [Test] public async Task WithIndexAndValue_ShouldExecuteWhenPropertyIsWrittenTo() { List receivedIndexes = []; @@ -197,7 +197,7 @@ public async Task WithIndexAndValue_ShouldExecuteWhenPropertyIsWrittenTo() await That(receivedValues).IsEqualTo([6, 8, 10,]); } - [Fact] + [Test] public async Task WithValue_ShouldExecuteWhenPropertyIsWrittenTo() { int receivedNewValue = 0; @@ -218,7 +218,7 @@ public async Task WithValue_ShouldExecuteWhenPropertyIsWrittenTo() await That(receivedNewValue).IsEqualTo(6); } - [Fact] + [Test] public async Task WithValue_ShouldNotExecuteWhenPropertyIsReadOrOtherPropertyIsWrittenTo() { int callCount = 0; diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.RegisterTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.RegisterTests.cs index eef62d658..20e32ff65 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.RegisterTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.RegisterTests.cs @@ -6,7 +6,7 @@ public sealed partial class SetupPropertyTests { public sealed class RegisterTests { - [Fact] + [Test] public async Task AccessWithoutSetup_ShouldThrowMockNotSetupException() { IPropertyService mock = IPropertyService.CreateMock(MockBehavior.Default.ThrowingWhenNotSetup()); @@ -21,7 +21,7 @@ await That(Act).Throws() "The property 'global::Mockolate.Tests.MockProperties.SetupPropertyTests.IPropertyService.MyStringProperty' was accessed without prior setup."); } - [Fact] + [Test] public async Task RegisterBeforeAccess_ShouldNotThrowAndReturnDefaultValue() { IPropertyService sut = IPropertyService.CreateMock(MockBehavior.Default.ThrowingWhenNotSetup()); diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.ReturnsThrowsTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.ReturnsThrowsTests.cs index c7b6f33da..77b143732 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.ReturnsThrowsTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.ReturnsThrowsTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Mockolate.Setup; +using Mockolate.Tests.TestHelpers; namespace Mockolate.Tests.MockProperties; @@ -7,7 +8,7 @@ public sealed partial class SetupPropertyTests { public sealed class ReturnsThrowsTests { - [Fact] + [Test] public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() { IPropertyService sut = IPropertyService.CreateMock(); @@ -18,7 +19,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() .Returns(() => 2); int result1 = sut.MyProperty; - Exception? result2 = Record.Exception(() => _ = sut.MyProperty); + Exception? result2 = Catch.Exception(() => _ = sut.MyProperty); int result3 = sut.MyProperty; await That(result1).IsEqualTo(4); @@ -26,7 +27,7 @@ public async Task MixReturnsAndThrows_ShouldIterateThroughBoth() await That(result3).IsEqualTo(2); } - [Fact] + [Test] public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() { IPropertyService sut = IPropertyService.CreateMock(); @@ -45,7 +46,7 @@ public async Task MultipleReturns_ShouldIterateThroughAllRegisteredValues() await That(result).IsEqualTo([4, 3, 30, 4, 3, 30, 4, 3, 30, 4,]); } - [Fact] + [Test] public async Task Returns_Callback_ShouldReturnExpectedValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -58,7 +59,7 @@ public async Task Returns_Callback_ShouldReturnExpectedValue() await That(result).IsEqualTo(4); } - [Fact] + [Test] public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -72,7 +73,7 @@ public async Task Returns_CallbackWithValue_ShouldReturnExpectedValue() await That(result).IsEqualTo(12); } - [Fact] + [Test] public async Task Returns_CallbackWithWhen_ShouldReturnDefaultValueWhenPredicateIsFalse() { IPropertyService sut = IPropertyService.CreateMock(); @@ -87,7 +88,7 @@ public async Task Returns_CallbackWithWhen_ShouldReturnDefaultValueWhenPredicate await That(result2).IsEqualTo(4); } - [Fact] + [Test] public async Task Returns_For_OnlyOnce_ShouldLimitUsage_ToSpecifiedNumber() { IPropertyService sut = IPropertyService.CreateMock(); @@ -106,7 +107,7 @@ public async Task Returns_For_OnlyOnce_ShouldLimitUsage_ToSpecifiedNumber() await That(values).IsEqualTo(["foo", "foo", "bar", "bar", "bar", "-", "-", "-", "-", "-", "-",]); } - [Fact] + [Test] public async Task Returns_For_ShouldRepeatUsage_ToSpecifiedNumber() { IPropertyService sut = IPropertyService.CreateMock(); @@ -126,7 +127,7 @@ await That(values) .IsEqualTo(["foo", "foo", "bar", "bar", "bar", "foo", "foo", "bar", "bar", "bar", "foo",]); } - [Fact] + [Test] public async Task Returns_Forever_ShouldUseTheLastValueForever() { IPropertyService sut = IPropertyService.CreateMock(); @@ -145,7 +146,7 @@ public async Task Returns_Forever_ShouldUseTheLastValueForever() await That(result).IsEqualTo([2, 3, 4, 4, 4, 4, 4, 4, 4, 4,]); } - [Fact] + [Test] public async Task Returns_OnlyOnce_ShouldKeepLastUsedValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -164,7 +165,7 @@ public async Task Returns_OnlyOnce_ShouldKeepLastUsedValue() await That(values).IsEqualTo([1, 1, 1, 1, 1, 10, 10, 10, 10, 10,]); } - [Fact] + [Test] public async Task Returns_OnlyOnce_ShouldUseReturnValueOnlyOnce() { IPropertyService sut = IPropertyService.CreateMock(); @@ -180,7 +181,7 @@ public async Task Returns_OnlyOnce_ShouldUseReturnValueOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task Returns_PredicateIsFalse_ShouldUseInitializedDefaultValue() { List results = []; @@ -201,7 +202,7 @@ public async Task Returns_PredicateIsFalse_ShouldUseInitializedDefaultValue() await That(results).IsEqualTo([0, 0, -3, -3, 4, 4, 4,]); } - [Fact] + [Test] public async Task Returns_ShouldReturnExpectedValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -214,7 +215,7 @@ public async Task Returns_ShouldReturnExpectedValue() await That(result).IsEqualTo(4); } - [Fact] + [Test] public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -231,7 +232,7 @@ public async Task Returns_When_ShouldOnlyUseValueWhenPredicateIsTrue() await That(result3).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Returns_WhenFor_ShouldLimitUsage_ToSpecifiedNumber() { IPropertyService sut = IPropertyService.CreateMock(); @@ -252,7 +253,7 @@ await That(values).IsEqualTo([ ]); } - [Fact] + [Test] public async Task Returns_WithoutSetup_ShouldReturnDefault() { IPropertyService sut = IPropertyService.CreateMock(); @@ -262,7 +263,7 @@ public async Task Returns_WithoutSetup_ShouldReturnDefault() await That(result).IsEqualTo(0); } - [Fact] + [Test] public async Task Throws_Callback_ShouldThrowException() { IPropertyService sut = IPropertyService.CreateMock(); @@ -278,7 +279,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task Throws_CallbackWithValue_ShouldThrowException() { IPropertyService sut = IPropertyService.CreateMock(); @@ -295,7 +296,7 @@ void Act() await That(Act).Throws().WithMessage("foo-42"); } - [Fact] + [Test] public async Task Throws_Generic_ShouldThrowException() { IPropertyService sut = IPropertyService.CreateMock(); @@ -311,7 +312,7 @@ void Act() await That(Act).ThrowsExactly(); } - [Fact] + [Test] public async Task Throws_ShouldThrowException() { IPropertyService sut = IPropertyService.CreateMock(); @@ -327,7 +328,7 @@ void Act() await That(Act).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task WithoutCallback_IPropertySetupReturnBuilder_ShouldNotThrow() { IPropertyService sut = IPropertyService.CreateMock(); @@ -348,7 +349,7 @@ void ActFor() await That(ActFor).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutCallback_IPropertySetupReturnWhenBuilder_ShouldNotThrow() { IPropertyService sut = IPropertyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.SkippingBaseClassTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.SkippingBaseClassTests.cs index 5d1da05f1..dedfaaff6 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.SkippingBaseClassTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.SkippingBaseClassTests.cs @@ -4,9 +4,9 @@ public sealed partial class SetupPropertyTests { public sealed class SkippingBaseClassTests { - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyProperty_Getter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { MyPropertyService sut = MyPropertyService.CreateMock(); @@ -17,9 +17,9 @@ public async Task MyProperty_Getter_ShouldSkipCallingBaseWhenRequested(bool skip await That(sut.MyPropertyGetterCallCount).IsEqualTo(expectedCallCount); } - [Theory] - [InlineData(false, 1)] - [InlineData(true, 0)] + [Test] + [Arguments(false, 1)] + [Arguments(true, 0)] public async Task MyProperty_Setter_ShouldSkipCallingBaseWhenRequested(bool skipBaseClass, int expectedCallCount) { MyPropertyService sut = MyPropertyService.CreateMock(); @@ -30,7 +30,7 @@ public async Task MyProperty_Setter_ShouldSkipCallingBaseWhenRequested(bool skip await That(sut.MyPropertySetterCallCount).IsEqualTo(expectedCallCount); } - [Fact] + [Test] public async Task SetupSkippingBaseClassWithoutParameter_ShouldReturnDefaultValue() { MyPropertyService sut = MyPropertyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.cs b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.cs index 76aca9dfd..5076d24e4 100644 --- a/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/SetupPropertyTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests.MockProperties; public sealed partial class SetupPropertyTests { - [Fact] + [Test] public async Task InvokeGetter_InvalidType_ShouldFallBackToDefaultValueGenerator() { MyPropertySetup setup = new(); @@ -15,7 +15,7 @@ public async Task InvokeGetter_InvalidType_ShouldFallBackToDefaultValueGenerator await That(result).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task InvokeSetter_InvalidType_ShouldThrowMockException() { MyPropertySetup setup = new(); @@ -31,7 +31,7 @@ await That(Act).Throws() """); } - [Fact] + [Test] public async Task Register_AfterInvocation_ShouldBeAppliedForFutureUse() { IPropertyService sut = IPropertyService.CreateMock(); @@ -47,7 +47,7 @@ public async Task Register_AfterInvocation_ShouldBeAppliedForFutureUse() await That(result1).IsEqualTo(42); } - [Fact] + [Test] public async Task Register_MultipleProperties_ShouldAllStoreValues() { IPropertyService sut = IPropertyService.CreateMock(); @@ -70,7 +70,7 @@ public async Task Register_MultipleProperties_ShouldAllStoreValues() await That(myOtherResult2).IsEqualTo(20); } - [Fact] + [Test] public async Task Register_SamePropertyTwice_ShouldOverwritePreviousSetup() { IPropertyService sut = IPropertyService.CreateMock(); @@ -92,7 +92,7 @@ public async Task Register_SamePropertyTwice_ShouldOverwritePreviousSetup() await That(result4).IsEqualTo(6); } - [Fact] + [Test] public async Task SetProperty_ShouldNotReinitializeSetupOnRepeatedCalls() { IPropertyService sut = IPropertyService.CreateMock(); @@ -107,7 +107,7 @@ public async Task SetProperty_ShouldNotReinitializeSetupOnRepeatedCalls() await That(setup.InitializeValueCallCount).IsEqualTo(1); } - [Fact] + [Test] public async Task ShouldStoreLastValue() { IPropertyService sut = IPropertyService.CreateMock(); @@ -123,7 +123,7 @@ public async Task ShouldStoreLastValue() await That(result2).IsEmpty(); } - [Fact] + [Test] public async Task ToString_ShouldReturnType() { PropertySetup setup = new(new MockRegistry(MockBehavior.Default, new FastMockInteractions(0)), "Foo"); @@ -133,7 +133,7 @@ public async Task ToString_ShouldReturnType() await That(result).IsEqualTo("int Foo"); } - [Fact] + [Test] public async Task WhenMockInheritsPropertyMultipleTimes() { IMyPropertyService sut = IMyPropertyService.CreateMock().Implementing(); diff --git a/Tests/Mockolate.Tests/MockProperties/VerifyGotTests.cs b/Tests/Mockolate.Tests/MockProperties/VerifyGotTests.cs index 5ae768102..cd35d0487 100644 --- a/Tests/Mockolate.Tests/MockProperties/VerifyGotTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/VerifyGotTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockProperties; public sealed class VerifyGotTests { - [Fact] + [Test] public async Task ShouldIncreaseInvocationCountOfGetter() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -15,7 +15,7 @@ public async Task ShouldIncreaseInvocationCountOfGetter() await That(sut.Mock.Verify.Counter.Set(It.IsAny())).Never(); } - [Fact] + [Test] public async Task ShouldReturnInitializedValue() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -26,9 +26,9 @@ public async Task ShouldReturnInitializedValue() await That(result).IsEqualTo(24); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task ShouldThrowMockNotSetupExceptionWhenBehaviorIsSetToThrow(bool throwWhenNotSetup) { MockTests.IMyService sut = MockTests.IMyService.CreateMock(MockBehavior.Default with diff --git a/Tests/Mockolate.Tests/MockProperties/VerifySetTests.cs b/Tests/Mockolate.Tests/MockProperties/VerifySetTests.cs index 76645e531..aa8b5944b 100644 --- a/Tests/Mockolate.Tests/MockProperties/VerifySetTests.cs +++ b/Tests/Mockolate.Tests/MockProperties/VerifySetTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests.MockProperties; public sealed class VerifySetTests { - [Fact] + [Test] public async Task Set_WithExplicitParameter_ShouldCheckForEquality() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -16,7 +16,7 @@ public async Task Set_WithExplicitParameter_ShouldCheckForEquality() await That(sut.Mock.Verify.Counter.Set(43)).Never(); } - [Fact] + [Test] public async Task Set_WithExplicitReferenceTypeParameter_ShouldCheckForEquality() { IServiceWithStringProperty sut = IServiceWithStringProperty.CreateMock(); @@ -27,7 +27,7 @@ public async Task Set_WithExplicitReferenceTypeParameter_ShouldCheckForEquality( await That(sut.Mock.Verify.Name.Set("hello")).Once(); } - [Fact] + [Test] public async Task ShouldIncreaseInvocationCountOfGetter() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -38,9 +38,9 @@ public async Task ShouldIncreaseInvocationCountOfGetter() await That(sut.Mock.Verify.Counter.Set(It.IsAny())).Once(); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task ShouldThrowMockNotSetupExceptionWhenBehaviorIsSetToThrow(bool throwWhenNotSetup) { MockTests.IMyService sut = MockTests.IMyService.CreateMock(MockBehavior.Default with @@ -59,7 +59,7 @@ await That(Act).Throws().OnlyIf(throwWhenNotSetup) """); } - [Fact] + [Test] public async Task ShouldUpdateValueForNextGet() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); @@ -72,7 +72,7 @@ public async Task ShouldUpdateValueForNextGet() await That(result2).IsEqualTo(5); } - [Fact] + [Test] public async Task WithNull_ShouldUpdateValueForNextGet() { MockTests.IMyService sut = MockTests.IMyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockRegistryTests.cs b/Tests/Mockolate.Tests/MockRegistryTests.cs index 1cb685f18..3849072cd 100644 --- a/Tests/Mockolate.Tests/MockRegistryTests.cs +++ b/Tests/Mockolate.Tests/MockRegistryTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Tests; public sealed class MockRegistryTests { - [Fact] + [Test] public async Task AddEvent_WithoutMemberIdAndMatchingSetup_ShouldInvokeSubscribedCallback() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -22,7 +22,7 @@ public async Task AddEvent_WithoutMemberIdAndMatchingSetup_ShouldInvokeSubscribe await That(subscribed).IsEqualTo(1); } - [Fact] + [Test] public async Task GetProperty_WhenBaseValueAccessorThrows_ShouldRethrowException() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -36,7 +36,7 @@ void Act() await That(Act).Throws().WithMessage("base failed"); } - [Fact] + [Test] public async Task GetUnusedSetups_IndexerSetup_ShouldHaveCorrectString() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -49,7 +49,7 @@ public async Task GetUnusedSetups_IndexerSetup_ShouldHaveCorrectString() await That(setup.ToString()).IsEqualTo("int this[\"Dark\"]"); } - [Fact] + [Test] public async Task GetUnusedSetups_MethodSetup_ShouldHaveCorrectString() { IMyService sut = IMyService.CreateMock(); @@ -62,7 +62,7 @@ public async Task GetUnusedSetups_MethodSetup_ShouldHaveCorrectString() await That(setup.ToString()).IsEqualTo("void DoSomething(null, 3.5, It.IsAny())"); } - [Fact] + [Test] public async Task GetUnusedSetups_PropertySetup_ShouldHaveCorrectString() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -75,7 +75,7 @@ public async Task GetUnusedSetups_PropertySetup_ShouldHaveCorrectString() await That(setup.ToString()).IsEqualTo("int TotalDispensed"); } - [Fact] + [Test] public async Task GetUnusedSetups_WithNullableDouble_ShouldHaveCorrectString() { IMyService sut = IMyService.CreateMock(); @@ -88,7 +88,7 @@ public async Task GetUnusedSetups_WithNullableDouble_ShouldHaveCorrectString() await That(setup.ToString()).IsEqualTo("void DoSomething(04/01/2026 12:00:00, 3.5)"); } - [Fact] + [Test] public async Task RegisterInteraction_ShouldBeThreadSafe() { MockRegistry sut = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -110,7 +110,7 @@ public async Task RegisterInteraction_ShouldBeThreadSafe() await That(sut.Interactions.Count).IsEqualTo(1000); } - [Fact] + [Test] public async Task RemoveEvent_WithoutMemberIdAndMatchingSetup_ShouldInvokeUnsubscribedCallback() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -124,7 +124,7 @@ public async Task RemoveEvent_WithoutMemberIdAndMatchingSetup_ShouldInvokeUnsubs await That(unsubscribed).IsEqualTo(1); } - [Fact] + [Test] public async Task SetProperty_WithMemberIdAndNoFastBuffer_ShouldRecordAndStore() { MockRegistry registry = new(MockBehavior.Default, new FastMockInteractions(0)); @@ -135,7 +135,7 @@ public async Task SetProperty_WithMemberIdAndNoFastBuffer_ShouldRecordAndStore() await That(registry.Interactions.Count).IsEqualTo(1); } - [Fact] + [Test] public async Task SetProperty_WithoutMemberId_SkippingBaseClass_ShouldReturnTrue() { MockBehavior behavior = MockBehavior.Default.SkippingBaseClass(); diff --git a/Tests/Mockolate.Tests/MockSetupsTests.cs b/Tests/Mockolate.Tests/MockSetupsTests.cs index 0b1d4160b..7e1055a32 100644 --- a/Tests/Mockolate.Tests/MockSetupsTests.cs +++ b/Tests/Mockolate.Tests/MockSetupsTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests; public sealed class MockSetupsTests { - [Fact] + [Test] public async Task ClearAllInteractions_ShouldRemovePreviousInteractions() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockTests.CreateTests.cs b/Tests/Mockolate.Tests/MockTests.CreateTests.cs index 93b6d30d6..3b5d204da 100644 --- a/Tests/Mockolate.Tests/MockTests.CreateTests.cs +++ b/Tests/Mockolate.Tests/MockTests.CreateTests.cs @@ -11,7 +11,7 @@ public sealed partial class MockTests { public sealed class CreateTests { - [Fact] + [Test] public async Task TypedOverload_ConstructorWithDecimalDefault_ShouldForwardExplicitValue() { // This test exercises the generator's default-value emission end-to-end: if the @@ -22,7 +22,7 @@ public async Task TypedOverload_ConstructorWithDecimalDefault_ShouldForwardExpli await That(sut.Price).IsEqualTo(42.50m); } - [Fact] + [Test] public async Task TypedOverload_ConstructorWithDefaultValue_ShouldApplyDefault() { MyBaseClassWithMultipleConstructors sut = MyBaseClassWithMultipleConstructors.CreateMock(42); @@ -31,7 +31,7 @@ public async Task TypedOverload_ConstructorWithDefaultValue_ShouldApplyDefault() await That(sut.Number).IsEqualTo(42); } - [Fact] + [Test] public async Task TypedOverload_MultipleConstructors_ShouldDispatchToMatchingConstructor() { MyBaseClassWithMultipleConstructors sutFromString = @@ -45,7 +45,7 @@ public async Task TypedOverload_MultipleConstructors_ShouldDispatchToMatchingCon await That(sutFromIntAndString.Number).IsEqualTo(42); } - [Fact] + [Test] public async Task TypedOverload_SingleConstructor_ShouldForwardToBaseClass() { MyBaseClassWithConstructor sut = MyBaseClassWithConstructor.CreateMock("foo"); @@ -53,7 +53,7 @@ public async Task TypedOverload_SingleConstructor_ShouldForwardToBaseClass() await That(sut.Text).IsEqualTo("foo"); } - [Fact] + [Test] public async Task TypedOverload_WithMockBehavior_ShouldUseBehavior() { MockBehavior behavior = MockBehavior.Default.ThrowingWhenNotSetup(); @@ -64,7 +64,7 @@ public async Task TypedOverload_WithMockBehavior_ShouldUseBehavior() await That(sut.Text).IsEqualTo("foo"); } - [Fact] + [Test] public async Task TypedOverload_WithMockBehaviorAndSetup_ShouldApplyBoth() { MockBehavior behavior = MockBehavior.Default; @@ -78,7 +78,7 @@ public async Task TypedOverload_WithMockBehaviorAndSetup_ShouldApplyBoth() await That(sut.VirtualMethod()).IsEqualTo("bar"); } - [Fact] + [Test] public async Task TypedOverload_WithSetup_ShouldApplySetup() { MyBaseClassWithConstructor sut = MyBaseClassWithConstructor.CreateMock( @@ -88,7 +88,7 @@ public async Task TypedOverload_WithSetup_ShouldApplySetup() await That(sut.VirtualMethod()).IsEqualTo("bar"); } - [Fact] + [Test] public async Task With2Arguments_OnlyFirstArgumentIsClass_ShouldForwardBehaviorToBaseClass() { MockBehavior behavior = MockBehavior.Default.ThrowingWhenNotSetup(); @@ -98,7 +98,7 @@ public async Task With2Arguments_OnlyFirstArgumentIsClass_ShouldForwardBehaviorT await That(((IMock)sut).MockRegistry.Behavior).IsSameAs(behavior); } - [Fact] + [Test] public async Task With2Arguments_WithConstructorParametersAndSetups_ShouldApplySetups() { MyBaseClassWithConstructor mock = MyBaseClassWithConstructor.CreateMock( @@ -110,7 +110,7 @@ public async Task With2Arguments_WithConstructorParametersAndSetups_ShouldApplyS await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task With2Arguments_WithConstructorParametersMockBehaviorAndSetups_ShouldApplySetups() { MyBaseClassWithConstructor sut = MyBaseClassWithConstructor.CreateMock( @@ -124,7 +124,7 @@ public async Task With2Arguments_WithConstructorParametersMockBehaviorAndSetups_ await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task With2Arguments_WithSetups_ShouldApplySetups() { IMyService sut = IMyService.CreateMock(setup => @@ -143,7 +143,7 @@ public async Task With2Arguments_WithSetups_ShouldApplySetups() await That(result3).IsEqualTo(8); } - [Fact] + [Test] public async Task WithAdditionalInterfacesFromDifferentNamespaces_ShouldHaveUniqueName() { int invocationCount1 = 0; @@ -187,7 +187,7 @@ await That(sut2.Mock.As().Verify /// public sealed class CreateSnapshotTests { - [Fact] + [Test] public async Task BaseClass_WithMultipleAdditionalInterfaces_CanBeCreated() { ComprehensiveAbstractClass sut = ComprehensiveAbstractClass.CreateMock() @@ -196,57 +196,57 @@ public async Task BaseClass_WithMultipleAdditionalInterfaces_CanBeCreated() await That(sut).IsNotNull(); } - [Fact] + [Test] public async Task ComprehensiveAbstractClass_CanBeCreated() { ComprehensiveAbstractClass sut = ComprehensiveAbstractClass.CreateMock(); await That(sut).IsNotNull(); } - [Fact] + [Test] public async Task ComprehensiveDelegate_CanBeCreated() { ComprehensiveDelegate sut = ComprehensiveDelegate.CreateMock(); await That(sut).IsNotNull(); } - [Fact] - public void ComprehensiveInterface_CanBeCreated() + [Test] + public async Task ComprehensiveInterface_CanBeCreated() { IComprehensiveInterface sut = IComprehensiveInterface.CreateMock(); - // Uses Assert.NotNull instead of `await That(sut)` because CS8920 forbids interfaces + // Casts to object instead of `await That(sut)` because CS8920 forbids interfaces // with unimplemented static abstract members as generic type arguments. - Assert.NotNull(sut); + await That((object)sut).IsNotNull(); } - [Fact] + [Test] public async Task HttpClient_CanBeCreated() { HttpClient sut = HttpClient.CreateMock(); await That(sut).IsNotNull(); } - [Fact] + [Test] public async Task KeywordEdgeCases_CanBeCreated() { IKeywordEdgeCases sut = IKeywordEdgeCases.CreateMock(); await That(sut).IsNotNull(); } - [Fact] + [Test] public async Task RefStructConsumer_CanBeCreated() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); await That(sut).IsNotNull(); } - [Fact] - public void StaticAbstractMembers_CanBeCreated() + [Test] + public async Task StaticAbstractMembers_CanBeCreated() { IStaticAbstractMembers sut = IStaticAbstractMembers.CreateMock(); - // Uses Assert.NotNull instead of `await That(sut)` because CS8920 forbids interfaces + // Casts to object instead of `await That(sut)` because CS8920 forbids interfaces // with unimplemented static abstract members as generic type arguments. - Assert.NotNull(sut); + await That((object)sut).IsNotNull(); } } #endif diff --git a/Tests/Mockolate.Tests/MockTests.HiddenInterfaceMemberTests.cs b/Tests/Mockolate.Tests/MockTests.HiddenInterfaceMemberTests.cs index 20e6c64b0..541163e9d 100644 --- a/Tests/Mockolate.Tests/MockTests.HiddenInterfaceMemberTests.cs +++ b/Tests/Mockolate.Tests/MockTests.HiddenInterfaceMemberTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockTests { public sealed class HiddenInterfaceMemberTests { - [Fact] + [Test] public async Task HiddenEvent_AsBase_ShouldVerifyBaseSlotSeparately() { IDerivedEvents mock = IDerivedEvents.CreateMock(); @@ -15,7 +15,7 @@ public async Task HiddenEvent_AsBase_ShouldVerifyBaseSlotSeparately() await That(mock.Mock.Verify.Changed.Subscribed()).Never(); } - [Fact] + [Test] public async Task HiddenIndexer_AsBase_ShouldVerifyBaseAccess() { IDerivedIndexer mock = IDerivedIndexer.CreateMock(); @@ -27,7 +27,7 @@ await That(mock.Mock.As().Verify[It.IsAny()].Got()).Once() "indexers are keyed by their parameter signature rather than the declaring interface, so base and derived access share storage and As reaches the same recorded interaction"); } - [Fact] + [Test] public async Task HiddenMethod_AsBase_ShouldConfigureAndVerifyBaseSlotSeparately() { IDerivedService mock = IDerivedService.CreateMock(); @@ -40,7 +40,7 @@ public async Task HiddenMethod_AsBase_ShouldConfigureAndVerifyBaseSlotSeparately await That(mock.Mock.As().Verify.GetValue()).Once(); } - [Fact] + [Test] public async Task HiddenProperty_AsBase_ShouldReadBaseSlot() { IDerivedProperty mock = IDerivedProperty.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockTests.ImplementedInterfaceTests.cs b/Tests/Mockolate.Tests/MockTests.ImplementedInterfaceTests.cs index bec213b18..2004b74ce 100644 --- a/Tests/Mockolate.Tests/MockTests.ImplementedInterfaceTests.cs +++ b/Tests/Mockolate.Tests/MockTests.ImplementedInterfaceTests.cs @@ -4,7 +4,7 @@ public sealed partial class MockTests { public sealed class ImplementedInterfaceTests { - [Fact] + [Test] public async Task NonVirtualMethod_ShouldBeConfigurableThroughTheInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -16,7 +16,7 @@ await That(mock.Add(1, 2)).IsEqualTo(3) await That(mock.Mock.As().Verify.Add(1, 2)).Once(); } - [Fact] + [Test] public async Task VirtualMethod_ShouldShareSetupBetweenClassAndInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -28,7 +28,7 @@ public async Task VirtualMethod_ShouldShareSetupBetweenClassAndInterface() await That(mock.Mock.As().Verify.Multiply(3, 4)).Twice(); } - [Fact] + [Test] public async Task VirtualMethod_SetupThroughInterface_ShouldApplyToClassCall() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -37,7 +37,7 @@ public async Task VirtualMethod_SetupThroughInterface_ShouldApplyToClassCall() await That(mock.Multiply(3, 4)).IsEqualTo(7); } - [Fact] + [Test] public async Task VirtualProperty_ShouldShareSetupBetweenClassAndInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -47,7 +47,7 @@ public async Task VirtualProperty_ShouldShareSetupBetweenClassAndInterface() await That(((ICalculator)mock).Precision).IsEqualTo(5); } - [Fact] + [Test] public async Task VirtualIndexer_ShouldShareSetupBetweenClassAndInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -57,7 +57,7 @@ public async Task VirtualIndexer_ShouldShareSetupBetweenClassAndInterface() await That(((ICalculator)mock)[1]).IsEqualTo(11); } - [Fact] + [Test] public async Task VirtualIndexer_ShouldShareStoredValuesBetweenClassAndInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -72,7 +72,7 @@ await That(((ICalculator)mock)[1]).IsEqualTo(5) await That(mock[2]).IsEqualTo(7); } - [Fact] + [Test] public async Task VirtualEvent_ShouldShareSubscriptionsBetweenClassAndInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -84,7 +84,7 @@ public async Task VirtualEvent_ShouldShareSubscriptionsBetweenClassAndInterface( await That(mock.Mock.As().Verify.Calculated.Subscribed()).Once(); } - [Fact] + [Test] public async Task VirtualMethodWithBody_ShouldFallBackToTheBaseImplementationThroughTheInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -98,7 +98,7 @@ await That(((ICalculator)mock).Subtract(5, 3)).IsEqualTo(2) await That(((ICalculator)mock).Subtract(5, 3)).IsEqualTo(42); } - [Fact] + [Test] public async Task RenamedGenericTypeParameter_ShouldShareSetupBetweenClassAndInterface() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -109,7 +109,7 @@ await That(((ICalculator)mock).Convert(1)).IsEqualTo(13) .Because("the name of a generic type parameter is not part of the member's identity"); } - [Fact] + [Test] public async Task ObliviousNullabilityOnTheReturnType_ShouldShareSetupBetweenClassAndInterface() { LegacyCalculator mock = LegacyCalculator.CreateMock().Implementing(); @@ -119,7 +119,7 @@ await That(((ILegacyCalculator)mock).Describe()).IsEqualTo("chocolate") .Because("the nullability annotation on the return type is not part of the member's identity"); } - [Fact] + [Test] public async Task InterfaceImplementedByABaseClass_ShouldShareSetupWithTheBaseClassMember() { DerivedCalculator mock = DerivedCalculator.CreateMock().Implementing(); @@ -130,7 +130,7 @@ await That(((ISquarer)mock).Square(2)).IsEqualTo(6) .Because("the base class member implements the interface, and the mock overrides it"); } - [Fact] + [Test] public async Task SealedOverrideImplementation_ShouldStayConfigurableThroughTheInterface() { SealingCalculator mock = SealingCalculator.CreateMock().Implementing(); @@ -142,7 +142,7 @@ await That(((ISquarer)mock).Square(2)).IsEqualTo(9) .Because("the interface slot is re-implemented, which is the only way to reach it"); } - [Fact] + [Test] public async Task VirtualEvent_RaisedThroughEitherSurface_ShouldInvokeHandlersFromBothSurfaces() { Calculator mock = Calculator.CreateMock().Implementing(); @@ -163,7 +163,7 @@ await That(classHandlerCalls).IsEqualTo(1) await That(interfaceHandlerCalls).IsEqualTo(2); } - [Fact] + [Test] public async Task GetOnlyInterfaceProperty_ImplementedWithGetterAndSetter_ShouldShareTheValue() { Thermometer mock = Thermometer.CreateMock().Implementing(); @@ -175,7 +175,7 @@ await That(((IReadOnlyThermometer)mock).Temperature).IsEqualTo(21) .Because("the class member implements the interface getter, so both surfaces read one value"); } - [Fact] + [Test] public async Task TwoAdditionalInterfaces_ImplementedByTheSameClassMember_ShouldShareOneMember() { Sensor mock = Sensor.CreateMock().Implementing().Implementing(); diff --git a/Tests/Mockolate.Tests/MockTests.StaticInterfaceMembersTests.cs b/Tests/Mockolate.Tests/MockTests.StaticInterfaceMembersTests.cs index b2c76860a..3917f6053 100644 --- a/Tests/Mockolate.Tests/MockTests.StaticInterfaceMembersTests.cs +++ b/Tests/Mockolate.Tests/MockTests.StaticInterfaceMembersTests.cs @@ -8,7 +8,7 @@ public sealed partial class MockTests { public sealed class StaticInterfaceMembersTests { - [Fact] + [Test] public async Task WithAbstractStaticEvent() { List receivedCalls = []; @@ -45,7 +45,7 @@ static void UnsubscribeAbstractStaticEvent(Action callback) } } - [Fact] + [Test] public async Task WithAbstractStaticEvent_ShouldWorkInParallel() { ConcurrentDictionary> receivedCalls = []; @@ -92,7 +92,7 @@ static void SubscribeAbstractStaticEvent(Action callback) } } - [Fact] + [Test] public async Task WithAbstractStaticMethod() { IMyServiceWithAbstractStaticMembers sut = IMyServiceWithAbstractStaticMembers.CreateMock(); @@ -113,7 +113,7 @@ public async Task WithAbstractStaticMethod() } } - [Fact] + [Test] public async Task WithAbstractStaticMethod_ShouldWorkInParallel() { Task[] tasks = new Task[20]; @@ -144,7 +144,7 @@ public async Task WithAbstractStaticMethod_ShouldWorkInParallel() } } - [Fact] + [Test] public async Task WithAbstractStaticProperty() { IMyServiceWithAbstractStaticMembers sut = IMyServiceWithAbstractStaticMembers.CreateMock(); @@ -165,7 +165,7 @@ public async Task WithAbstractStaticProperty() } } - [Fact] + [Test] public async Task WithAbstractStaticProperty_ShouldWorkInParallel() { Task[] tasks = new Task[20]; @@ -196,7 +196,7 @@ public async Task WithAbstractStaticProperty_ShouldWorkInParallel() } } - [Fact] + [Test] public async Task WithVirtualStaticMethod() { IMyServiceWithAbstractStaticMembers sut = IMyServiceWithAbstractStaticMembers.CreateMock(); @@ -217,7 +217,7 @@ public async Task WithVirtualStaticMethod() } } - [Fact] + [Test] public async Task WithVirtualStaticMethod_ShouldWorkInParallel() { Task[] tasks = new Task[20]; @@ -248,7 +248,7 @@ public async Task WithVirtualStaticMethod_ShouldWorkInParallel() } } - [Fact] + [Test] public async Task WithVirtualStaticProperty() { IMyServiceWithAbstractStaticMembers sut = IMyServiceWithAbstractStaticMembers.CreateMock(); @@ -269,7 +269,7 @@ public async Task WithVirtualStaticProperty() } } - [Fact] + [Test] public async Task WithVirtualStaticProperty_ShouldWorkInParallel() { Task[] tasks = new Task[20]; @@ -302,7 +302,7 @@ public async Task WithVirtualStaticProperty_ShouldWorkInParallel() public sealed class CombinationTests { - [Fact] + [Test] public async Task StaticBase_WithExtraInterface_ShouldDispatchStaticEvent() { List receivedCalls = []; @@ -337,7 +337,7 @@ static void Unsubscribe(Action callback) } } - [Fact] + [Test] public async Task StaticBase_WithExtraInterface_ShouldDispatchStaticMethod() { IServiceWithAllStaticAbstracts sut = IServiceWithAllStaticAbstracts.CreateMock() @@ -357,7 +357,7 @@ static int CallStaticMethod() } } - [Fact] + [Test] public async Task StaticBase_WithExtraInterface_ShouldDispatchStaticProperty() { IServiceWithAllStaticAbstracts sut = IServiceWithAllStaticAbstracts.CreateMock() diff --git a/Tests/Mockolate.Tests/MockTests.ThreadSafetyTests.cs b/Tests/Mockolate.Tests/MockTests.ThreadSafetyTests.cs index b6cd35ccd..f30b6fdbf 100644 --- a/Tests/Mockolate.Tests/MockTests.ThreadSafetyTests.cs +++ b/Tests/Mockolate.Tests/MockTests.ThreadSafetyTests.cs @@ -8,7 +8,7 @@ public sealed partial class MockTests { public sealed class ThreadSafetyTests { - [Fact] + [Test] public async Task Event_ShouldBeThreadSafe() { IMyThreadSafetyService sut = IMyThreadSafetyService.CreateMock(); @@ -37,7 +37,7 @@ public async Task Event_ShouldBeThreadSafe() await That(sut.Mock.Verify.MyEvent.Unsubscribed()).Exactly(taskCount * iterationsPerTask); } - [Fact] + [Test] public async Task Event_SubscribeRaiseUnsubscribe_ShouldBeThreadSafe() { for (int round = 0; round < 10; round++) @@ -97,7 +97,7 @@ public async Task Event_SubscribeRaiseUnsubscribe_ShouldBeThreadSafe() } } - [Fact] + [Test] public async Task Indexer_ManyKeys_ShouldBeThreadSafe() { for (int round = 0; round < 5; round++) @@ -178,7 +178,7 @@ await That(valuesByKey).All().Satisfy(kvp => } } - [Fact] + [Test] public async Task Indexer_ShouldBeThreadSafe() { IMyThreadSafetyService sut = IMyThreadSafetyService.CreateMock(); @@ -227,7 +227,7 @@ public async Task Indexer_ShouldBeThreadSafe() await That(values).Contains("hello").Exactly(readerCount * iterationsPerReader * 2); } - [Fact] + [Test] public async Task Method_HighContention_ShouldBeThreadSafe() { for (int round = 0; round < 10; round++) @@ -260,7 +260,7 @@ public async Task Method_HighContention_ShouldBeThreadSafe() } } - [Fact] + [Test] public async Task Method_ShouldBeThreadSafe() { IMyThreadSafetyService sut = IMyThreadSafetyService.CreateMock(); @@ -289,7 +289,7 @@ public async Task Method_ShouldBeThreadSafe() await That(values).Contains(42).Exactly(taskCount * iterationsPerTask); } - [Fact] + [Test] public async Task Property_ConcurrentSetupAndRead_ShouldBeThreadSafe() { for (int round = 0; round < 10; round++) @@ -346,7 +346,7 @@ await That(sut.MyGuidProperty).IsEqualTo(expectedGuid) } } - [Fact] + [Test] public async Task Property_HighContention_ShouldBeThreadSafe() { for (int round = 0; round < 10; round++) @@ -379,7 +379,7 @@ public async Task Property_HighContention_ShouldBeThreadSafe() } } - [Fact] + [Test] public async Task Property_ShouldBeThreadSafe() { IMyThreadSafetyService sut = IMyThreadSafetyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/MockTests.WrappingClassTests.cs b/Tests/Mockolate.Tests/MockTests.WrappingClassTests.cs index 69de1c8dd..9e2e89139 100644 --- a/Tests/Mockolate.Tests/MockTests.WrappingClassTests.cs +++ b/Tests/Mockolate.Tests/MockTests.WrappingClassTests.cs @@ -7,7 +7,7 @@ public sealed partial class MockTests { public sealed class WrappingClassTests { - [Fact] + [Test] public async Task Wrap_ClassWithoutParameterlessConstructor_ShouldDelegateToWrappedInstance() { ServiceWithConstructor myService = new("real"); @@ -19,7 +19,7 @@ public async Task Wrap_ClassWithoutParameterlessConstructor_ShouldDelegateToWrap await That(wrappedService.Mock.Verify.Format("value")).Once(); } - [Fact] + [Test] public async Task Wrap_Events_ForwardEventsFromWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -40,7 +40,7 @@ public async Task Wrap_Events_ForwardEventsFromWrappedInstance() await That(eventAmount).IsEqualTo(3); } - [Fact] + [Test] public async Task Wrap_Events_ForwardsFromWrapper() { MyChocolateDispenser myDispenser = new(); @@ -61,7 +61,7 @@ public async Task Wrap_Events_ForwardsFromWrapper() await That(eventAmount).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_Events_Unsubscribe_ShouldRemoveSubscription() { MyChocolateDispenser myDispenser = new(); @@ -91,7 +91,7 @@ void Handler(string type, int amount) } } - [Fact] + [Test] public async Task Wrap_Indexer_ShouldDelegateToWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -105,7 +105,7 @@ public async Task Wrap_Indexer_ShouldDelegateToWrappedInstance() await That(myDispenser["White"]).IsEqualTo(8); } - [Fact] + [Test] public async Task Wrap_Method_ShouldDelegateToWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -118,7 +118,7 @@ public async Task Wrap_Method_ShouldDelegateToWrappedInstance() await That(myDispenser["Dark"]).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_Property_ShouldDelegateToWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -130,7 +130,7 @@ public async Task Wrap_Property_ShouldDelegateToWrappedInstance() await That(myDispenser.TotalDispensed).IsEqualTo(12); } - [Fact] + [Test] public async Task Wrap_WithSetup_ShouldOverrideMethod() { MyChocolateDispenser myDispenser = new(); @@ -144,7 +144,7 @@ public async Task Wrap_WithSetup_ShouldOverrideMethod() await That(myDispenser.TotalDispensed).IsEqualTo(4); } - [Fact] + [Test] public async Task Wrapping_ShouldIgnoreProtectedMembers() { ServiceWithProtectedMembers myClass = new(); diff --git a/Tests/Mockolate.Tests/MockTests.WrappingInterfaceTests.cs b/Tests/Mockolate.Tests/MockTests.WrappingInterfaceTests.cs index 0bfc1cf4f..4ab35fb69 100644 --- a/Tests/Mockolate.Tests/MockTests.WrappingInterfaceTests.cs +++ b/Tests/Mockolate.Tests/MockTests.WrappingInterfaceTests.cs @@ -7,7 +7,7 @@ public sealed partial class MockTests { public sealed class WrappingInterfaceTests { - [Fact] + [Test] public async Task Wrap_Events_ForwardEventsFromWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -28,7 +28,7 @@ public async Task Wrap_Events_ForwardEventsFromWrappedInstance() await That(eventAmount).IsEqualTo(3); } - [Fact] + [Test] public async Task Wrap_Events_ForwardsFromWrapper() { MyChocolateDispenser myDispenser = new(); @@ -49,7 +49,7 @@ public async Task Wrap_Events_ForwardsFromWrapper() await That(eventAmount).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_Events_Unsubscribe_ShouldRemoveSubscription() { MyChocolateDispenser myDispenser = new(); @@ -79,7 +79,7 @@ void Handler(string type, int amount) } } - [Fact] + [Test] public async Task Wrap_HiddenEvent_ShouldSubscribeOnDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -97,7 +97,7 @@ public async Task Wrap_HiddenEvent_ShouldSubscribeOnDeclaringInterface() await That(shelfInvocations).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_HiddenGenericMethod_ShouldDelegateToDeclaringInterface() { MyChocolateCatalog myCatalog = new(); @@ -109,7 +109,7 @@ public async Task Wrap_HiddenGenericMethod_ShouldDelegateToDeclaringInterface() await That(myCatalog.ReceivedCalls).IsEqualTo(["catalog", "source",]); } - [Fact] + [Test] public async Task Wrap_HiddenGetOnlyProperty_ShouldDelegateToDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -120,7 +120,7 @@ public async Task Wrap_HiddenGetOnlyProperty_ShouldDelegateToDeclaringInterface( await That(myShelf.ReceivedCalls).IsEqualTo(["get:shelf-featured", "get:base-featured",]); } - [Fact] + [Test] public async Task Wrap_HiddenIndexer_ShouldDelegateGetterToDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -131,7 +131,7 @@ public async Task Wrap_HiddenIndexer_ShouldDelegateGetterToDeclaringInterface() await That(myShelf.ReceivedCalls).IsEqualTo(["get:shelf-item", "get:base-item",]); } - [Fact] + [Test] public async Task Wrap_HiddenIndexer_ShouldDelegateSetterToDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -145,7 +145,7 @@ public async Task Wrap_HiddenIndexer_ShouldDelegateSetterToDeclaringInterface() await That(myShelf.BaseItems[2]).IsEqualTo(["Marzipan",]); } - [Fact] + [Test] public async Task Wrap_HiddenProperty_ShouldDelegateGetterToDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -156,7 +156,7 @@ public async Task Wrap_HiddenProperty_ShouldDelegateGetterToDeclaringInterface() await That(myShelf.ReceivedCalls).IsEqualTo(["get:shelf", "get:base",]); } - [Fact] + [Test] public async Task Wrap_HiddenProperty_ShouldDelegateSetterToDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -170,7 +170,7 @@ public async Task Wrap_HiddenProperty_ShouldDelegateSetterToDeclaringInterface() await That(myShelf.BaseAssortment).IsEqualTo(["Ganache",]); } - [Fact] + [Test] public async Task Wrap_HiddenPropertyWithUnrelatedType_ShouldDelegateToDeclaringInterface() { MyChocolateShelf myShelf = new(); @@ -185,7 +185,7 @@ public async Task Wrap_HiddenPropertyWithUnrelatedType_ShouldDelegateToDeclaring await That(myShelf.BaseLabel).IsEqualTo("Seasonal"); } - [Fact] + [Test] public async Task Wrap_Indexer_ShouldDelegateToWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -199,7 +199,7 @@ public async Task Wrap_Indexer_ShouldDelegateToWrappedInstance() await That(myDispenser["White"]).IsEqualTo(8); } - [Fact] + [Test] public async Task Wrap_Method_ShouldDelegateToWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -212,7 +212,7 @@ public async Task Wrap_Method_ShouldDelegateToWrappedInstance() await That(myDispenser["Dark"]).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_Property_ShouldDelegateToWrappedInstance() { MyChocolateDispenser myDispenser = new(); @@ -224,7 +224,7 @@ public async Task Wrap_Property_ShouldDelegateToWrappedInstance() await That(myDispenser.TotalDispensed).IsEqualTo(12); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceEvent_ShouldSubscribeOnDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -242,7 +242,7 @@ public async Task Wrap_SiblingInterfaceEvent_ShouldSubscribeOnDeclaringInterface await That(boxInvocations).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceEvent_ShouldUnsubscribeOnDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -263,7 +263,7 @@ public async Task Wrap_SiblingInterfaceEvent_ShouldUnsubscribeOnDeclaringInterfa await That(boxInvocations).IsEqualTo(1); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceIndexer_ShouldDelegateGetterToDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -274,7 +274,7 @@ public async Task Wrap_SiblingInterfaceIndexer_ShouldDelegateGetterToDeclaringIn await That(myGiftSet.ReceivedCalls).IsEqualTo(["get:tray-slot", "get:box-slot",]); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceIndexer_ShouldDelegateSetterToDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -288,7 +288,7 @@ public async Task Wrap_SiblingInterfaceIndexer_ShouldDelegateSetterToDeclaringIn await That(myGiftSet.BoxSlots[2]).IsEqualTo(70); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceMethod_ShouldDelegateToDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -302,7 +302,7 @@ public async Task Wrap_SiblingInterfaceMethod_ShouldDelegateToDeclaringInterface await That(myGiftSet.ReceivedCalls).IsEqualTo(["count:tray", "count:box",]); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceProperty_ShouldDelegateGetterToDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -313,7 +313,7 @@ public async Task Wrap_SiblingInterfaceProperty_ShouldDelegateGetterToDeclaringI await That(myGiftSet.ReceivedCalls).IsEqualTo(["get:tray", "get:box",]); } - [Fact] + [Test] public async Task Wrap_SiblingInterfaceProperty_ShouldDelegateSetterToDeclaringInterface() { MyChocolateGiftSet myGiftSet = new(); @@ -327,7 +327,7 @@ public async Task Wrap_SiblingInterfaceProperty_ShouldDelegateSetterToDeclaringI await That(myGiftSet.BoxFlavor).IsEqualTo("White"); } - [Fact] + [Test] public async Task Wrap_WithSetup_ShouldOverrideMethod() { MyChocolateDispenser myDispenser = new(); diff --git a/Tests/Mockolate.Tests/MockTests.cs b/Tests/Mockolate.Tests/MockTests.cs index 91e21a622..78a7d680c 100644 --- a/Tests/Mockolate.Tests/MockTests.cs +++ b/Tests/Mockolate.Tests/MockTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests; public sealed partial class MockTests { - [Fact] + [Test] public async Task Create_BaseClassWithMultipleConstructors() { void Act() @@ -16,7 +16,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Create_BaseClassWithoutConstructor_ShouldThrowMockException() { void Act() @@ -28,7 +28,7 @@ await That(Act).Throws() .WithMessage("This method should not be called directly. Either 'Mockolate.Tests.MockTests+MyBaseClassWithoutConstructor' is not mockable or the source generator did not run correctly."); } - [Fact] + [Test] public async Task Create_BaseClassWithVirtualCallsInConstructor_AllowExplicitSetup() { MyServiceBaseWithVirtualCallsInConstructor sut = @@ -40,7 +40,7 @@ public async Task Create_BaseClassWithVirtualCallsInConstructor_AllowExplicitSet await That(value).IsEqualTo(5); } - [Fact] + [Test] public async Task Create_BaseClassWithVirtualCallsInConstructor_WithUseBaseClassAsDefaultValue_ShouldUseBaseClassValuesInConstructor() { @@ -52,7 +52,7 @@ public async Task await That(value).IsEqualTo(1); } - [Fact] + [Test] public async Task Create_SealedClass_ImplementingAdditionalInterface_ShouldThrowMockException() { void Act() @@ -67,7 +67,7 @@ await That(Act).Throws() "This method should not be called directly. Either 'Mockolate.Tests.MockTests+MySealedClass' is not mockable or the source generator did not run correctly."); } - [Fact] + [Test] public async Task Create_SealedClass_ShouldThrowMockException() { void Act() @@ -82,7 +82,7 @@ await That(Act).Throws() "This method should not be called directly. Either 'Mockolate.Tests.MockTests+MySealedClass' is not mockable or the source generator did not run correctly."); } - [Fact] + [Test] public async Task Create_WithConstructorParameters_SealedClass_ShouldThrowMockException() { void Act() @@ -97,7 +97,7 @@ await That(Act).Throws() "This method should not be called directly. Either 'Mockolate.Tests.MockTests+MySealedClass' is not mockable or the source generator did not run correctly."); } - [Fact] + [Test] public async Task Create_WithConstructorParametersAndSetups_ShouldApplySetups() { MyBaseClassWithConstructor mock = MyBaseClassWithConstructor.CreateMock( @@ -109,7 +109,7 @@ public async Task Create_WithConstructorParametersAndSetups_ShouldApplySetups() await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Create_WithConstructorParametersMockBehaviorAndSetups_ShouldApplySetups() { MyBaseClassWithConstructor mock = MyBaseClassWithConstructor.CreateMock( @@ -122,7 +122,7 @@ public async Task Create_WithConstructorParametersMockBehaviorAndSetups_ShouldAp await That(result).IsEqualTo("bar"); } - [Fact] + [Test] public async Task Create_WithMatchingParameters_ShouldCreateMock() { MyBaseClassWithConstructor Act() @@ -133,7 +133,7 @@ MyBaseClassWithConstructor Act() await That(Act).DoesNotThrow().WhoseResult.IsNotNull(); } - [Fact] + [Test] public async Task Create_WithMockBehavior_SealedClass_ShouldThrowMockException() { void Act() @@ -148,7 +148,7 @@ await That(Act).Throws() "This method should not be called directly. Either 'Mockolate.Tests.MockTests+MySealedClass' is not mockable or the source generator did not run correctly."); } - [Fact] + [Test] public async Task Create_WithRequiredParameters_WithEmptyParameters_ShouldThrowMockException() { void Act() @@ -161,7 +161,7 @@ await That(Act).Throws() "No parameterless constructor found for 'Mockolate.Tests.MockTests.MyBaseClassWithConstructor'. Please provide constructor parameters."); } - [Fact] + [Test] public async Task Create_WithRequiredParameters_WithoutParameters_ShouldThrowMockException() { void Act() @@ -174,7 +174,7 @@ await That(Act).Throws() "No parameterless constructor found for 'Mockolate.Tests.MockTests.MyBaseClassWithConstructor'. Please provide constructor parameters."); } - [Fact] + [Test] public async Task Create_WithSetups_ShouldAllowChangingTheSetupSubjectInCallback() { IChocolateDispenser mock = IChocolateDispenser.CreateMock(setup => setup.Dispense(It.IsAny(), It.IsAny()) @@ -187,7 +187,7 @@ public async Task Create_WithSetups_ShouldAllowChangingTheSetupSubjectInCallback await That(remaining).IsEqualTo(7); } - [Fact] + [Test] public async Task Create_WithSetups_ShouldApplySetups() { IMyService mock = IMyService.CreateMock(setup => @@ -206,7 +206,7 @@ public async Task Create_WithSetups_ShouldApplySetups() await That(result3).IsEqualTo(8); } - [Fact] + [Test] public async Task Create_WithTooManyParameters_ShouldThrowMockException() { void Act() @@ -219,7 +219,7 @@ await That(Act).Throws() "Could not find any constructor for 'Mockolate.Tests.MockTests.MyBaseClassWithConstructor' that matches the 3 given parameters (foo, 1, 2)."); } - [Fact] + [Test] public async Task DoubleNestedInterfaces_ShouldStillWork() { Nested.Nested2.IMyDoubleNestedService sut = Nested.Nested2.IMyDoubleNestedService.CreateMock(); @@ -230,7 +230,7 @@ public async Task DoubleNestedInterfaces_ShouldStillWork() await That(result).IsTrue(); } - [Fact] + [Test] public async Task GenericMethodWithWhereClause_ShouldWork() { IMyServiceWithGenericMethodsWithWhereClause sut = IMyServiceWithGenericMethodsWithWhereClause.CreateMock(); @@ -243,7 +243,7 @@ public async Task GenericMethodWithWhereClause_ShouldWork() await That(sut.Mock.Verify.MyMethod(It.IsTrue())).Once(); } - [Fact] + [Test] public async Task GenericMethodWithWhereClause_WhenImplementingAdditionalInterface_ShouldWork() { IChocolateDispenser sut = IChocolateDispenser.CreateMock() @@ -258,7 +258,7 @@ public async Task GenericMethodWithWhereClause_WhenImplementingAdditionalInterfa await That(sut.Mock.As().Verify.MyMethod(It.IsTrue())).Once(); } - [Fact] + [Test] public async Task ToString_ShouldReturnImplementedType() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -268,7 +268,7 @@ public async Task ToString_ShouldReturnImplementedType() await That(result).IsEqualTo("Mockolate.Tests.TestHelpers.IChocolateDispenser mock"); } - [Fact] + [Test] public async Task ToString_WithAdditionalImplementations_ShouldReturnImplementedType() { IChocolateDispenser sut = IChocolateDispenser.CreateMock().Implementing(); @@ -278,7 +278,7 @@ public async Task ToString_WithAdditionalImplementations_ShouldReturnImplemented await That(result).IsEqualTo("Mockolate.Tests.TestHelpers.IChocolateDispenser mock that also implements Mockolate.Tests.MockTests.IMyService"); } - [Fact] + [Test] public async Task TypeWithMockRegistryMembers_ShouldUseUniqueName() { IServiceWithMockRegistryMembers sut = IServiceWithMockRegistryMembers.CreateMock(); @@ -289,7 +289,7 @@ public async Task TypeWithMockRegistryMembers_ShouldUseUniqueName() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task WhenTypeHasMockAndMockolate_MockProperty_ShouldAppendNumbers() { MyInterfaceWithMockAndMockolate_MockProperty sut = MyInterfaceWithMockAndMockolate_MockProperty.CreateMock(); @@ -303,7 +303,7 @@ public async Task WhenTypeHasMockAndMockolate_MockProperty_ShouldAppendNumbers() await That(sut.Mockolate_Mock__1).IsEqualTo("foo"); } - [Fact] + [Test] public async Task WhenTypeHasMockProperty_ShouldUseMockolate_MockInstead() { MyInterfaceWithMockProperty sut = MyInterfaceWithMockProperty.CreateMock(); @@ -315,7 +315,7 @@ public async Task WhenTypeHasMockProperty_ShouldUseMockolate_MockInstead() await That(result).IsEqualTo(4); } - [Fact] + [Test] public async Task WithConstructorParameters_ShouldBeAccessibleViaMock() { MyBaseClassWithConstructor sut = MyBaseClassWithConstructor.CreateMock(["foo",]); @@ -325,7 +325,7 @@ public async Task WithConstructorParameters_ShouldBeAccessibleViaMock() await That(mock.MockRegistry.ConstructorParameters).HasCount(1).And.Contains("foo"); } - [Fact] + [Test] public async Task WithoutConstructorParameters_MockConstructorParametersShouldBeNull() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/Monitor/MockMonitorTests.cs b/Tests/Mockolate.Tests/Monitor/MockMonitorTests.cs index 4ab2845d3..eabdca0ae 100644 --- a/Tests/Mockolate.Tests/Monitor/MockMonitorTests.cs +++ b/Tests/Mockolate.Tests/Monitor/MockMonitorTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests.Monitor; public sealed class MockMonitorTests { - [Fact] + [Test] public async Task ClearAllInteractions_WhenMonitorIsRunning_ShouldClearInternalCollection() { IMyService sut = IMyService.CreateMock(); @@ -20,7 +20,7 @@ public async Task ClearAllInteractions_WhenMonitorIsRunning_ShouldClearInternalC await That(monitor.Verify.IsValid(It.Is(1))).Never(); } - [Fact] + [Test] public async Task DisposeTwice_ShouldNotIncludeMoreInvocations() { IMyService sut = IMyService.CreateMock(); @@ -48,7 +48,7 @@ public async Task DisposeTwice_ShouldNotIncludeMoreInvocations() await That(monitor.Verify.IsValid(It.Is(8))).Never(); } - [Fact] + [Test] public async Task MultipleRun_ShouldMonitorInvocationsDuringTheRun() { IMyService sut = IMyService.CreateMock(); @@ -85,7 +85,7 @@ public async Task MultipleRun_ShouldMonitorInvocationsDuringTheRun() await That(monitor.Verify.IsValid(It.Is(10))).Never(); } - [Fact] + [Test] public async Task NestedRun_ShouldThrowInvalidOperationException() { IMyService sut = IMyService.CreateMock(); @@ -106,7 +106,7 @@ await That(Act).Throws() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Run_ShouldIncludeAllInvocations() { IMyService sut = IMyService.CreateMock(); @@ -126,7 +126,7 @@ public async Task Run_ShouldIncludeAllInvocations() await That(monitor.Verify.IsValid(It.Is(4))).Once(); } - [Fact] + [Test] public async Task Run_ShouldMonitorInvocationsDuringTheRun() { IMyService sut = IMyService.CreateMock(); @@ -154,7 +154,7 @@ public async Task Run_ShouldMonitorInvocationsDuringTheRun() await That(sut.Mock.Verify.IsValid(It.Is(5))).Once(); } - [Fact] + [Test] public async Task Verify_WhileRunning_ShouldBeUpToDate() { IMyService sut = IMyService.CreateMock(); @@ -182,7 +182,7 @@ public async Task Verify_WhileRunning_ShouldBeUpToDate() } } - [Fact] + [Test] public async Task WhenMonitoringIsNotDisposed_ShouldStillVerify() { IMyService sut = IMyService.CreateMock(); @@ -203,7 +203,7 @@ public async Task WhenMonitoringIsNotDisposed_ShouldStillVerify() await That(monitor.Verify.IsValid(It.Is(6))).Never(); } - [Fact] + [Test] public async Task WhenSkippingInteractionRecording_Verify_ShouldThrow() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); diff --git a/Tests/Mockolate.Tests/OverlappingSetupsTests.cs b/Tests/Mockolate.Tests/OverlappingSetupsTests.cs index dc79013f4..9fa41a56b 100644 --- a/Tests/Mockolate.Tests/OverlappingSetupsTests.cs +++ b/Tests/Mockolate.Tests/OverlappingSetupsTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests; public sealed class OverlappingSetupsTests { - [Fact] + [Test] public async Task Indexer_NarrowMatcherDefinedLater_ShouldWinForMatchingArguments() { SetupIndexerTests.IIndexerService sut = SetupIndexerTests.IIndexerService.CreateMock(); @@ -21,7 +21,7 @@ public async Task Indexer_NarrowMatcherDefinedLater_ShouldWinForMatchingArgument await That(nonMatching).IsEqualTo("foo"); } - [Fact] + [Test] public async Task Method_BroadMatcherDefinedLater_ShouldWinEvenForArgumentsTheNarrowMatcherCovered() { SetupMethodTests.IMethodService sut = SetupMethodTests.IMethodService.CreateMock(); @@ -34,7 +34,7 @@ public async Task Method_BroadMatcherDefinedLater_ShouldWinEvenForArgumentsTheNa await That(previouslyNarrowMatch).IsEqualTo(1); } - [Fact] + [Test] public async Task Method_MostRecentlyDefinedSetup_ShouldWin_WhenMatchersOverlap() { SetupMethodTests.IMethodService sut = SetupMethodTests.IMethodService.CreateMock(); @@ -48,7 +48,7 @@ public async Task Method_MostRecentlyDefinedSetup_ShouldWin_WhenMatchersOverlap( await That(result).IsEqualTo(3); } - [Fact] + [Test] public async Task Method_NarrowMatcherDefinedLater_ShouldWinForMatchingArguments() { SetupMethodTests.IMethodService sut = SetupMethodTests.IMethodService.CreateMock(); @@ -63,7 +63,7 @@ public async Task Method_NarrowMatcherDefinedLater_ShouldWinForMatchingArguments await That(nonMatching).IsEqualTo(1); } - [Fact] + [Test] public async Task Property_LaterReturnsCall_ShouldReplacePreviousSetup() { SetupPropertyTests.IPropertyService sut = SetupPropertyTests.IPropertyService.CreateMock(); diff --git a/Tests/Mockolate.Tests/Parameters/ParamsArrayParameterMatchTests.cs b/Tests/Mockolate.Tests/Parameters/ParamsArrayParameterMatchTests.cs index 214240c30..df1cba401 100644 --- a/Tests/Mockolate.Tests/Parameters/ParamsArrayParameterMatchTests.cs +++ b/Tests/Mockolate.Tests/Parameters/ParamsArrayParameterMatchTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests.Parameters; public sealed class ParamsArrayParameterMatchTests { - [Fact] + [Test] public async Task Matches_WhenLengthMatchesAndAllElementsSatisfy_ShouldReturnTrue() { StubParameter first = new(true, "first"); @@ -19,7 +19,7 @@ public async Task Matches_WhenLengthMatchesAndAllElementsSatisfy_ShouldReturnTru await That(second.MatchedValues).IsEqualTo([2,]); } - [Fact] + [Test] public async Task Matches_WhenAnElementFails_ShouldReturnFalse() { ParamsArrayParameterMatch sut = new(new StubParameter(true, "first"), new StubParameter(false, "second")); @@ -29,7 +29,7 @@ public async Task Matches_WhenAnElementFails_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task Matches_WhenLengthDiffers_ShouldReturnFalseWithoutInvokingMatchers() { StubParameter only = new(true, "only"); @@ -41,7 +41,7 @@ public async Task Matches_WhenLengthDiffers_ShouldReturnFalseWithoutInvokingMatc await That(only.MatchedValues).IsEmpty(); } - [Fact] + [Test] public async Task Matches_WhenValueIsNull_ShouldReturnFalse() { ParamsArrayParameterMatch sut = new(new StubParameter(true, "only")); @@ -51,7 +51,7 @@ public async Task Matches_WhenValueIsNull_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task Matches_WhenMatcherElementIsNull_ShouldReturnFalseWithoutThrowing() { ParamsArrayParameterMatch sut = new(new StubParameter(true, "first"), null!); @@ -61,7 +61,7 @@ public async Task Matches_WhenMatcherElementIsNull_ShouldReturnFalseWithoutThrow await That(result).IsFalse(); } - [Fact] + [Test] public async Task InvokeCallbacks_WhenLengthMatches_ShouldInvokeEachMatcher() { StubParameter first = new(true, "first"); @@ -74,7 +74,7 @@ public async Task InvokeCallbacks_WhenLengthMatches_ShouldInvokeEachMatcher() await That(second.InvokedValues).IsEqualTo([2,]); } - [Fact] + [Test] public async Task InvokeCallbacks_WhenLengthDiffers_ShouldNotInvokeMatchers() { StubParameter only = new(true, "only"); @@ -85,7 +85,7 @@ public async Task InvokeCallbacks_WhenLengthDiffers_ShouldNotInvokeMatchers() await That(only.InvokedValues).IsEmpty(); } - [Fact] + [Test] public async Task InvokeCallbacks_WhenValueIsNull_ShouldNotInvokeMatchers() { StubParameter only = new(true, "only"); @@ -96,7 +96,7 @@ public async Task InvokeCallbacks_WhenValueIsNull_ShouldNotInvokeMatchers() await That(only.InvokedValues).IsEmpty(); } - [Fact] + [Test] public async Task InvokeCallbacks_WhenMatcherElementIsNull_ShouldSkipItWithoutThrowing() { StubParameter first = new(true, "first"); @@ -107,7 +107,7 @@ public async Task InvokeCallbacks_WhenMatcherElementIsNull_ShouldSkipItWithoutTh await That(first.InvokedValues).IsEqualTo([1,]); } - [Fact] + [Test] public async Task ToString_ShouldRenderMatchersInOrder() { ParamsArrayParameterMatch sut = new(new StubParameter(true, "first"), new StubParameter(true, "second")); @@ -115,7 +115,7 @@ public async Task ToString_ShouldRenderMatchersInOrder() await That(sut.ToString()).IsEqualTo("[first, second]"); } - [Fact] + [Test] public async Task ToString_WithNullMatcher_ShouldRenderNullToken() { ParamsArrayParameterMatch sut = new(new StubParameter(true, "first"), null!); diff --git a/Tests/Mockolate.Tests/Protected/ProtectedMockTests.cs b/Tests/Mockolate.Tests/Protected/ProtectedMockTests.cs index 0cf4bf373..395e31ec7 100644 --- a/Tests/Mockolate.Tests/Protected/ProtectedMockTests.cs +++ b/Tests/Mockolate.Tests/Protected/ProtectedMockTests.cs @@ -2,7 +2,7 @@ public sealed class ProtectedMockTests { - [Fact] + [Test] public async Task CanAccessProtectedEvents() { int callCount = 0; @@ -19,7 +19,7 @@ public async Task CanAccessProtectedEvents() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task CanAccessProtectedMethods() { MyProtectedClass sut = MyProtectedClass.CreateMock(); @@ -33,7 +33,7 @@ public async Task CanAccessProtectedMethods() await That(result).IsEqualTo("Hello, foo!"); } - [Fact] + [Test] public async Task CanAccessProtectedProperties() { MyProtectedClass sut = MyProtectedClass.CreateMock(); @@ -46,7 +46,7 @@ public async Task CanAccessProtectedProperties() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task CanReadProtectedIndexers() { int callCount = 0; @@ -61,7 +61,7 @@ public async Task CanReadProtectedIndexers() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task CanWriteProtectedIndexers() { int callCount = 0; @@ -76,7 +76,7 @@ public async Task CanWriteProtectedIndexers() await That(callCount).IsEqualTo(1); } - [Fact] + [Test] public async Task OnlyProtectedVirtualMembers() { OnlyProtectedVirtualMembersService sut = OnlyProtectedVirtualMembersService.CreateMock(); @@ -91,7 +91,7 @@ public async Task OnlyProtectedVirtualMembers() await That(result2).IsTrue(); } - [Fact] + [Test] public async Task SupportProtectedAccessInConstructorSetups() { MyProtectedClass sut = MyProtectedClass.CreateMock(setup => setup.Protected.MyProtectedProperty.InitializeWith(42)); diff --git a/Tests/Mockolate.Tests/RefStruct/GeneratedPacketSinkTests.cs b/Tests/Mockolate.Tests/RefStruct/GeneratedPacketSinkTests.cs index 382ab008c..d19e7a9ad 100644 --- a/Tests/Mockolate.Tests/RefStruct/GeneratedPacketSinkTests.cs +++ b/Tests/Mockolate.Tests/RefStruct/GeneratedPacketSinkTests.cs @@ -10,7 +10,7 @@ public sealed class GeneratedPacketSinkTests { public sealed class VoidArity1Tests { - [Fact] + [Test] public async Task ConsumeCount_ViaInteractions_ReflectsEveryInvocation() { IGeneratedPacketSink sut = IGeneratedPacketSink.CreateMock(); @@ -28,7 +28,7 @@ public async Task ConsumeCount_ViaInteractions_ReflectsEveryInvocation() await That(count).IsEqualTo(3); } - [Fact] + [Test] public async Task LatestMatchingSetupWins() { IGeneratedPacketSink sut = IGeneratedPacketSink.CreateMock(); @@ -51,7 +51,7 @@ void ActFallback() await That(ActFallback).Throws(); } - [Fact] + [Test] public async Task NoSetup_ShouldBeNoOp() { IGeneratedPacketSink sut = IGeneratedPacketSink.CreateMock(); @@ -64,7 +64,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task RecordedInteraction_StoresParameterNameButNoValue() { IGeneratedPacketSink sut = IGeneratedPacketSink.CreateMock(); @@ -80,7 +80,7 @@ public async Task RecordedInteraction_StoresParameterNameButNoValue() await That(recorded.ParameterNames.Single()).IsEqualTo("packet"); } - [Fact] + [Test] public async Task SetupPredicateInspectingSpanPayload_ShouldOnlyActOnMatch() { IGeneratedPacketSink sut = IGeneratedPacketSink.CreateMock(); @@ -106,7 +106,7 @@ void ActMiss() await That(ActMiss).DoesNotThrow(); } - [Fact] + [Test] public async Task SetupThrows_ShouldThrowConfiguredException() { IGeneratedPacketSink sut = IGeneratedPacketSink.CreateMock(); @@ -121,7 +121,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task ThrowWhenNotSetup_ShouldThrowMockNotSetupException() { MockBehavior behavior = MockBehavior.Default with @@ -141,7 +141,7 @@ void Act() public sealed class MixedParameterTests { - [Fact] + [Test] public async Task Write_WithMatcherForRefStructAndValueParam_Matches() { IGeneratedPacketWriter sut = IGeneratedPacketWriter.CreateMock(); @@ -164,7 +164,7 @@ void ActMiss() await That(ActMiss).DoesNotThrow(); } - [Fact] + [Test] public async Task Write_WithPriorityMatcher_GatesOnNonRefStructParameter() { IGeneratedPacketWriter sut = IGeneratedPacketWriter.CreateMock(); @@ -190,7 +190,7 @@ void ActMiss() public sealed class ReturnMethodTests { - [Fact] + [Test] public async Task TryParse_NoReturnConfigured_ReturnsFrameworkDefault() { IGeneratedPacketParser sut = IGeneratedPacketParser.CreateMock(); @@ -200,7 +200,7 @@ public async Task TryParse_NoReturnConfigured_ReturnsFrameworkDefault() await That(result).IsEqualTo(0); } - [Fact] + [Test] public async Task TryParse_PredicateDictatesWhichSetupMatches() { IGeneratedPacketParser sut = IGeneratedPacketParser.CreateMock(); @@ -217,7 +217,7 @@ await That(mid).IsEqualTo(0) .Because("nothing matches, so the framework default applies"); } - [Fact] + [Test] public async Task TryParse_ReturnsConfiguredValue() { IGeneratedPacketParser sut = IGeneratedPacketParser.CreateMock(); @@ -228,7 +228,7 @@ public async Task TryParse_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task TryParse_ReturnsFunc_InvokedPerCall() { IGeneratedPacketParser sut = IGeneratedPacketParser.CreateMock(); @@ -243,7 +243,7 @@ public async Task TryParse_ReturnsFunc_InvokedPerCall() await That(second).IsEqualTo(2); } - [Fact] + [Test] public async Task TryParse_ThrowsConfiguredException() { IGeneratedPacketParser sut = IGeneratedPacketParser.CreateMock(); @@ -261,7 +261,7 @@ void Act() public sealed class IndexerSetterTests { - [Fact] + [Test] public async Task OnSet_Callback_ReceivesValue() { IGeneratedPacketSetter sut = IGeneratedPacketSetter.CreateMock(); @@ -273,7 +273,7 @@ public async Task OnSet_Callback_ReceivesValue() await That(captured).IsEqualTo("hello"); } - [Fact] + [Test] public async Task Predicate_FiltersByKey_OnSetOnlyForHit() { IGeneratedPacketSetter sut = IGeneratedPacketSetter.CreateMock(); @@ -286,7 +286,7 @@ public async Task Predicate_FiltersByKey_OnSetOnlyForHit() await That(captured).IsEqualTo("yes"); } - [Fact] + [Test] public async Task RecordedInteraction_UsesSetItemName() { IGeneratedPacketSetter sut = IGeneratedPacketSetter.CreateMock(); @@ -305,7 +305,7 @@ await That(recorded.ParameterNames).IsEqualTo(new[] }); } - [Fact] + [Test] public async Task Throws_ConfiguredException() { IGeneratedPacketSetter sut = IGeneratedPacketSetter.CreateMock(); @@ -322,7 +322,7 @@ void Act() public sealed class CombinedIndexerTests { - [Fact] + [Test] public async Task Predicate_FiltersByKey_AppliesToBothAccessors() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -344,7 +344,7 @@ await That(miss).IsEqualTo("") await That(ActWriteHit).Throws(); } - [Fact] + [Test] public async Task Returns_ConfiguresGet_OnSet_ConfiguresSet_Independent() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -360,7 +360,7 @@ public async Task Returns_ConfiguresGet_OnSet_ConfiguresSet_Independent() await That(result).IsEqualTo("get-value"); } - [Fact] + [Test] public async Task Throws_AppliesToBothAccessors() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -383,7 +383,7 @@ void ActSet() public sealed class ExtendedArityTests { - [Fact] + [Test] public async Task GetterOnlyArity5_PredicateFiltersByProjectedKey() { IBigPacketLookup5 sut = IBigPacketLookup5.CreateMock(); @@ -402,7 +402,7 @@ public async Task GetterOnlyArity5_PredicateFiltersByProjectedKey() await That(miss).IsEqualTo(""); } - [Fact] + [Test] public async Task GetterOnlyArity5_Returns_ConfiguredValue() { IBigPacketLookup5 sut = IBigPacketLookup5.CreateMock(); @@ -419,7 +419,7 @@ public async Task GetterOnlyArity5_Returns_ConfiguredValue() await That(result).IsEqualTo("hit"); } - [Fact] + [Test] public async Task GetterOnlyArity5_Throws_ConfiguredException() { IBigPacketLookup5 sut = IBigPacketLookup5.CreateMock(); @@ -439,7 +439,7 @@ string Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task ReturnArity6_NonRefStructParameterGates_Matches() { IBigPacketParser sut = IBigPacketParser.CreateMock(); @@ -470,7 +470,7 @@ void ActMiss() await That(ActMiss).DoesNotThrow(); } - [Fact] + [Test] public async Task ReturnArity6_ReturnsConfiguredValue() { IBigPacketParser sut = IBigPacketParser.CreateMock(); @@ -490,7 +490,7 @@ public async Task ReturnArity6_ReturnsConfiguredValue() await That(result).IsEqualTo(1234); } - [Fact] + [Test] public async Task ReturnArity6_ReturnsFactory_InvokedPerCall() { IBigPacketParser sut = IBigPacketParser.CreateMock(); @@ -515,7 +515,7 @@ public async Task ReturnArity6_ReturnsFactory_InvokedPerCall() await That(second).IsEqualTo(2); } - [Fact] + [Test] public async Task ReturnArity6_ThrowsExceptionFactory_InvokedPerCall() { IBigPacketParser sut = IBigPacketParser.CreateMock(); @@ -557,7 +557,7 @@ public async Task ReturnArity6_ThrowsExceptionFactory_InvokedPerCall() await That(second!.Message).IsEqualTo("call-2"); } - [Fact] + [Test] public async Task ReturnArity6_ThrowsExceptionInstance_ThrowsSameInstance() { IBigPacketParser sut = IBigPacketParser.CreateMock(); @@ -586,7 +586,7 @@ public async Task ReturnArity6_ThrowsExceptionInstance_ThrowsSameInstance() await That(thrown).IsSameAs(expected); } - [Fact] + [Test] public async Task SetterOnlyArity5_OnSet_ReceivesValue() { IBigPacketSetter5 sut = IBigPacketSetter5.CreateMock(); @@ -604,7 +604,7 @@ public async Task SetterOnlyArity5_OnSet_ReceivesValue() await That(captured).IsEqualTo("stored"); } - [Fact] + [Test] public async Task SetterOnlyArity5_Throws_ConfiguredException() { IBigPacketSetter5 sut = IBigPacketSetter5.CreateMock(); @@ -624,7 +624,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VoidArity5_DoesNotThrow_AfterThrows_OverridesPreviousConfiguration() { IBigPacketSink sut = IBigPacketSink.CreateMock(); @@ -650,7 +650,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task VoidArity5_NoSetup_IsNoOp() { IBigPacketSink sut = IBigPacketSink.CreateMock(); @@ -668,7 +668,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task VoidArity5_PredicateMatchesSelectively() { IBigPacketSink sut = IBigPacketSink.CreateMock(); @@ -698,7 +698,7 @@ void ActMiss() await That(ActMiss).DoesNotThrow(); } - [Fact] + [Test] public async Task VoidArity5_SetupThrows_ShouldThrowConfiguredException() { IBigPacketSink sut = IBigPacketSink.CreateMock(); @@ -723,7 +723,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VoidArity5_ThrowsExceptionFactory_InvokedPerCall() { IBigPacketSink sut = IBigPacketSink.CreateMock(); @@ -764,7 +764,7 @@ public async Task VoidArity5_ThrowsExceptionFactory_InvokedPerCall() await That(second!.Message).IsEqualTo("call-2"); } - [Fact] + [Test] public async Task VoidArity5_ThrowsExceptionInstance_ThrowsSameInstance() { IBigPacketSink sut = IBigPacketSink.CreateMock(); @@ -795,7 +795,7 @@ public async Task VoidArity5_ThrowsExceptionInstance_ThrowsSameInstance() public sealed class IndexerGetterTests { - [Fact] + [Test] public async Task NoSetup_ReturnsFrameworkDefault() { IGeneratedPacketLookup sut = IGeneratedPacketLookup.CreateMock(); @@ -805,7 +805,7 @@ public async Task NoSetup_ReturnsFrameworkDefault() await That(result).IsEqualTo(""); } - [Fact] + [Test] public async Task Predicate_FiltersByKey_PayloadReadable() { // Predicate reads the inline Span on the ref-struct key — the whole point of the @@ -827,7 +827,7 @@ await That(miss).IsEqualTo("") .Because("nothing matches, so the framework default applies and Mockolate's default for string is \"\""); } - [Fact] + [Test] public async Task RecordedInteraction_UsesRefStructMethodInvocation() { IGeneratedPacketLookup sut = IGeneratedPacketLookup.CreateMock(); @@ -843,7 +843,7 @@ public async Task RecordedInteraction_UsesRefStructMethodInvocation() await That(recorded.ParameterNames.Single()).IsEqualTo("key"); } - [Fact] + [Test] public async Task Returns_ConfiguredValue() { IGeneratedPacketLookup sut = IGeneratedPacketLookup.CreateMock(); @@ -854,7 +854,7 @@ public async Task Returns_ConfiguredValue() await That(result).IsEqualTo("hit"); } - [Fact] + [Test] public async Task Returns_Factory_InvokedPerCall() { IGeneratedPacketLookup sut = IGeneratedPacketLookup.CreateMock(); @@ -868,7 +868,7 @@ public async Task Returns_Factory_InvokedPerCall() await That(second).IsEqualTo("call-2"); } - [Fact] + [Test] public async Task Throws_ConfiguredException() { IGeneratedPacketLookup sut = IGeneratedPacketLookup.CreateMock(); diff --git a/Tests/Mockolate.Tests/RefStruct/ProjectionIndexerTests.cs b/Tests/Mockolate.Tests/RefStruct/ProjectionIndexerTests.cs index 7fa7a9216..c03ed291a 100644 --- a/Tests/Mockolate.Tests/RefStruct/ProjectionIndexerTests.cs +++ b/Tests/Mockolate.Tests/RefStruct/ProjectionIndexerTests.cs @@ -16,7 +16,7 @@ public sealed class ProjectionIndexerTests { public sealed class EndToEndTests { - [Fact] + [Test] public async Task WithProjection_SetterWrite_FeedsGetterRead_UnderProjectedKey() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -31,7 +31,7 @@ public async Task WithProjection_SetterWrite_FeedsGetterRead_UnderProjectedKey() await That(miss).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task WithoutProjection_SetterWrite_IsStorageNoOp() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -44,7 +44,7 @@ public async Task WithoutProjection_SetterWrite_IsStorageNoOp() await That(v).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task WithProjection_MultipleWrites_LastWriteWinsUnderSameProjectedKey() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -60,7 +60,7 @@ public async Task WithProjection_MultipleWrites_LastWriteWinsUnderSameProjectedK await That(v).IsEqualTo("second"); } - [Fact] + [Test] public async Task WithProjectionAndPredicate_StoresOnlyWhenPredicateMatches() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -80,7 +80,7 @@ await That(small).IsEqualTo("") .Because("small does not match the setup, so the getter falls through to the framework default"); } - [Fact] + [Test] public async Task MatcherOnlySetup_NoProjection_ReturnsConfiguredValueRegardlessOfWrite() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -92,7 +92,7 @@ public async Task MatcherOnlySetup_NoProjection_ReturnsConfiguredValueRegardless await That(v).IsEqualTo("hit"); } - [Fact] + [Test] public async Task WithProjection_NoReturnsConfigured_ReadsStoredValue() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -105,7 +105,7 @@ public async Task WithProjection_NoReturnsConfigured_ReadsStoredValue() await That(v).IsEqualTo("stored"); } - [Fact] + [Test] public async Task WithProjection_NoWrite_EmptyBucket_FallsBackToReturns() { IGeneratedPacketStore sut = IGeneratedPacketStore.CreateMock(); @@ -116,7 +116,7 @@ public async Task WithProjection_NoWrite_EmptyBucket_FallsBackToReturns() await That(v).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task WithProjection_NoWriteNoReturns_ReturnsDefault() { // When storage is active but the bucket is empty and no Returns(...) was configured, @@ -131,7 +131,7 @@ public async Task WithProjection_NoWriteNoReturns_ReturnsDefault() await That(v).IsNull(); } - [Fact] + [Test] public async Task SetterOnly_NoBoundGetter_DoesNotStore() { // IGeneratedPacketSetter exposes only a setter. Writing via a projection matcher @@ -150,7 +150,7 @@ public async Task SetterOnly_NoBoundGetter_DoesNotStore() public sealed class UnitLevelTests { - [Fact] + [Test] public async Task CombinedSetup_WiresSetterBoundGetter_WritesFeedReads() { // Exercises the setup plumbing at a coarser level than the internal StoreValue / @@ -170,7 +170,7 @@ public async Task CombinedSetup_WiresSetterBoundGetter_WritesFeedReads() public sealed class MultiParameterTests { - [Fact] + [Test] public async Task MixedIndexer_NormalAndProjection_WritesFeedReadsUnderProjectedKey() { IGeneratedMixedStore sut = IGeneratedMixedStore.CreateMock(); @@ -188,7 +188,7 @@ public async Task MixedIndexer_NormalAndProjection_WritesFeedReadsUnderProjected await That(missOnSecondSlot).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task MixedIndexer_RefStructWithoutProjection_DisablesStorage() { IGeneratedMixedStore sut = IGeneratedMixedStore.CreateMock(); @@ -201,7 +201,7 @@ public async Task MixedIndexer_RefStructWithoutProjection_DisablesStorage() await That(v).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task Arity5_MixedProjectionsAndNormals_WritesFeedReads() { // Exercises the generator-emitted arity 5+ RefStructIndexerSetup class — three @@ -226,7 +226,7 @@ public async Task Arity5_MixedProjectionsAndNormals_WritesFeedReads() await That(missOnNormal).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task DoubleRefStructIndexer_BothProjections_WritesFeedReads() { IGeneratedDoublePacketStore sut = IGeneratedDoublePacketStore.CreateMock(); @@ -248,7 +248,7 @@ await That(hit).IsEqualTo("written") public sealed class MatcherTests { - [Fact] + [Test] public async Task IsRefStructBy_ReturnsProjectionMatcher() { IParameter matcher = It.IsRefStructBy(p => p.Id); @@ -257,7 +257,7 @@ public async Task IsRefStructBy_ReturnsProjectionMatcher() await That(matcher).Is>(); } - [Fact] + [Test] public async Task IsRefStructBy_Project_ReturnsTypedProjection() { IParameter matcher = It.IsRefStructBy(p => p.Id); @@ -268,7 +268,7 @@ public async Task IsRefStructBy_Project_ReturnsTypedProjection() await That(projected).IsEqualTo(42); } - [Fact] + [Test] public async Task IsRefStructBy_NonGenericProject_BoxesProjection() { IParameter matcher = It.IsRefStructBy(p => p.Id); @@ -280,7 +280,7 @@ public async Task IsRefStructBy_NonGenericProject_BoxesProjection() await That(projected).Is(); } - [Fact] + [Test] public async Task IsRefStructBy_NoPredicate_MatchesAny() { IParameter matcher = It.IsRefStructBy(p => p.Id); @@ -290,7 +290,7 @@ public async Task IsRefStructBy_NoPredicate_MatchesAny() await That(asMatch.Matches(new Packet(int.MaxValue, []))).IsTrue(); } - [Fact] + [Test] public async Task IsRefStructBy_WithPredicate_FiltersOnProjectedValue() { IParameter matcher = It.IsRefStructBy(p => p.Id, id => id == 7); @@ -300,7 +300,7 @@ public async Task IsRefStructBy_WithPredicate_FiltersOnProjectedValue() await That(asMatch.Matches(new Packet(8, []))).IsFalse(); } - [Fact] + [Test] public async Task IsRefStructBy_ToString_WithoutPredicate() { IParameter matcher = It.IsRefStructBy(p => p.Id); @@ -308,7 +308,7 @@ public async Task IsRefStructBy_ToString_WithoutPredicate() await That(matcher.ToString()).IsEqualTo("It.IsRefStructBy()"); } - [Fact] + [Test] public async Task IsRefStructBy_ToString_WithPredicate() { IParameter matcher = It.IsRefStructBy(p => p.Id, id => id > 0); @@ -317,7 +317,7 @@ await That(matcher.ToString()) .IsEqualTo("It.IsRefStructBy(, )"); } - [Fact] + [Test] public async Task IsRefStructBy_Matches_ObjectOverload_ReturnsFalse() { IParameter matcher = It.IsRefStructBy(p => p.Id); diff --git a/Tests/Mockolate.Tests/RefStruct/RefStructOutRefParameterTests.cs b/Tests/Mockolate.Tests/RefStruct/RefStructOutRefParameterTests.cs index 80cf4d38a..e61ca439b 100644 --- a/Tests/Mockolate.Tests/RefStruct/RefStructOutRefParameterTests.cs +++ b/Tests/Mockolate.Tests/RefStruct/RefStructOutRefParameterTests.cs @@ -19,7 +19,7 @@ namespace Mockolate.Tests.RefStruct; /// public sealed class RefStructOutRefParameterTests { - [Fact] + [Test] public async Task OutRefStruct_WithIsOut_AssignsSetterValue() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -32,7 +32,7 @@ public async Task OutRefStruct_WithIsOut_AssignsSetterValue() await That(id).IsEqualTo(7); } - [Fact] + [Test] public async Task OutRefStruct_WithIsAnyOutRefStruct_AssignsDefault() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -45,7 +45,7 @@ public async Task OutRefStruct_WithIsAnyOutRefStruct_AssignsDefault() await That(id).IsEqualTo(0); } - [Fact] + [Test] public async Task OutRefStruct_NoSetup_AssignsDefault() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -57,7 +57,7 @@ public async Task OutRefStruct_NoSetup_AssignsDefault() await That(id).IsEqualTo(0); } - [Fact] + [Test] public async Task RefRefStruct_WithIsRef_TransformsValue() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -70,7 +70,7 @@ public async Task RefRefStruct_WithIsRef_TransformsValue() await That(id).IsEqualTo(42); } - [Fact] + [Test] public async Task RefRefStruct_WithIsAnyRefRefStruct_LeavesValueUnchanged() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -83,7 +83,7 @@ public async Task RefRefStruct_WithIsAnyRefRefStruct_LeavesValueUnchanged() await That(id).IsEqualTo(13); } - [Fact] + [Test] public async Task RefRefStruct_WithPredicate_OnlyTransformsWhenPredicateHolds() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -101,7 +101,7 @@ public async Task RefRefStruct_WithPredicate_OnlyTransformsWhenPredicateHolds() await That(nonMatchingId).IsEqualTo(1); } - [Fact] + [Test] public async Task RefReadOnlyRefStruct_PassesValueUnchanged() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -113,7 +113,7 @@ public async Task RefReadOnlyRefStruct_PassesValueUnchanged() await That(idAfter).IsEqualTo(17); } - [Fact] + [Test] public async Task OutSpan_WithIsOutSpan_AssignsSetterArray() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -130,7 +130,7 @@ public async Task OutSpan_WithIsOutSpan_AssignsSetterArray() await That(last).IsEqualTo(3); } - [Fact] + [Test] public async Task OutSpan_WithIsAnyOutSpan_AssignsDefault() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -143,7 +143,7 @@ public async Task OutSpan_WithIsAnyOutSpan_AssignsDefault() await That(length).IsEqualTo(0); } - [Fact] + [Test] public async Task OutSpan_NoSetup_AssignsDefault() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -155,7 +155,7 @@ public async Task OutSpan_NoSetup_AssignsDefault() await That(length).IsEqualTo(0); } - [Fact] + [Test] public async Task OutSpan_WithDoCallback_RunsAction() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -176,7 +176,7 @@ public async Task OutSpan_WithDoCallback_RunsAction() await That(observedLength).IsEqualTo(2); } - [Fact] + [Test] public async Task RefSpan_WithIsRefSpan_TransformsArray() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -191,7 +191,7 @@ public async Task RefSpan_WithIsRefSpan_TransformsArray() await That(length).IsEqualTo(1); } - [Fact] + [Test] public async Task RefSpan_WithIsAnyRefSpan_LeavesValueUnchanged() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -206,7 +206,7 @@ public async Task RefSpan_WithIsAnyRefSpan_LeavesValueUnchanged() await That(length).IsEqualTo(2); } - [Fact] + [Test] public async Task RefSpan_WithPredicate_OnlyTransformsWhenPredicateHolds() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -227,7 +227,7 @@ public async Task RefSpan_WithPredicate_OnlyTransformsWhenPredicateHolds() await That(nonMatchingFirst).IsEqualTo(1); } - [Fact] + [Test] public async Task OutReadOnlySpan_WithIsOutReadOnlySpan_AssignsSetterArray() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -243,7 +243,7 @@ public async Task OutReadOnlySpan_WithIsOutReadOnlySpan_AssignsSetterArray() await That(first).IsEqualTo(5); } - [Fact] + [Test] public async Task OutReadOnlySpan_WithIsAnyOutReadOnlySpan_AssignsDefault() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -256,7 +256,7 @@ public async Task OutReadOnlySpan_WithIsAnyOutReadOnlySpan_AssignsDefault() await That(length).IsEqualTo(0); } - [Fact] + [Test] public async Task OutReadOnlySpan_NoSetup_AssignsDefault() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -268,7 +268,7 @@ public async Task OutReadOnlySpan_NoSetup_AssignsDefault() await That(length).IsEqualTo(0); } - [Fact] + [Test] public async Task RefReadOnlySpan_WithIsRefReadOnlySpan_TransformsArray() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -283,7 +283,7 @@ public async Task RefReadOnlySpan_WithIsRefReadOnlySpan_TransformsArray() await That(first).IsEqualTo(42); } - [Fact] + [Test] public async Task RefReadOnlySpan_WithIsAnyRefReadOnlySpan_LeavesValueUnchanged() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -296,7 +296,7 @@ public async Task RefReadOnlySpan_WithIsAnyRefReadOnlySpan_LeavesValueUnchanged( await That(first).IsEqualTo(13); } - [Fact] + [Test] public async Task RefReadOnlySpan_WithPredicateOnly_GatesMatchWithoutMutating() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); @@ -336,7 +336,7 @@ public async Task RefReadOnlySpan_WithPredicateOnly_GatesMatchWithoutMutating() await That(nonMatchingFirst).IsEqualTo(13); } - [Fact] + [Test] public async Task RefReadOnlySpan_WithIsAnyRefRefStruct_MatchesViaRefStructPipeline() { IRefStructConsumer sut = IRefStructConsumer.CreateMock(); diff --git a/Tests/Mockolate.Tests/RefStruct/RefStructPrimitivesTests.cs b/Tests/Mockolate.Tests/RefStruct/RefStructPrimitivesTests.cs index 9ff621ecb..27014f9f4 100644 --- a/Tests/Mockolate.Tests/RefStruct/RefStructPrimitivesTests.cs +++ b/Tests/Mockolate.Tests/RefStruct/RefStructPrimitivesTests.cs @@ -17,7 +17,7 @@ public sealed class RefStructPrimitivesTests { public sealed class MatcherTests { - [Fact] + [Test] public async Task IsAnyRefStruct_ShouldMatchAnyValue() { IParameter sut = It.IsAnyRefStruct(); @@ -27,7 +27,7 @@ public async Task IsAnyRefStruct_ShouldMatchAnyValue() await That(result).IsTrue(); } - [Fact] + [Test] public async Task IsAnyRefStruct_ToString_ShouldIncludeTypeName() { IParameter sut = It.IsAnyRefStruct(); @@ -37,7 +37,7 @@ public async Task IsAnyRefStruct_ToString_ShouldIncludeTypeName() await That(result).IsEqualTo("It.IsAnyRefStruct()"); } - [Fact] + [Test] public async Task IsRefStruct_WithPredicate_ShouldFilterById() { IParameter sut = It.IsRefStruct(p => p.Id > 100); @@ -50,7 +50,7 @@ public async Task IsRefStruct_WithPredicate_ShouldFilterById() await That(low).IsFalse(); } - [Fact] + [Test] public async Task IsRefStruct_PredicateSeesSpanPayload() { // Demonstrates the predicate can read into the ref struct's inline Span — which is the @@ -70,7 +70,7 @@ public async Task IsRefStruct_PredicateSeesSpanPayload() await That(matchedMiss).IsFalse(); } - [Fact] + [Test] public async Task IsAnyRefStruct_NonGenericMatches_ReturnsFalseForBoxedSlot() { IParameter sut = It.IsAnyRefStruct(); @@ -85,7 +85,7 @@ await That(result).IsFalse() public sealed class InteractionTests { - [Fact] + [Test] public async Task SingleArityInteraction_RendersParameterNameWithPlaceholder() { RefStructMethodInvocation invocation = new("Consume", "packet"); @@ -95,7 +95,7 @@ public async Task SingleArityInteraction_RendersParameterNameWithPlaceholder() await That(rendered).IsEqualTo("invoke method Consume(packet: )"); } - [Fact] + [Test] public async Task MultiArityInteraction_RendersAllParameterNames() { RefStructMethodInvocation invocation = new("Encode", "left", "right", "scratch"); @@ -109,7 +109,7 @@ await That(rendered).IsEqualTo( public sealed class MultiAritySetupTests { - [Fact] + [Test] public async Task Arity2_Matches_AllMatchersMustAccept() { RefStructVoidMethodSetup setup = new( @@ -126,7 +126,7 @@ public async Task Arity2_Matches_AllMatchersMustAccept() await That(secondOnly).IsFalse(); } - [Fact] + [Test] public async Task Arity2_Invoke_ThrowsConfiguredException() { RefStructVoidMethodSetup setup = new("Encode"); @@ -138,7 +138,7 @@ public async Task Arity2_Invoke_ThrowsConfiguredException() await That(Act).Throws(); } - [Fact] + [Test] public async Task Arity3_Matches_AllMatchersMustAccept() { RefStructVoidMethodSetup setup = new( @@ -156,7 +156,7 @@ public async Task Arity3_Matches_AllMatchersMustAccept() await That(miss).IsFalse(); } - [Fact] + [Test] public async Task Arity4_Invoke_ThrowsFromFactory() { RefStructVoidMethodSetup setup = @@ -174,7 +174,7 @@ void Act() => setup.Invoke( public sealed class ReturnSetupTests { - [Fact] + [Test] public async Task Arity1_Returns_Value_ReturnsConfiguredValue() { RefStructReturnMethodSetup setup = new( @@ -186,7 +186,7 @@ public async Task Arity1_Returns_Value_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Arity1_Returns_Factory_InvokedPerCall() { int calls = 0; @@ -201,7 +201,7 @@ public async Task Arity1_Returns_Factory_InvokedPerCall() await That(second).IsEqualTo(2); } - [Fact] + [Test] public async Task Arity1_NoReturnConfigured_UsesDefaultFactory() { RefStructReturnMethodSetup setup = new("Decode"); @@ -211,7 +211,7 @@ public async Task Arity1_NoReturnConfigured_UsesDefaultFactory() await That(result).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task Arity1_Throws_BeatsReturn_WhenBothConfigured() { RefStructReturnMethodSetup setup = new("TryParse"); @@ -224,7 +224,7 @@ public async Task Arity1_Throws_BeatsReturn_WhenBothConfigured() await That(Act).Throws(); } - [Fact] + [Test] public async Task Arity1_HasReturnValue_ReflectsConfiguration() { RefStructReturnMethodSetup setup = new("TryParse"); @@ -236,7 +236,7 @@ public async Task Arity1_HasReturnValue_ReflectsConfiguration() await That(setup.HasReturnValue).IsTrue(); } - [Fact] + [Test] public async Task Arity2_Matches_AllMatchersMustAccept() { RefStructReturnMethodSetup setup = new( @@ -252,7 +252,7 @@ public async Task Arity2_Matches_AllMatchersMustAccept() await That(miss).IsFalse(); } - [Fact] + [Test] public async Task Arity3_Invoke_ReturnsConfiguredValue() { RefStructReturnMethodSetup setup = @@ -266,7 +266,7 @@ public async Task Arity3_Invoke_ReturnsConfiguredValue() await That(result).IsEqualTo("blended"); } - [Fact] + [Test] public async Task Arity4_Invoke_RunsThrowOverReturn() { RefStructReturnMethodSetup setup = @@ -285,7 +285,7 @@ void Act() => setup.Invoke( public sealed class IndexerGetterSetupTests { - [Fact] + [Test] public async Task Arity1_Returns_Value_ReturnsConfiguredValue() { RefStructIndexerGetterSetup setup = new( @@ -297,7 +297,7 @@ public async Task Arity1_Returns_Value_ReturnsConfiguredValue() await That(result).IsEqualTo(7); } - [Fact] + [Test] public async Task Arity1_PredicateMatches_FiltersByKey() { RefStructIndexerGetterSetup setup = new( @@ -312,7 +312,7 @@ public async Task Arity1_PredicateMatches_FiltersByKey() await That(matchesMiss).IsFalse(); } - [Fact] + [Test] public async Task Arity1_NoReturnConfigured_UsesDefaultFactory() { RefStructIndexerGetterSetup setup = new("get_Item"); @@ -322,7 +322,7 @@ public async Task Arity1_NoReturnConfigured_UsesDefaultFactory() await That(result).IsEqualTo("fallback"); } - [Fact] + [Test] public async Task Arity1_Throws_TakesPrecedenceOverReturn() { RefStructIndexerGetterSetup setup = new("get_Item"); @@ -335,7 +335,7 @@ public async Task Arity1_Throws_TakesPrecedenceOverReturn() await That(Act).Throws(); } - [Fact] + [Test] public async Task Arity2_Matches_AllMatchersMustAccept() { RefStructIndexerGetterSetup setup = new( @@ -350,7 +350,7 @@ public async Task Arity2_Matches_AllMatchersMustAccept() await That(secondOnly).IsFalse(); } - [Fact] + [Test] public async Task Arity4_Invoke_ReturnsFactoryValue() { RefStructIndexerGetterSetup diff --git a/Tests/Mockolate.Tests/RefStruct/RefStructStorageHelperTests.cs b/Tests/Mockolate.Tests/RefStruct/RefStructStorageHelperTests.cs index 0e7f1d660..940f27446 100644 --- a/Tests/Mockolate.Tests/RefStruct/RefStructStorageHelperTests.cs +++ b/Tests/Mockolate.Tests/RefStruct/RefStructStorageHelperTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests.RefStruct; public sealed class RefStructStorageHelperTests { - [Fact] + [Test] public async Task TryResolveKey_WithNullProjectionAndNullRawKey_ShouldReturnFalse() { bool result = RefStructStorageHelper.TryResolveKey(null, 7, null, out object key); @@ -14,7 +14,7 @@ public async Task TryResolveKey_WithNullProjectionAndNullRawKey_ShouldReturnFals await That(key).IsNull(); } - [Fact] + [Test] public async Task TryResolveKey_WithNullProjectionAndRawKey_ShouldReturnRawKey() { object boxed = 42; diff --git a/Tests/Mockolate.Tests/RefStruct/RefStructValuePositionTests.cs b/Tests/Mockolate.Tests/RefStruct/RefStructValuePositionTests.cs index 0fd2118f7..6b0ea0bba 100644 --- a/Tests/Mockolate.Tests/RefStruct/RefStructValuePositionTests.cs +++ b/Tests/Mockolate.Tests/RefStruct/RefStructValuePositionTests.cs @@ -55,7 +55,7 @@ public interface IPacketBin public sealed class EventTests { - [Fact] + [Test] public async Task RaiseWithRefStructArgument_ShouldReachSubscriber() { IPacketNotifier sut = IPacketNotifier.CreateMock(); @@ -68,7 +68,7 @@ await That(receivedId).IsEqualTo(42) .Because("the strongly-typed Raise overload passes the ref struct straight to the delegate"); } - [Fact] + [Test] public async Task RaiseWithoutSubscriber_ShouldNotThrow() { IPacketNotifier sut = IPacketNotifier.CreateMock(); @@ -84,7 +84,7 @@ public interface ISpanEventSource event EventHandler Received; } - [Fact] + [Test] public async Task RaiseWithEventHandlerOfRefStruct_ShouldReachSubscriber() { ISpanEventSource sut = ISpanEventSource.CreateMock(); @@ -123,7 +123,7 @@ public abstract class AbstractSpanHost public abstract Span Buffer { get; set; } } - [Fact] + [Test] public async Task Getter_ShouldReturnConfiguredSpan() { ISpanBuffer sut = ISpanBuffer.CreateMock(); @@ -136,7 +136,7 @@ await That(result).IsEqualTo(expected) .Because("a Span-typed property round-trips through SpanWrapper"); } - [Fact] + [Test] public async Task Setter_ShouldBeVerifiableByValue() { ISpanBuffer sut = ISpanBuffer.CreateMock(); @@ -147,7 +147,7 @@ await That(sut.Mock.Verify.Buffer.Set(new byte[] { 9, 8, }.AsSpan())).Once() .Because("SpanWrapper compares its contents, so the raw-span overload matches"); } - [Fact] + [Test] public async Task Setter_WithNonMatchingValue_ShouldNotBeVerified() { ISpanBuffer sut = ISpanBuffer.CreateMock(); @@ -157,7 +157,7 @@ public async Task Setter_WithNonMatchingValue_ShouldNotBeVerified() await That(sut.Mock.Verify.Buffer.Set(new byte[] { 9, 7, }.AsSpan())).Never(); } - [Fact] + [Test] public async Task Setter_ShouldBeVerifiableByPredicate() { ISpanBuffer sut = ISpanBuffer.CreateMock(); @@ -167,7 +167,7 @@ public async Task Setter_ShouldBeVerifiableByPredicate() await That(sut.Mock.Verify.Buffer.Set(It.IsSpan(values => values.Length == 2))).Once(); } - [Fact] + [Test] public async Task OnVirtualClassMember_ShouldRoundTripThroughBase() { SpanHost sut = SpanHost.CreateMock(); @@ -180,7 +180,7 @@ await That(initial).IsEqualTo(new byte[] { 1, 2, }) await That(sut.Buffer.ToArray()).IsEqualTo(new byte[] { 7, }); } - [Fact] + [Test] public async Task OnAbstractClassMember_ShouldReturnConfiguredSpan() { AbstractSpanHost sut = AbstractSpanHost.CreateMock(); @@ -218,7 +218,7 @@ public virtual Span this[int index] } } - [Fact] + [Test] public async Task GetterOnly_ShouldReturnConfiguredSpan() { ISpanBufferGetter sut = ISpanBufferGetter.CreateMock(); @@ -231,7 +231,7 @@ await That(result).IsEqualTo(expected) .Because("a Span-valued indexer round-trips through SpanWrapper"); } - [Fact] + [Test] public async Task SetterOnly_ShouldBeVerifiableByValue() { ISpanBufferSetter sut = ISpanBufferSetter.CreateMock(); @@ -242,7 +242,7 @@ await That(sut.Mock.Verify[4].Set(new byte[] { 9, 8, }.AsSpan())).Once() .Because("the setter dispatches through ApplyIndexerSetter>"); } - [Fact] + [Test] public async Task GetAndSet_ShouldBeVerifiableByValue() { ISpanBufferStore sut = ISpanBufferStore.CreateMock(); @@ -252,7 +252,7 @@ public async Task GetAndSet_ShouldBeVerifiableByValue() await That(sut.Mock.Verify[7].Set(new byte[] { 5, }.AsSpan())).Once(); } - [Fact] + [Test] public async Task OnVirtualClassMember_ShouldRoundTripThroughBase() { SpanHost sut = SpanHost.CreateMock(); @@ -336,7 +336,7 @@ private sealed class LoudPacketSource : PacketSource public override Packet Produce() => new(98, []); } - [Fact] + [Test] public async Task VirtualProperty_ShouldFallBackToBase() { PacketSource sut = PacketSource.CreateMock(); @@ -347,7 +347,7 @@ await That(id).IsEqualTo(11) .Because("a virtual member without a setup surface forwards to base instead of throwing"); } - [Fact] + [Test] public async Task VirtualMethod_ShouldFallBackToBase() { PacketSource sut = PacketSource.CreateMock(); @@ -358,7 +358,7 @@ await That(id).IsEqualTo(12) .Because("a virtual member without a setup surface forwards to base instead of throwing"); } - [Fact] + [Test] public async Task VirtualPropertySetter_ShouldFallBackToBase() { PacketSource sut = PacketSource.CreateMock(); @@ -369,7 +369,7 @@ await That(sut.Slot.Id).IsEqualTo(7) .Because("the setter forwards to base, so the base getter observes the written value"); } - [Fact] + [Test] public async Task VirtualIndexer_ShouldFallBackToBase() { PacketSource sut = PacketSource.CreateMock(); @@ -380,7 +380,7 @@ await That(sut[0].Id).IsEqualTo(8) .Because("both indexer accessors forward to base"); } - [Fact] + [Test] public async Task VirtualProperty_WhenWrapping_ShouldUseWrappedInstance() { PacketSource sut = PacketSource.CreateMock().Wrapping(new LoudPacketSource()); @@ -391,7 +391,7 @@ await That(id).IsEqualTo(99) .Because("the passthrough honours Wraps the same way every other member does"); } - [Fact] + [Test] public async Task VirtualMethod_WhenWrapping_ShouldUseWrappedInstance() { PacketSource sut = PacketSource.CreateMock().Wrapping(new LoudPacketSource()); @@ -402,7 +402,7 @@ await That(id).IsEqualTo(98) .Because("the passthrough honours Wraps the same way every other member does"); } - [Fact] + [Test] public async Task VirtualPropertySetter_WhenWrapping_ShouldUseWrappedInstance() { LoudPacketSource wrapped = new(); @@ -414,7 +414,7 @@ await That(wrapped.Slot.Id).IsEqualTo(5) .Because("the setter writes to the wrapped instance rather than to base"); } - [Fact] + [Test] public async Task VirtualIndexerSetter_WhenWrapping_ShouldUseWrappedInstance() { LoudPacketSource wrapped = new(); @@ -426,7 +426,7 @@ await That(wrapped[0].Id).IsEqualTo(6) .Because("the indexer setter writes to the wrapped instance rather than to base"); } - [Fact] + [Test] public async Task ProtectedMembers_ShouldFallBackToBase() { ProtectedPacketSource sut = ProtectedPacketSource.CreateMock(); @@ -441,7 +441,7 @@ await That(result).IsEqualTo(9 + 109) // Suppressed rather than unflagged: the init accessor keeps the throwing stub, so the member // is only half-degraded and the analyzer is right to report it. #pragma warning disable Mockolate0003 // Ref-struct usage is not supported on this compilation - [Fact] + [Test] public async Task InitOnlyProperty_ShouldFallBackToBase() { InitOnlyPacketSource sut = InitOnlyPacketSource.CreateMock(); @@ -454,7 +454,7 @@ await That(id).IsEqualTo(4) #pragma warning restore Mockolate0003 #endif - [Fact] + [Test] public async Task VirtualProperty_WithStrictBehavior_ShouldStillFallBackToBase() { PacketSource sut = PacketSource.CreateMock(MockBehavior.Default with @@ -468,7 +468,7 @@ await That(id).IsEqualTo(11) .Because("ThrowWhenNotSetup would reject a member that can never be set up"); } - [Fact] + [Test] public async Task VirtualProperty_WithSkipBaseClass_ShouldStillFallBackToBase() { PacketSource sut = PacketSource.CreateMock(MockBehavior.Default with @@ -496,7 +496,7 @@ public class PacketPicker public virtual ref Packet Pick(ref Packet packet) => ref packet; } - [Fact] + [Test] public async Task RefStructProperty_ShouldThrowNotSupported() { IPacketHolder sut = IPacketHolder.CreateMock(); @@ -507,7 +507,7 @@ await That(Act).Throws() .WithMessage("*properties of a non-span ref struct type are not supported*").AsWildcard(); } - [Fact] + [Test] public async Task RefStructPropertySetter_ShouldThrowNotSupported() { IPacketSlot sut = IPacketSlot.CreateMock(); @@ -518,7 +518,7 @@ await That(Act).Throws() .WithMessage("*properties of a non-span ref struct type are not supported*").AsWildcard(); } - [Fact] + [Test] public async Task AbstractRefStructProperty_ShouldThrowNotSupported() { AbstractPacketSource sut = AbstractPacketSource.CreateMock(); @@ -530,7 +530,7 @@ await That(Act).Throws() .Because("an abstract member has no implementation to forward to"); } - [Fact] + [Test] public async Task RefStructReturningMethod_ShouldThrowNotSupported() { IPacketProducer sut = IPacketProducer.CreateMock(); @@ -541,7 +541,7 @@ await That(Act).Throws() .WithMessage("*methods returning a non-span ref struct are not supported*").AsWildcard(); } - [Fact] + [Test] public async Task RefReturningRefStructMethod_ShouldThrowNotSupported() { PacketPicker sut = PacketPicker.CreateMock(); @@ -557,7 +557,7 @@ await That(Act).Throws() .Because("`return base.Pick(ref packet)` is not valid for a by-ref return"); } - [Fact] + [Test] public async Task RefStructIndexer_ShouldThrowNotSupported() { IPacketCatalog sut = IPacketCatalog.CreateMock(); @@ -568,7 +568,7 @@ await That(Act).Throws() .WithMessage("*indexers returning a non-span ref struct are not supported*").AsWildcard(); } - [Fact] + [Test] public async Task RefStructIndexerSetter_ShouldThrowNotSupported() { IPacketBin sut = IPacketBin.CreateMock(); @@ -579,7 +579,7 @@ await That(Act).Throws() .WithMessage("*indexers returning a non-span ref struct are not supported*").AsWildcard(); } - [Fact] + [Test] public async Task RefStructReturningDelegate_ShouldThrowNotSupported() { PacketFactory sut = PacketFactory.CreateMock(); @@ -590,7 +590,7 @@ await That(Act).Throws() .WithMessage("*methods returning a non-span ref struct are not supported*").AsWildcard(); } - [Fact] + [Test] public async Task RefStructParameterDelegate_ShouldThrowNotSupported() { PacketHandler sut = PacketHandler.CreateMock(); @@ -604,7 +604,7 @@ await That(Act).Throws() #if NET8_0_OR_GREATER public delegate void SpanInspector(ref readonly Span values); - [Fact] + [Test] public async Task RefReadonlySpanParameterDelegate_ShouldThrowNotSupported() { SpanInspector sut = SpanInspector.CreateMock(); diff --git a/Tests/Mockolate.Tests/ReturnsThrowsAsyncExtensionsTests.cs b/Tests/Mockolate.Tests/ReturnsThrowsAsyncExtensionsTests.cs index 985df3eda..697dac6cb 100644 --- a/Tests/Mockolate.Tests/ReturnsThrowsAsyncExtensionsTests.cs +++ b/Tests/Mockolate.Tests/ReturnsThrowsAsyncExtensionsTests.cs @@ -4,7 +4,7 @@ public sealed class ReturnsThrowsAsyncExtensionsTests { public sealed class ReturnsTaskTests { - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -15,7 +15,7 @@ public async Task ReturnsAsync_1Parameter_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -26,7 +26,7 @@ public async Task ReturnsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredVal await That(result).IsEqualTo(12); } - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -37,7 +37,7 @@ public async Task ReturnsAsync_1Parameter_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -52,7 +52,7 @@ public async Task ReturnsAsync_1Parameter_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -63,7 +63,7 @@ public async Task ReturnsAsync_2Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -74,7 +74,7 @@ public async Task ReturnsAsync_2Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(13); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -85,7 +85,7 @@ public async Task ReturnsAsync_2Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -101,7 +101,7 @@ public async Task ReturnsAsync_2Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -112,7 +112,7 @@ public async Task ReturnsAsync_3Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -124,7 +124,7 @@ public async Task ReturnsAsync_3Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(16); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -135,7 +135,7 @@ public async Task ReturnsAsync_3Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -151,7 +151,7 @@ public async Task ReturnsAsync_3Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -163,7 +163,7 @@ public async Task ReturnsAsync_4Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -175,7 +175,7 @@ public async Task ReturnsAsync_4Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(20); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -187,7 +187,7 @@ public async Task ReturnsAsync_4Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -203,7 +203,7 @@ public async Task ReturnsAsync_4Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -216,7 +216,7 @@ public async Task ReturnsAsync_5Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -229,7 +229,7 @@ public async Task ReturnsAsync_5Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(25); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -242,7 +242,7 @@ public async Task ReturnsAsync_5Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -259,7 +259,7 @@ public async Task ReturnsAsync_5Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_NoParameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -270,7 +270,7 @@ public async Task ReturnsAsync_NoParameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_NoParameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -281,7 +281,7 @@ public async Task ReturnsAsync_NoParameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_NoParameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -296,7 +296,7 @@ public async Task ReturnsAsync_NoParameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_WithParameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -307,7 +307,7 @@ public async Task ReturnsAsync_WithParameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_WithParameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -318,7 +318,7 @@ public async Task ReturnsAsync_WithParameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task Returns_TaskFactory_ShouldReturnPendingTaskAsIs() { TaskCompletionSource completionSource = new(); @@ -337,7 +337,7 @@ await That(result.IsCompleted).IsFalse() #if NET8_0_OR_GREATER public sealed class ReturnsValueTaskTests { - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -348,7 +348,7 @@ public async Task ReturnsAsync_1Parameter_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -359,7 +359,7 @@ public async Task ReturnsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredVal await That(result).IsEqualTo(12); } - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -370,7 +370,7 @@ public async Task ReturnsAsync_1Parameter_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_1Parameter_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -385,7 +385,7 @@ public async Task ReturnsAsync_1Parameter_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -396,7 +396,7 @@ public async Task ReturnsAsync_2Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -407,7 +407,7 @@ public async Task ReturnsAsync_2Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(13); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -418,7 +418,7 @@ public async Task ReturnsAsync_2Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_2Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -434,7 +434,7 @@ public async Task ReturnsAsync_2Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -445,7 +445,7 @@ public async Task ReturnsAsync_3Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -457,7 +457,7 @@ public async Task ReturnsAsync_3Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(16); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -468,7 +468,7 @@ public async Task ReturnsAsync_3Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_3Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -484,7 +484,7 @@ public async Task ReturnsAsync_3Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -496,7 +496,7 @@ public async Task ReturnsAsync_4Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -508,7 +508,7 @@ public async Task ReturnsAsync_4Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(20); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -520,7 +520,7 @@ public async Task ReturnsAsync_4Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_4Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -536,7 +536,7 @@ public async Task ReturnsAsync_4Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -549,7 +549,7 @@ public async Task ReturnsAsync_5Parameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_CallbackWithValues_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -562,7 +562,7 @@ public async Task ReturnsAsync_5Parameters_CallbackWithValues_ReturnsConfiguredV await That(result).IsEqualTo(25); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -575,7 +575,7 @@ public async Task ReturnsAsync_5Parameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_5Parameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -592,7 +592,7 @@ public async Task ReturnsAsync_5Parameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_NoParameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -603,7 +603,7 @@ public async Task ReturnsAsync_NoParameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_NoParameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -614,7 +614,7 @@ public async Task ReturnsAsync_NoParameters_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_NoParameters_ShouldSupportWhenAndFor() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -629,7 +629,7 @@ public async Task ReturnsAsync_NoParameters_ShouldSupportWhenAndFor() await That(result3).IsEqualTo(0); } - [Fact] + [Test] public async Task ReturnsAsync_WithParameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -640,7 +640,7 @@ public async Task ReturnsAsync_WithParameters_Callback_ReturnsConfiguredValue() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task ReturnsAsync_WithParameters_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -655,7 +655,7 @@ public async Task ReturnsAsync_WithParameters_ReturnsConfiguredValue() public sealed class ThrowsTaskTests { - [Fact] + [Test] public async Task ThrowsAsync_1Parameter_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -666,7 +666,7 @@ public async Task ThrowsAsync_1Parameter_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -677,7 +677,7 @@ public async Task ThrowsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredValu await That(() => task).Throws().WithMessage("foo-1"); } - [Fact] + [Test] public async Task ThrowsAsync_1Parameter_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -688,7 +688,7 @@ public async Task ThrowsAsync_1Parameter_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_2Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -699,7 +699,7 @@ public async Task ThrowsAsync_2Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_2Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -711,7 +711,7 @@ public async Task ThrowsAsync_2Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2"); } - [Fact] + [Test] public async Task ThrowsAsync_2Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -722,7 +722,7 @@ public async Task ThrowsAsync_2Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_3Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -734,7 +734,7 @@ public async Task ThrowsAsync_3Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_3Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -746,7 +746,7 @@ public async Task ThrowsAsync_3Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2-3"); } - [Fact] + [Test] public async Task ThrowsAsync_3Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -758,7 +758,7 @@ public async Task ThrowsAsync_3Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_4Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -770,7 +770,7 @@ public async Task ThrowsAsync_4Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_4Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -782,7 +782,7 @@ public async Task ThrowsAsync_4Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2-3-4"); } - [Fact] + [Test] public async Task ThrowsAsync_4Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -794,7 +794,7 @@ public async Task ThrowsAsync_4Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_5Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -807,7 +807,7 @@ public async Task ThrowsAsync_5Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_5Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -820,7 +820,7 @@ public async Task ThrowsAsync_5Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task ThrowsAsync_5Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -833,7 +833,7 @@ public async Task ThrowsAsync_5Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_NoParameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -844,7 +844,7 @@ public async Task ThrowsAsync_NoParameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_NoParameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -859,7 +859,7 @@ public async Task ThrowsAsync_NoParameters_Exception_ReturnsConfiguredValue() #if NET8_0_OR_GREATER public sealed class ThrowsValueTaskTests { - [Fact] + [Test] public async Task ThrowsAsync_1Parameter_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -870,7 +870,7 @@ public async Task ThrowsAsync_1Parameter_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -881,7 +881,7 @@ public async Task ThrowsAsync_1Parameter_CallbackWithValue_ReturnsConfiguredValu await That(() => task).Throws().WithMessage("foo-1"); } - [Fact] + [Test] public async Task ThrowsAsync_1Parameter_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -892,7 +892,7 @@ public async Task ThrowsAsync_1Parameter_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_2Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -903,7 +903,7 @@ public async Task ThrowsAsync_2Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_2Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -915,7 +915,7 @@ public async Task ThrowsAsync_2Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2"); } - [Fact] + [Test] public async Task ThrowsAsync_2Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -926,7 +926,7 @@ public async Task ThrowsAsync_2Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_3Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -938,7 +938,7 @@ public async Task ThrowsAsync_3Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_3Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -950,7 +950,7 @@ public async Task ThrowsAsync_3Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2-3"); } - [Fact] + [Test] public async Task ThrowsAsync_3Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -962,7 +962,7 @@ public async Task ThrowsAsync_3Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_4Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -974,7 +974,7 @@ public async Task ThrowsAsync_4Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_4Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -986,7 +986,7 @@ public async Task ThrowsAsync_4Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2-3-4"); } - [Fact] + [Test] public async Task ThrowsAsync_4Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -998,7 +998,7 @@ public async Task ThrowsAsync_4Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_5Parameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -1011,7 +1011,7 @@ public async Task ThrowsAsync_5Parameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_5Parameters_CallbackWithValue_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -1024,7 +1024,7 @@ public async Task ThrowsAsync_5Parameters_CallbackWithValue_ReturnsConfiguredVal await That(() => task).Throws().WithMessage("foo-1-2-3-4-5"); } - [Fact] + [Test] public async Task ThrowsAsync_5Parameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -1037,7 +1037,7 @@ public async Task ThrowsAsync_5Parameters_Exception_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_NoParameters_Callback_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); @@ -1048,7 +1048,7 @@ public async Task ThrowsAsync_NoParameters_Callback_ReturnsConfiguredValue() await That(() => task).Throws().WithMessage("foo"); } - [Fact] + [Test] public async Task ThrowsAsync_NoParameters_Exception_ReturnsConfiguredValue() { IReturnsAsyncExtensionsSetupTest sut = IReturnsAsyncExtensionsSetupTest.CreateMock(); diff --git a/Tests/Mockolate.Tests/ScenarioTests.cs b/Tests/Mockolate.Tests/ScenarioTests.cs index ccc4463ca..a82d95fc0 100644 --- a/Tests/Mockolate.Tests/ScenarioTests.cs +++ b/Tests/Mockolate.Tests/ScenarioTests.cs @@ -8,7 +8,7 @@ public sealed class ScenarioTests { public sealed class InScenarioTests { - [Fact] + [Test] public async Task InScenario_IndexerArity2_ShouldScopeTheSetup() { IScenarioService sut = IScenarioService.CreateMock(); @@ -21,7 +21,7 @@ public async Task InScenario_IndexerArity2_ShouldScopeTheSetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task InScenario_IndexerArity3_ShouldScopeTheSetup() { IScenarioService sut = IScenarioService.CreateMock(); @@ -34,7 +34,7 @@ public async Task InScenario_IndexerArity3_ShouldScopeTheSetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task InScenario_IndexerArity4_ShouldScopeTheSetup() { IScenarioService sut = IScenarioService.CreateMock(); @@ -47,7 +47,7 @@ public async Task InScenario_IndexerArity4_ShouldScopeTheSetup() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task InScenario_IndexerGetter_ShouldScopeTheSetup() { IScenarioService sut = IScenarioService.CreateMock(); @@ -63,7 +63,7 @@ public async Task InScenario_IndexerGetter_ShouldScopeTheSetup() await That(resultScoped).IsEqualTo(42); } - [Fact] + [Test] public async Task InScenario_LambdaOverload_ShouldRegisterAllSetupsInTheScope() { IScenarioService sut = IScenarioService.CreateMock(); @@ -82,7 +82,7 @@ public async Task InScenario_LambdaOverload_ShouldRegisterAllSetupsInTheScope() await That(r2).IsEqualTo(99); } - [Fact] + [Test] public async Task InScenario_LambdaOverload_ShouldReturnMockToAllowFurtherChaining() { IScenarioService sut = IScenarioService.CreateMock(); @@ -100,7 +100,7 @@ public async Task InScenario_LambdaOverload_ShouldReturnMockToAllowFurtherChaini await That(rb).IsEqualTo(2); } - [Fact] + [Test] public async Task InScenario_SetupsShouldNotLeakIntoDefaultScope() { IScenarioService sut = IScenarioService.CreateMock(); @@ -113,7 +113,7 @@ public async Task InScenario_SetupsShouldNotLeakIntoDefaultScope() await That(result).IsEqualTo(7); } - [Fact] + [Test] public async Task InScenario_ShouldActivateWhenScenarioMatches() { IScenarioService sut = IScenarioService.CreateMock(); @@ -127,7 +127,7 @@ public async Task InScenario_ShouldActivateWhenScenarioMatches() await That(result).IsEqualTo(42); } - [Fact] + [Test] public async Task InScenario_ShouldFallBackToDefaultScopeWhenNoMatchingSetup() { IScenarioService sut = IScenarioService.CreateMock(); @@ -143,7 +143,7 @@ public async Task InScenario_ShouldFallBackToDefaultScopeWhenNoMatchingSetup() public sealed class TransitionToTests { - [Fact] + [Test] public async Task EventSubscription_ShouldNotFireOnUnsubscribe() { IScenarioService sut = IScenarioService.CreateMock(); @@ -158,7 +158,7 @@ public async Task EventSubscription_ShouldNotFireOnUnsubscribe() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task EventSubscription_ShouldSwitchScenarioWhenSubscribed() { IScenarioService sut = IScenarioService.CreateMock(); @@ -171,7 +171,7 @@ public async Task EventSubscription_ShouldSwitchScenarioWhenSubscribed() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task EventUnsubscription_ShouldNotFireOnSubscribe() { IScenarioService sut = IScenarioService.CreateMock(); @@ -184,7 +184,7 @@ public async Task EventUnsubscription_ShouldNotFireOnSubscribe() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task EventUnsubscription_ShouldSwitchScenarioWhenUnsubscribed() { IScenarioService sut = IScenarioService.CreateMock(); @@ -197,7 +197,7 @@ public async Task EventUnsubscription_ShouldSwitchScenarioWhenUnsubscribed() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerGetter_Arity1_ShouldSwitchScenarioOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -210,7 +210,7 @@ public async Task IndexerGetter_Arity1_ShouldSwitchScenarioOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerGetter_Arity2_ShouldSwitchScenarioOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -223,7 +223,7 @@ public async Task IndexerGetter_Arity2_ShouldSwitchScenarioOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerGetter_Arity3_ShouldSwitchScenarioOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -237,7 +237,7 @@ public async Task IndexerGetter_Arity3_ShouldSwitchScenarioOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerGetter_Arity4_ShouldSwitchScenarioOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -251,7 +251,7 @@ public async Task IndexerGetter_Arity4_ShouldSwitchScenarioOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerGetter_Arity5_ShouldSwitchScenarioOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -265,7 +265,7 @@ public async Task IndexerGetter_Arity5_ShouldSwitchScenarioOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerGetter_ShouldNotFireOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -278,7 +278,7 @@ public async Task IndexerGetter_ShouldNotFireOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task IndexerSetter_Arity1_ShouldSwitchScenarioOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -291,7 +291,7 @@ public async Task IndexerSetter_Arity1_ShouldSwitchScenarioOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerSetter_Arity2_ShouldSwitchScenarioOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -304,7 +304,7 @@ public async Task IndexerSetter_Arity2_ShouldSwitchScenarioOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerSetter_Arity3_ShouldSwitchScenarioOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -318,7 +318,7 @@ public async Task IndexerSetter_Arity3_ShouldSwitchScenarioOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerSetter_Arity4_ShouldSwitchScenarioOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -332,7 +332,7 @@ public async Task IndexerSetter_Arity4_ShouldSwitchScenarioOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerSetter_Arity5_ShouldSwitchScenarioOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -346,7 +346,7 @@ public async Task IndexerSetter_Arity5_ShouldSwitchScenarioOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task IndexerSetter_ShouldNotFireOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -359,7 +359,7 @@ public async Task IndexerSetter_ShouldNotFireOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task Method_ReturnArity0_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -373,7 +373,7 @@ public async Task Method_ReturnArity0_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_ReturnArity1_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -387,7 +387,7 @@ public async Task Method_ReturnArity1_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_ReturnArity2_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -401,7 +401,7 @@ public async Task Method_ReturnArity2_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_ReturnArity3_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -417,7 +417,7 @@ public async Task Method_ReturnArity3_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_ReturnArity4_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -433,7 +433,7 @@ public async Task Method_ReturnArity4_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_ReturnArity5_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -449,7 +449,7 @@ public async Task Method_ReturnArity5_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_VoidArity0_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -462,7 +462,7 @@ public async Task Method_VoidArity0_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_VoidArity1_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -475,7 +475,7 @@ public async Task Method_VoidArity1_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_VoidArity2_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -488,7 +488,7 @@ public async Task Method_VoidArity2_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_VoidArity3_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -503,7 +503,7 @@ public async Task Method_VoidArity3_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_VoidArity4_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -518,7 +518,7 @@ public async Task Method_VoidArity4_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Method_VoidArity5_ShouldSwitchScenarioWhenInvoked() { IScenarioService sut = IScenarioService.CreateMock(); @@ -533,7 +533,7 @@ public async Task Method_VoidArity5_ShouldSwitchScenarioWhenInvoked() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Mock_TransitionTo_ShouldReturnMockForChaining() { IScenarioService sut = IScenarioService.CreateMock(); @@ -547,7 +547,7 @@ public async Task Mock_TransitionTo_ShouldReturnMockForChaining() await That(changedSut).IsSameAs(sut); } - [Fact] + [Test] public async Task Mock_TransitionTo_ShouldSetActiveScenario() { IScenarioService sut = IScenarioService.CreateMock(); @@ -557,7 +557,7 @@ public async Task Mock_TransitionTo_ShouldSetActiveScenario() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("scoped"); } - [Fact] + [Test] public async Task Property_Getter_ShouldNotFireOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -570,7 +570,7 @@ public async Task Property_Getter_ShouldNotFireOnWrite() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task Property_Getter_ShouldSwitchScenarioOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -583,7 +583,7 @@ public async Task Property_Getter_ShouldSwitchScenarioOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task Property_Setter_ShouldNotFireOnRead() { IScenarioService sut = IScenarioService.CreateMock(); @@ -596,7 +596,7 @@ public async Task Property_Setter_ShouldNotFireOnRead() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task Property_Setter_ShouldSwitchScenarioOnWrite() { IScenarioService sut = IScenarioService.CreateMock(); @@ -612,7 +612,7 @@ public async Task Property_Setter_ShouldSwitchScenarioOnWrite() public sealed class TransitionToConditionalTests { - [Fact] + [Test] public async Task For_ShouldLimitTransitionsToGivenCount() { IScenarioService sut = IScenarioService.CreateMock(); @@ -628,7 +628,7 @@ public async Task For_ShouldLimitTransitionsToGivenCount() await That(afterSecond).IsEqualTo("reset"); } - [Fact] + [Test] public async Task IndexerGetter_Arity5_WithWhenAndFor_ShouldRespectBothConstraints() { IScenarioService sut = IScenarioService.CreateMock(); @@ -650,7 +650,7 @@ public async Task IndexerGetter_Arity5_WithWhenAndFor_ShouldRespectBothConstrain await That(afterThird).IsEqualTo("reset"); } - [Fact] + [Test] public async Task IndexerSetter_Arity5_WithWhenAndFor_ShouldRespectBothConstraints() { IScenarioService sut = IScenarioService.CreateMock(); @@ -672,7 +672,7 @@ public async Task IndexerSetter_Arity5_WithWhenAndFor_ShouldRespectBothConstrain await That(afterThird).IsEqualTo("reset"); } - [Fact] + [Test] public async Task When_PredicateNeverTrue_ShouldNotTransition() { IScenarioService sut = IScenarioService.CreateMock(); @@ -686,7 +686,7 @@ public async Task When_PredicateNeverTrue_ShouldNotTransition() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task When_ShouldDeferTransitionUntilPredicateMatches() { IScenarioService sut = IScenarioService.CreateMock(); @@ -702,7 +702,7 @@ public async Task When_ShouldDeferTransitionUntilPredicateMatches() await That(afterSecond).IsEqualTo("b"); } - [Fact] + [Test] public async Task WhenAndFor_ShouldRespectBothConstraints() { IScenarioService sut = IScenarioService.CreateMock(); @@ -724,7 +724,7 @@ public async Task WhenAndFor_ShouldRespectBothConstraints() public sealed class ProtectedTests { - [Fact] + [Test] public async Task InScenario_LambdaOverload_ShouldSupportSetupProtected() { ProtectedMockTests.MyProtectedClass sut = ProtectedMockTests.MyProtectedClass.CreateMock(); @@ -740,7 +740,7 @@ public async Task InScenario_LambdaOverload_ShouldSupportSetupProtected() await That(result).IsEqualTo("scoped"); } - [Fact] + [Test] public async Task InScenario_SetupProtectedMethod_ShouldScopeTheSetup() { ProtectedMockTests.MyProtectedClass sut = ProtectedMockTests.MyProtectedClass.CreateMock(); @@ -756,7 +756,7 @@ public async Task InScenario_SetupProtectedMethod_ShouldScopeTheSetup() await That(scopedResult).IsEqualTo("scoped"); } - [Fact] + [Test] public async Task InScenario_SetupProtectedProperty_ShouldScopeTheSetup() { ProtectedMockTests.MyProtectedClass sut = ProtectedMockTests.MyProtectedClass.CreateMock(); @@ -770,7 +770,7 @@ public async Task InScenario_SetupProtectedProperty_ShouldScopeTheSetup() await That(result).IsEqualTo(99); } - [Fact] + [Test] public async Task TransitionTo_FromProtectedMethod_ShouldSwitchScenario() { ProtectedMockTests.MyProtectedClass sut = ProtectedMockTests.MyProtectedClass.CreateMock(); @@ -787,7 +787,7 @@ public async Task TransitionTo_FromProtectedMethod_ShouldSwitchScenario() public sealed class SharedScenarioStateTests { - [Fact] + [Test] public async Task InScenarioSetup_ShouldApplyForDispatchDuringMonitorScope() { IScenarioService sut = IScenarioService.CreateMock(); @@ -808,7 +808,7 @@ public async Task InScenarioSetup_ShouldApplyForDispatchDuringMonitorScope() await That(scopedResult).IsEqualTo(42); } - [Fact] + [Test] public async Task InScenarioSetup_ShouldApplyWhenDispatchingViaWrappedMock() { IChocolateDispenser original = IChocolateDispenser.CreateMock(); @@ -824,7 +824,7 @@ public async Task InScenarioSetup_ShouldApplyWhenDispatchingViaWrappedMock() await That(scopedResult).IsTrue(); } - [Fact] + [Test] public async Task TransitionTo_OnOriginal_ShouldBeVisibleOnWrappedMock() { IChocolateDispenser original = IChocolateDispenser.CreateMock(); @@ -835,7 +835,7 @@ public async Task TransitionTo_OnOriginal_ShouldBeVisibleOnWrappedMock() await That(((IMock)wrapped).MockRegistry.Scenario).IsEqualTo("a"); } - [Fact] + [Test] public async Task TransitionTo_OnWrappedMock_ShouldBeVisibleOnOriginal() { IChocolateDispenser original = IChocolateDispenser.CreateMock(); @@ -846,7 +846,7 @@ public async Task TransitionTo_OnWrappedMock_ShouldBeVisibleOnOriginal() await That(((IMock)original).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task TransitionToFromSetup_CreatedAfterWrapping_ShouldStillPropagateToWrappedMock() { IChocolateDispenser original = IChocolateDispenser.CreateMock(); @@ -861,7 +861,7 @@ public async Task TransitionToFromSetup_CreatedAfterWrapping_ShouldStillPropagat await That(((IMock)original).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task TransitionToFromSetup_ShouldFireWhenDispatchingDuringMonitorScope() { IScenarioService sut = IScenarioService.CreateMock(); @@ -877,7 +877,7 @@ public async Task TransitionToFromSetup_ShouldFireWhenDispatchingDuringMonitorSc await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task TransitionToFromSetup_ShouldPropagateToWrappedMock() { IChocolateDispenser original = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/ScenarioTransitionToInParallelTests.cs b/Tests/Mockolate.Tests/ScenarioTransitionToInParallelTests.cs index 7bed94eeb..84964563b 100644 --- a/Tests/Mockolate.Tests/ScenarioTransitionToInParallelTests.cs +++ b/Tests/Mockolate.Tests/ScenarioTransitionToInParallelTests.cs @@ -4,7 +4,7 @@ namespace Mockolate.Tests; public sealed class ScenarioTransitionToInParallelTests { - [Fact] + [Test] public async Task EventSubscription_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -19,7 +19,7 @@ public async Task EventSubscription_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task EventUnsubscription_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -34,7 +34,7 @@ public async Task EventUnsubscription_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task PropertyGetter_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -49,7 +49,7 @@ public async Task PropertyGetter_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task PropertySetter_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -64,7 +64,7 @@ public async Task PropertySetter_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task ReturnMethod_Arity1_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -79,7 +79,7 @@ public async Task ReturnMethod_Arity1_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task ReturnMethod_Arity2_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -94,7 +94,7 @@ public async Task ReturnMethod_Arity2_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task ReturnMethod_Arity3_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -110,7 +110,7 @@ public async Task ReturnMethod_Arity3_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task ReturnMethod_Arity4_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -126,7 +126,7 @@ public async Task ReturnMethod_Arity4_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task VoidMethod_Arity0_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -141,7 +141,7 @@ public async Task VoidMethod_Arity0_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task VoidMethod_Arity1_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -156,7 +156,7 @@ public async Task VoidMethod_Arity1_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task VoidMethod_Arity2_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -171,7 +171,7 @@ public async Task VoidMethod_Arity2_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task VoidMethod_Arity3_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); @@ -186,7 +186,7 @@ public async Task VoidMethod_Arity3_TransitionsEvenAfterPrecedingCallbackRan() await That(((IMock)sut).MockRegistry.Scenario).IsEqualTo("b"); } - [Fact] + [Test] public async Task VoidMethod_Arity4_TransitionsEvenAfterPrecedingCallbackRan() { IScenarioService sut = IScenarioService.CreateMock(); diff --git a/Tests/Mockolate.Tests/Setup/CallbackTests.cs b/Tests/Mockolate.Tests/Setup/CallbackTests.cs index 119caf8d8..6a7a97d76 100644 --- a/Tests/Mockolate.Tests/Setup/CallbackTests.cs +++ b/Tests/Mockolate.Tests/Setup/CallbackTests.cs @@ -7,7 +7,7 @@ public class CallbackTests { public sealed class InvokeForCallbacksTests { - [Fact] + [Test] public async Task ShouldIncludeIndexWhenMatching() { bool wasInvoked = false; @@ -25,9 +25,9 @@ public async Task ShouldIncludeIndexWhenMatching() await That(values).IsEqualTo([2, 3,]); } - [Theory] - [InlineData(2, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2)] - [InlineData(2, 1, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2)] + [Test] + [Arguments(2, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2)] + [Arguments(2, 1, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2)] public async Task ShouldIncrementIndexOnceWhenCallbackIsExhausted( int only, int when, params int[] expectResult) { @@ -47,9 +47,9 @@ public async Task ShouldIncrementIndexOnceWhenCallbackIsExhausted( await That(indexValues).IsEqualTo(expectResult); } - [Theory] - [InlineData(2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2)] - [InlineData(2, 3, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3)] + [Test] + [Arguments(2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2)] + [Arguments(2, 3, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3)] public async Task ShouldIncrementIndexWheneverForIsExhausted( int @for, int only, params int[] expectResult) { @@ -69,7 +69,7 @@ public async Task ShouldIncrementIndexWheneverForIsExhausted( await That(indexValues).IsEqualTo(expectResult); } - [Fact] + [Test] public async Task ShouldLimitExecutionWhenRunningInParallel() { bool wasInvoked = false; @@ -87,7 +87,7 @@ public async Task ShouldLimitExecutionWhenRunningInParallel() await That(values).IsEqualTo([0, 1,]); } - [Fact] + [Test] public async Task WhenCheck_ShouldOnlyBeCalledWhenOnlyLimitIsNotReached() { bool wasInvoked = false; @@ -113,12 +113,12 @@ public async Task WhenCheck_ShouldOnlyBeCalledWhenOnlyLimitIsNotReached() await That(invocationCount).IsEqualTo(8); } - [Theory] - [InlineData(1, false)] - [InlineData(2, false)] - [InlineData(3, true)] - [InlineData(4, true)] - [InlineData(5, false)] + [Test] + [Arguments(1, false)] + [Arguments(2, false)] + [Arguments(3, true)] + [Arguments(4, true)] + [Arguments(5, false)] public async Task WithForAndWhen_ShouldMatchInExpectedIterations( int iterations, bool expectResult) { @@ -140,7 +140,7 @@ public async Task WithForAndWhen_ShouldMatchInExpectedIterations( public sealed class InvokeWithStateForCallbacksTests { - [Fact] + [Test] public async Task ShouldIncludeIndexWhenMatching() { bool wasInvoked = false; @@ -158,9 +158,9 @@ public async Task ShouldIncludeIndexWhenMatching() await That(values).IsEqualTo([2, 3,]); } - [Theory] - [InlineData(2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2)] - [InlineData(2, 3, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3)] + [Test] + [Arguments(2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2)] + [Arguments(2, 3, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3)] public async Task ShouldIncrementIndexWheneverForIsExhausted( int @for, int only, params int[] expectResult) { @@ -180,7 +180,7 @@ public async Task ShouldIncrementIndexWheneverForIsExhausted( await That(indexValues).IsEqualTo(expectResult); } - [Fact] + [Test] public async Task ShouldLimitExecutionWhenRunningInParallel() { bool wasInvoked = false; @@ -201,7 +201,7 @@ public async Task ShouldLimitExecutionWhenRunningInParallel() public sealed class InvokeForVoidThrowsTests { - [Fact] + [Test] public async Task ShouldIncludeIndexWhenMatching() { List values = []; @@ -218,7 +218,7 @@ public async Task ShouldIncludeIndexWhenMatching() await That(values).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task WhenCheck_ShouldOnlyBeCalledWhenOnlyLimitIsNotReached() { int[] expectResult = [0, 1, 2, 3, 4, 5, 6, 7,]; @@ -243,12 +243,12 @@ public async Task WhenCheck_ShouldOnlyBeCalledWhenOnlyLimitIsNotReached() await That(invocationCount).IsEqualTo(8); } - [Theory] - [InlineData(1, false)] - [InlineData(2, false)] - [InlineData(3, true)] - [InlineData(4, true)] - [InlineData(5, false)] + [Test] + [Arguments(1, false)] + [Arguments(2, false)] + [Arguments(3, true)] + [Arguments(4, true)] + [Arguments(5, false)] public async Task WithForAndWhen_ShouldMatchInExpectedIterations( int iterations, bool expectResult) { @@ -269,7 +269,7 @@ public async Task WithForAndWhen_ShouldMatchInExpectedIterations( public sealed class InvokeForReturnThrowsTests { - [Fact] + [Test] public async Task ShouldIncludeIndexWhenMatching() { List values = []; @@ -290,7 +290,7 @@ public async Task ShouldIncludeIndexWhenMatching() await That(values).IsEqualTo([2, 3,]); } - [Fact] + [Test] public async Task WhenCheck_ShouldOnlyBeCalledWhenOnlyLimitIsNotReached() { int[] expectResult = [0, 1, 2, 3, 4, 5, 6, 7,]; @@ -319,12 +319,12 @@ public async Task WhenCheck_ShouldOnlyBeCalledWhenOnlyLimitIsNotReached() await That(invocationCount).IsEqualTo(8); } - [Theory] - [InlineData(1, false)] - [InlineData(2, false)] - [InlineData(3, true)] - [InlineData(4, true)] - [InlineData(5, false)] + [Test] + [Arguments(1, false)] + [Arguments(2, false)] + [Arguments(3, true)] + [Arguments(4, true)] + [Arguments(5, false)] public async Task WithForAndWhen_ShouldMatchInExpectedIterations( int iterations, bool expectResult) { @@ -345,7 +345,7 @@ public async Task WithForAndWhen_ShouldMatchInExpectedIterations( public sealed class InvokeWithStateForReturnThrowsTests { - [Fact] + [Test] public async Task ShouldIncludeIndexWhenMatching() { List values = []; diff --git a/Tests/Mockolate.Tests/Setup/ReadOnlySpanWrapperTests.cs b/Tests/Mockolate.Tests/Setup/ReadOnlySpanWrapperTests.cs index 6fab7cc7a..7ee8b8cde 100644 --- a/Tests/Mockolate.Tests/Setup/ReadOnlySpanWrapperTests.cs +++ b/Tests/Mockolate.Tests/Setup/ReadOnlySpanWrapperTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests.Setup; public class ReadOnlySpanWrapperTests { - [Fact] + [Test] public async Task Equals_WithDifferentLength_ShouldReturnFalse() { ReadOnlySpanWrapper sut = new([1, 2,]); @@ -15,7 +15,7 @@ await That(sut.Equals(new ReadOnlySpanWrapper([1,]))).IsFalse() .Because("a shorter span is not the same span"); } - [Fact] + [Test] public async Task Equals_WithDifferentValues_ShouldReturnFalse() { ReadOnlySpanWrapper sut = new([1, 2,]); @@ -23,7 +23,7 @@ public async Task Equals_WithDifferentValues_ShouldReturnFalse() await That(sut.Equals(new ReadOnlySpanWrapper([1, 3,]))).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithEqualValues_ShouldReturnTrue() { ReadOnlySpanWrapper sut = new([1, 2,]); @@ -32,7 +32,7 @@ await That(sut.Equals(new ReadOnlySpanWrapper([1, 2,]))).IsTrue() .Because("equality is content-based, so a re-wrapped span with the same values matches"); } - [Fact] + [Test] public async Task Equals_WithNull_ShouldReturnFalse() { ReadOnlySpanWrapper sut = new([1,]); @@ -40,7 +40,7 @@ public async Task Equals_WithNull_ShouldReturnFalse() await That(sut.Equals(null)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithSpanWrapper_ShouldReturnFalse() { ReadOnlySpanWrapper sut = new([1,]); @@ -49,7 +49,7 @@ await That(sut.Equals(new SpanWrapper([1,]))).IsFalse() .Because("the two wrappers represent different parameter shapes"); } - [Fact] + [Test] public async Task GetHashCode_WithEqualValues_ShouldMatch() { ReadOnlySpanWrapper sut = new([1, 2,]); @@ -57,7 +57,7 @@ public async Task GetHashCode_WithEqualValues_ShouldMatch() await That(sut.GetHashCode()).IsEqualTo(new ReadOnlySpanWrapper([1, 2,]).GetHashCode()); } - [Fact] + [Test] public async Task GetHashCode_WithNullElement_ShouldNotThrow() { ReadOnlySpanWrapper sut = new([null, "a",]); @@ -66,7 +66,7 @@ await That(sut.GetHashCode).DoesNotThrow() .Because("a reference-typed span may carry null elements"); } - [Fact] + [Test] public async Task ToString_ShouldRenderElementTypeAndValues() { ReadOnlySpanWrapper sut = new([1, 2,]); diff --git a/Tests/Mockolate.Tests/Setup/SpanWrapperTests.cs b/Tests/Mockolate.Tests/Setup/SpanWrapperTests.cs index b876d2747..7a43d6e10 100644 --- a/Tests/Mockolate.Tests/Setup/SpanWrapperTests.cs +++ b/Tests/Mockolate.Tests/Setup/SpanWrapperTests.cs @@ -6,7 +6,7 @@ namespace Mockolate.Tests.Setup; public class SpanWrapperTests { - [Fact] + [Test] public async Task Equals_WithDifferentLength_ShouldReturnFalse() { SpanWrapper sut = new([1, 2,]); @@ -15,7 +15,7 @@ await That(sut.Equals(new SpanWrapper([1,]))).IsFalse() .Because("a shorter span is not the same span"); } - [Fact] + [Test] public async Task Equals_WithDifferentValues_ShouldReturnFalse() { SpanWrapper sut = new([1, 2,]); @@ -23,7 +23,7 @@ public async Task Equals_WithDifferentValues_ShouldReturnFalse() await That(sut.Equals(new SpanWrapper([1, 3,]))).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithEqualValues_ShouldReturnTrue() { SpanWrapper sut = new([1, 2,]); @@ -32,7 +32,7 @@ await That(sut.Equals(new SpanWrapper([1, 2,]))).IsTrue() .Because("equality is content-based, so a re-wrapped span with the same values matches"); } - [Fact] + [Test] public async Task Equals_WithNull_ShouldReturnFalse() { SpanWrapper sut = new([1,]); @@ -40,7 +40,7 @@ public async Task Equals_WithNull_ShouldReturnFalse() await That(sut.Equals(null)).IsFalse(); } - [Fact] + [Test] public async Task Equals_WithReadOnlySpanWrapper_ShouldReturnFalse() { SpanWrapper sut = new([1,]); @@ -49,7 +49,7 @@ await That(sut.Equals(new ReadOnlySpanWrapper([1,]))).IsFalse() .Because("the two wrappers represent different parameter shapes"); } - [Fact] + [Test] public async Task GetHashCode_WithEqualValues_ShouldMatch() { SpanWrapper sut = new([1, 2,]); @@ -57,7 +57,7 @@ public async Task GetHashCode_WithEqualValues_ShouldMatch() await That(sut.GetHashCode()).IsEqualTo(new SpanWrapper([1, 2,]).GetHashCode()); } - [Fact] + [Test] public async Task GetHashCode_WithNullElement_ShouldNotThrow() { SpanWrapper sut = new([null, "a",]); @@ -66,7 +66,7 @@ await That(sut.GetHashCode).DoesNotThrow() .Because("a reference-typed span may carry null elements"); } - [Fact] + [Test] public async Task ToString_ShouldRenderElementTypeAndValues() { SpanWrapper sut = new([1, 2,]); diff --git a/Tests/Mockolate.Tests/SetupExtensionsTests.cs b/Tests/Mockolate.Tests/SetupExtensionsTests.cs index 5a75ea54d..cff72dbba 100644 --- a/Tests/Mockolate.Tests/SetupExtensionsTests.cs +++ b/Tests/Mockolate.Tests/SetupExtensionsTests.cs @@ -6,7 +6,7 @@ public sealed class SetupExtensionsTests { public sealed class PropertySetupReturnWhenBuilderTests { - [Fact] + [Test] public async Task Forever_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -21,7 +21,7 @@ public async Task Forever_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -36,7 +36,7 @@ public async Task Forever_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task OnlyOnce_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -52,7 +52,7 @@ public async Task OnlyOnce_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -71,7 +71,7 @@ public async Task OnlyOnce_WithFor_ShouldApplySetupOnlyForTimes() public sealed class PropertySetupWhenBuilderTests { - [Fact] + [Test] public async Task OnlyOnce_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -86,7 +86,7 @@ public async Task OnlyOnce_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -101,7 +101,7 @@ public async Task OnlyOnce_WithFor_ShouldInvokeTheCallbackOnlyForTimes() await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnSet_OnlyOnce_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -119,7 +119,7 @@ public async Task OnSet_OnlyOnce_WithFor_ShouldInvokeTheCallbackOnlyForTimes() public sealed class IndexerSetupReturnWhenBuilderTests { - [Fact] + [Test] public async Task Forever_With1Parameter_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -134,7 +134,7 @@ public async Task Forever_With1Parameter_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With1Parameter_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -149,7 +149,7 @@ public async Task Forever_With1Parameter_When_ShouldKeepApplyingTheSetupWhenTheP await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With2Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -164,7 +164,7 @@ public async Task Forever_With2Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With2Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -180,7 +180,7 @@ public async Task Forever_With2Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With3Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -196,7 +196,7 @@ public async Task Forever_With3Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With3Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -212,7 +212,7 @@ public async Task Forever_With3Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With4Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -228,7 +228,7 @@ public async Task Forever_With4Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With4Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -244,7 +244,7 @@ public async Task Forever_With4Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With5Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -260,7 +260,7 @@ public async Task Forever_With5Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With5Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -276,7 +276,7 @@ public async Task Forever_With5Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldKeepLastUsedValue() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -295,7 +295,7 @@ public async Task OnlyOnce_With1Parameter_ShouldKeepLastUsedValue() await That(values).IsEqualTo([1, 1, 1, 1, 1, 10, 10, 10, 10, 10,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldUseReturnValueOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -311,7 +311,7 @@ public async Task OnlyOnce_With1Parameter_ShouldUseReturnValueOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -327,7 +327,7 @@ public async Task OnlyOnce_With1Parameter_WithFor_ShouldApplySetupOnlyForTimes() await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldKeepLastUsedValue() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -346,7 +346,7 @@ public async Task OnlyOnce_With2Parameters_ShouldKeepLastUsedValue() await That(values).IsEqualTo([1, 1, 1, 1, 1, 10, 10, 10, 10, 10,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldUseReturnValueOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -362,7 +362,7 @@ public async Task OnlyOnce_With2Parameters_ShouldUseReturnValueOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -378,7 +378,7 @@ public async Task OnlyOnce_With2Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldKeepLastUsedValue() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -397,7 +397,7 @@ public async Task OnlyOnce_With3Parameters_ShouldKeepLastUsedValue() await That(values).IsEqualTo([1, 1, 1, 1, 1, 10, 10, 10, 10, 10,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldUseReturnValueOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -413,7 +413,7 @@ public async Task OnlyOnce_With3Parameters_ShouldUseReturnValueOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -429,7 +429,7 @@ public async Task OnlyOnce_With3Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldKeepLastUsedValue() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -449,7 +449,7 @@ public async Task OnlyOnce_With4Parameters_ShouldKeepLastUsedValue() await That(values).IsEqualTo([1, 1, 1, 1, 1, 10, 10, 10, 10, 10,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldUseReturnValueOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -466,7 +466,7 @@ public async Task OnlyOnce_With4Parameters_ShouldUseReturnValueOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -483,7 +483,7 @@ public async Task OnlyOnce_With4Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldKeepLastUsedValue() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -503,7 +503,7 @@ public async Task OnlyOnce_With5Parameters_ShouldKeepLastUsedValue() await That(values).IsEqualTo([1, 1, 1, 1, 1, 10, 10, 10, 10, 10,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldUseReturnValueOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -520,7 +520,7 @@ public async Task OnlyOnce_With5Parameters_ShouldUseReturnValueOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -540,7 +540,7 @@ public async Task OnlyOnce_With5Parameters_WithFor_ShouldApplySetupOnlyForTimes( public sealed class IndexerSetupWhenBuilderTests { - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -555,7 +555,7 @@ public async Task OnlyOnce_With1Parameter_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -570,7 +570,7 @@ public async Task OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyFor await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -585,7 +585,7 @@ public async Task OnlyOnce_With2Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -600,7 +600,7 @@ public async Task OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -616,7 +616,7 @@ public async Task OnlyOnce_With3Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -632,7 +632,7 @@ public async Task OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -648,7 +648,7 @@ public async Task OnlyOnce_With4Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -664,7 +664,7 @@ public async Task OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -680,7 +680,7 @@ public async Task OnlyOnce_With5Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -696,7 +696,7 @@ public async Task OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnSet_OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -711,7 +711,7 @@ public async Task OnSet_OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackO await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnSet_OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -726,7 +726,7 @@ public async Task OnSet_OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallback await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnSet_OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -742,7 +742,7 @@ public async Task OnSet_OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallback await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnSet_OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -758,7 +758,7 @@ public async Task OnSet_OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallback await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnSet_OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -777,7 +777,7 @@ public async Task OnSet_OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallback public sealed class ReturnMethodSetupReturnWhenBuilderTests { - [Fact] + [Test] public async Task Forever_With0Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -792,7 +792,7 @@ public async Task Forever_With0Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With0Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -807,7 +807,7 @@ public async Task Forever_With0Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With1Parameter_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -822,7 +822,7 @@ public async Task Forever_With1Parameter_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With1Parameter_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -838,7 +838,7 @@ public async Task Forever_With1Parameter_When_ShouldKeepApplyingTheSetupWhenTheP await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With2Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -854,7 +854,7 @@ public async Task Forever_With2Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With2Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -870,7 +870,7 @@ public async Task Forever_With2Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With3Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -886,7 +886,7 @@ public async Task Forever_With3Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With3Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -902,7 +902,7 @@ public async Task Forever_With3Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With4Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -918,7 +918,7 @@ public async Task Forever_With4Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With4Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -934,7 +934,7 @@ public async Task Forever_With4Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With5Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -950,7 +950,7 @@ public async Task Forever_With5Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With5Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -966,7 +966,7 @@ public async Task Forever_With5Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -981,7 +981,7 @@ public async Task OnlyOnce_With0Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -996,7 +996,7 @@ public async Task OnlyOnce_With0Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1011,7 +1011,7 @@ public async Task OnlyOnce_With1Parameter_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1026,7 +1026,7 @@ public async Task OnlyOnce_With1Parameter_WithFor_ShouldApplySetupOnlyForTimes() await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1041,7 +1041,7 @@ public async Task OnlyOnce_With2Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1056,7 +1056,7 @@ public async Task OnlyOnce_With2Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1071,7 +1071,7 @@ public async Task OnlyOnce_With3Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1087,7 +1087,7 @@ public async Task OnlyOnce_With3Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1103,7 +1103,7 @@ public async Task OnlyOnce_With4Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1119,7 +1119,7 @@ public async Task OnlyOnce_With4Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1135,7 +1135,7 @@ public async Task OnlyOnce_With5Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1154,7 +1154,7 @@ public async Task OnlyOnce_With5Parameters_WithFor_ShouldApplySetupOnlyForTimes( public sealed class ReturnMethodSetupWhenBuilderTests { - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1169,7 +1169,7 @@ public async Task OnlyOnce_With0Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1184,7 +1184,7 @@ public async Task OnlyOnce_With0Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1199,7 +1199,7 @@ public async Task OnlyOnce_With1Parameter_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1214,7 +1214,7 @@ public async Task OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyFor await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1229,7 +1229,7 @@ public async Task OnlyOnce_With2Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1245,7 +1245,7 @@ public async Task OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1261,7 +1261,7 @@ public async Task OnlyOnce_With3Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1277,7 +1277,7 @@ public async Task OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1293,7 +1293,7 @@ public async Task OnlyOnce_With4Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1309,7 +1309,7 @@ public async Task OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1325,7 +1325,7 @@ public async Task OnlyOnce_With5Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1344,7 +1344,7 @@ public async Task OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo public sealed class VoidMethodSetupReturnWhenBuilderTests { - [Fact] + [Test] public async Task Forever_With0Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1367,7 +1367,7 @@ public async Task Forever_With0Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With0Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1390,7 +1390,7 @@ public async Task Forever_With0Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With1Parameter_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1413,7 +1413,7 @@ public async Task Forever_With1Parameter_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With1Parameter_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1437,7 +1437,7 @@ public async Task Forever_With1Parameter_When_ShouldKeepApplyingTheSetupWhenTheP await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With2Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1461,7 +1461,7 @@ public async Task Forever_With2Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With2Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1485,7 +1485,7 @@ public async Task Forever_With2Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With3Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1509,7 +1509,7 @@ public async Task Forever_With3Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With3Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1533,7 +1533,7 @@ public async Task Forever_With3Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With4Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1556,7 +1556,7 @@ public async Task Forever_With4Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With4Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1580,7 +1580,7 @@ public async Task Forever_With4Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With5Parameters_ShouldKeepApplyingTheSetup() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1603,7 +1603,7 @@ public async Task Forever_With5Parameters_ShouldKeepApplyingTheSetup() await That(values).IsEqualTo([1, 2, 3, 3, 3, 3, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task Forever_With5Parameters_When_ShouldKeepApplyingTheSetupWhenThePredicateMatches() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1627,7 +1627,7 @@ public async Task Forever_With5Parameters_When_ShouldKeepApplyingTheSetupWhenThe await That(values).IsEqualTo([1, 2, 1, 2, 1, 2, 3, 3, 3, 3,]); } - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1649,7 +1649,7 @@ public async Task OnlyOnce_With0Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1671,7 +1671,7 @@ public async Task OnlyOnce_With0Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1693,7 +1693,7 @@ public async Task OnlyOnce_With1Parameter_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1715,7 +1715,7 @@ public async Task OnlyOnce_With1Parameter_WithFor_ShouldApplySetupOnlyForTimes() await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1737,7 +1737,7 @@ public async Task OnlyOnce_With2Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1760,7 +1760,7 @@ public async Task OnlyOnce_With2Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1783,7 +1783,7 @@ public async Task OnlyOnce_With3Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1807,7 +1807,7 @@ public async Task OnlyOnce_With3Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1830,7 +1830,7 @@ public async Task OnlyOnce_With4Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1853,7 +1853,7 @@ public async Task OnlyOnce_With4Parameters_WithFor_ShouldApplySetupOnlyForTimes( await That(values).IsEqualTo([1, 1, 1, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldApplySetupOnlyOnce() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1876,7 +1876,7 @@ public async Task OnlyOnce_With5Parameters_ShouldApplySetupOnlyOnce() await That(values).IsEqualTo([1, 0, 0, 0, 0, 0, 0, 0, 0, 0,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_WithFor_ShouldApplySetupOnlyForTimes() { ISetupExtensionsTestService sut = ISetupExtensionsTestService.CreateMock(); @@ -1902,7 +1902,7 @@ public async Task OnlyOnce_With5Parameters_WithFor_ShouldApplySetupOnlyForTimes( public sealed class VoidMethodSetupWhenBuilderTests { - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1917,7 +1917,7 @@ public async Task OnlyOnce_With0Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With0Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1932,7 +1932,7 @@ public async Task OnlyOnce_With0Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1947,7 +1947,7 @@ public async Task OnlyOnce_With1Parameter_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1962,7 +1962,7 @@ public async Task OnlyOnce_With1Parameter_WithFor_ShouldInvokeTheCallbackOnlyFor await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -1977,7 +1977,7 @@ public async Task OnlyOnce_With2Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -1993,7 +1993,7 @@ public async Task OnlyOnce_With2Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -2009,7 +2009,7 @@ public async Task OnlyOnce_With3Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -2025,7 +2025,7 @@ public async Task OnlyOnce_With3Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -2041,7 +2041,7 @@ public async Task OnlyOnce_With4Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; @@ -2057,7 +2057,7 @@ public async Task OnlyOnce_With4Parameters_WithFor_ShouldInvokeTheCallbackOnlyFo await That(values).IsEqualTo([1, 1, 1,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_ShouldInvokeTheCallbackOnlyOnce() { List values = []; @@ -2073,7 +2073,7 @@ public async Task OnlyOnce_With5Parameters_ShouldInvokeTheCallbackOnlyOnce() await That(values).IsEqualTo([1,]); } - [Fact] + [Test] public async Task OnlyOnce_With5Parameters_WithFor_ShouldInvokeTheCallbackOnlyForTimes() { List values = []; diff --git a/Tests/Mockolate.Tests/TestHelpers/Catch.cs b/Tests/Mockolate.Tests/TestHelpers/Catch.cs new file mode 100644 index 000000000..1c5db5945 --- /dev/null +++ b/Tests/Mockolate.Tests/TestHelpers/Catch.cs @@ -0,0 +1,17 @@ +namespace Mockolate.Tests.TestHelpers; + +internal static class Catch +{ + public static Exception? Exception(Action action) + { + try + { + action(); + return null; + } + catch (Exception exception) + { + return exception; + } + } +} diff --git a/Tests/Mockolate.Tests/TestHelpers/Usings.cs b/Tests/Mockolate.Tests/TestHelpers/Usings.cs index f11dbbe7e..925c2535b 100644 --- a/Tests/Mockolate.Tests/TestHelpers/Usings.cs +++ b/Tests/Mockolate.Tests/TestHelpers/Usings.cs @@ -1,6 +1,5 @@ global using System; global using System.Threading.Tasks; global using Mockolate.Interactions; -global using Xunit; global using aweXpect; global using static aweXpect.Expect; diff --git a/Tests/Mockolate.Tests/Verify/MockRegistryVerifyTests.cs b/Tests/Mockolate.Tests/Verify/MockRegistryVerifyTests.cs index bd8991072..0582231ef 100644 --- a/Tests/Mockolate.Tests/Verify/MockRegistryVerifyTests.cs +++ b/Tests/Mockolate.Tests/Verify/MockRegistryVerifyTests.cs @@ -8,7 +8,7 @@ public class MockRegistryVerifyTests { public sealed class FailureMessageTests { - [Fact] + [Test] public async Task IndexerGotTyped_FourKeys_FailureMessageIncludesGotIndexerPrefix() { FastMockInteractions store = new(1); @@ -30,7 +30,7 @@ await That(Act).Throws() .WithMessage("*got indexer [1, \"a\", true, 1.0]*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerGotTyped_OneKey_FailureMessageIncludesGotIndexerPrefix() { FastMockInteractions store = new(1); @@ -49,7 +49,7 @@ await That(Act).Throws() .WithMessage("*got indexer [1]*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerGotTyped_ThreeKeys_FailureMessageIncludesGotIndexerPrefix() { FastMockInteractions store = new(1); @@ -70,7 +70,7 @@ await That(Act).Throws() .WithMessage("*got indexer [1, \"a\", true]*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerGotTyped_TwoKeys_FailureMessageIncludesGotIndexerPrefix() { FastMockInteractions store = new(1); @@ -90,7 +90,7 @@ await That(Act).Throws() .WithMessage("*got indexer [1, \"a\"]*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerSetTyped_FourKeys_FailureMessageIncludesSetIndexerPrefix() { FastMockInteractions store = new(1); @@ -113,7 +113,7 @@ await That(Act).Throws() .WithMessage("*set indexer [1, \"a\", true, 1.0] to *z*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerSetTyped_OneKey_FailureMessageIncludesSetIndexerPrefix() { FastMockInteractions store = new(1); @@ -133,7 +133,7 @@ await That(Act).Throws() .WithMessage("*set indexer [1] to *a*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerSetTyped_ThreeKeys_FailureMessageIncludesSetIndexerPrefix() { FastMockInteractions store = new(1); @@ -155,7 +155,7 @@ await That(Act).Throws() .WithMessage("*set indexer [1, \"a\", true] to *1*").AsWildcard(); } - [Fact] + [Test] public async Task IndexerSetTyped_TwoKeys_FailureMessageIncludesSetIndexerPrefix() { FastMockInteractions store = new(1); @@ -176,7 +176,7 @@ await That(Act).Throws() .WithMessage("*set indexer [1, \"a\"] to *true*").AsWildcard(); } - [Fact] + [Test] public async Task SubscribedToTyped_FailureMessageIncludesSubscribedToEventPrefix() { FastMockInteractions store = new(1); @@ -193,7 +193,7 @@ await That(Act).Throws() .WithMessage("*subscribed to event Tick*").AsWildcard(); } - [Fact] + [Test] public async Task UnsubscribedFromTyped_FailureMessageIncludesUnsubscribedFromEventPrefix() { FastMockInteractions store = new(1); @@ -210,7 +210,7 @@ await That(Act).Throws() .WithMessage("*unsubscribed from event Tick*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyMethodTyped_FourParameters_FailureMessageIncludesInvokedMethodPrefix() { FastMockInteractions store = new(1); @@ -232,7 +232,7 @@ await That(Act).Throws() .WithMessage("*invoked method Foo(1, \"a\", true, 1.0)*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyMethodTyped_OneParameter_FailureMessageIncludesInvokedMethodPrefix() { FastMockInteractions store = new(1); @@ -251,7 +251,7 @@ await That(Act).Throws() .WithMessage("*invoked method Foo(1)*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyMethodTyped_Parameterless_FailureMessageIncludesInvokedMethodPrefix() { FastMockInteractions store = new(1); @@ -268,7 +268,7 @@ await That(Act).Throws() .WithMessage("*invoked method Foo()*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyMethodTyped_ThreeParameters_FailureMessageIncludesInvokedMethodPrefix() { FastMockInteractions store = new(1); @@ -289,7 +289,7 @@ await That(Act).Throws() .WithMessage("*invoked method Foo(1, \"a\", true)*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyMethodTyped_TwoParameters_FailureMessageIncludesInvokedMethodPrefix() { FastMockInteractions store = new(1); @@ -309,7 +309,7 @@ await That(Act).Throws() .WithMessage("*invoked method Foo(1, \"a\")*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyPropertyTyped_Getter_FailureMessageIncludesGotPropertyPrefix() { FastMockInteractions store = new(1); @@ -326,7 +326,7 @@ await That(Act).Throws() .WithMessage("*got property X*").AsWildcard(); } - [Fact] + [Test] public async Task VerifyPropertyTyped_Setter_FailureMessageIncludesSetPropertyPrefix() { FastMockInteractions store = new(1); @@ -347,7 +347,7 @@ await That(Act).Throws() public sealed class TryGetBufferBoundaryTests { - [Fact] + [Test] public async Task VerifyMethodTyped_WithMemberIdEqualToBufferLength_ShouldFallToSlowPath() { // Pins the `(uint)memberId < (uint)buffers.Length` boundary in TryGetBuffer. @@ -367,7 +367,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task VerifyMethodTyped_WithMemberIdFarOutOfRange_ShouldFallToSlowPath() { FastMockInteractions store = new(1); @@ -386,7 +386,7 @@ void Act() public sealed class SlowPathPredicateTests { - [Fact] + [Test] public async Task VerifyMethodTyped_FourParam_SlowPath_AllMatchersTrue_Counts() { // Positive case for the same slow-path lambda — the matched record must be counted. @@ -410,7 +410,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task VerifyMethodTyped_FourParam_SlowPath_RejectsWhenLastMatcherFails() { FastMockInteractions store = new(0); @@ -433,7 +433,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VerifyMethodTyped_ThreeParam_SlowPath_RejectsWhenLastMatcherFails() { FastMockInteractions store = new(0); @@ -454,7 +454,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VerifyMethodTyped_TwoParam_SlowPath_RejectsWhenFirstMatcherFails() { // The "logical mutation" survivors live in the slow-path lambda used when TryGetBuffer @@ -478,7 +478,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VerifyMethodTyped_TwoParam_SlowPath_RejectsWhenSecondMatcherFails() { FastMockInteractions store = new(0); @@ -501,7 +501,7 @@ void Act() public sealed class VerifyPropertyFastPathTests { - [Fact] + [Test] public async Task Getter_FailureMessageIncludesGotPropertyPrefix() { // Pins the expectation factory `() => $"got property {propertyName...}"` against the @@ -520,7 +520,7 @@ await That(Act).Throws() .WithMessage("*got property X*").AsWildcard(); } - [Fact] + [Test] public async Task Getter_WithBufferAndRecord_PredicateMatchesEveryRecord() { // Pins `static _ => true` predicate in the public memberId-keyed VerifyProperty getter. @@ -540,7 +540,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Setter_FailureMessageIncludesSetPropertyPrefix() { // Pins the expectation factory `() => $"set property {propertyName...} to {value}"` @@ -560,7 +560,7 @@ await That(Act).Throws() .WithMessage("*set property X to *7*").AsWildcard(); } - [Fact] + [Test] public async Task Setter_WithBufferAndMatchingRecord_PredicateMatchesByValue() { // Pins the local Predicate's body in the memberId-keyed property setter overload. @@ -581,7 +581,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task Setter_WithNonMatchingValue_PredicateRejects() { // Same Predicate body — but exercises the negative branch so the `value.Matches(...)` @@ -604,7 +604,7 @@ void Act() public sealed class IndexerFastPathTests { - [Fact] + [Test] public async Task Got_FailureMessageIncludesGotIndexerPrefix() { // Pins `() => $"got indexer {parametersDescription()}"` in the public memberId-keyed @@ -625,7 +625,7 @@ await That(Act).Throws() .WithMessage("*got indexer [1]*").AsWildcard(); } - [Fact] + [Test] public async Task Set_FailureMessageIncludesSetIndexerPrefix() { // Pins `() => $"set indexer {parametersDescription()} to {value}"` against the @@ -647,7 +647,7 @@ await That(Act).Throws() .WithMessage("*set indexer [1] to *x*").AsWildcard(); } - [Fact] + [Test] public async Task Set_WithBufferAndMatchingRecord_PredicateMatchesByValue() { // Pins the local Predicate body in the memberId-keyed IndexerSet overload — the @@ -673,7 +673,7 @@ void Act() public sealed class SubscribedToFastPathTests { - [Fact] + [Test] public async Task FailureMessageIncludesSubscribedToEventPrefix() { // Pins the expectation factory `() => $"subscribed to event {eventName...}"`. @@ -691,7 +691,7 @@ await That(Act).Throws() .WithMessage("*subscribed to event Tick*").AsWildcard(); } - [Fact] + [Test] public async Task WithBufferAndRecord_PredicateMatchesEveryRecord() { // Pins `static _ => true` in the memberId-keyed SubscribedTo. Mutating to `false` @@ -710,7 +710,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutBuffer_FallsBackToLegacyAndFiltersByEventName() { // Kills two coupled mutants on `if (buffer is null)`: @@ -737,7 +737,7 @@ void Act() public sealed class UnsubscribedFromFastPathTests { - [Fact] + [Test] public async Task FailureMessageIncludesUnsubscribedFromEventPrefix() { FastMockInteractions store = new(1); @@ -754,7 +754,7 @@ await That(Act).Throws() .WithMessage("*unsubscribed from event Tick*").AsWildcard(); } - [Fact] + [Test] public async Task WithBufferAndRecord_PredicateMatchesEveryRecord() { FastMockInteractions store = new(1); @@ -771,7 +771,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task WithoutBuffer_FallsBackToLegacyAndFiltersByEventName() { FastMockInteractions store = new(0); @@ -791,7 +791,7 @@ void Act() public sealed class VerifyMethodFallbackTests { - [Fact] + [Test] public async Task Parameterless_WithoutFastMethod0Buffer_PredicateMatchesAllMethodInvocations() { // Kills the `_ => true` → `_ => false` mutation in the slow-path fallback at the bottom diff --git a/Tests/Mockolate.Tests/Verify/MockVerifyTests.cs b/Tests/Mockolate.Tests/Verify/MockVerifyTests.cs index f2d6566d2..d5fb0590c 100644 --- a/Tests/Mockolate.Tests/Verify/MockVerifyTests.cs +++ b/Tests/Mockolate.Tests/Verify/MockVerifyTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests.Verify; public class MockVerifyTests { - [Fact] + [Test] public async Task ThatAllInteractionsAreVerified_MultipleCalls_ShouldRepresentLatestValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -18,7 +18,7 @@ public async Task ThatAllInteractionsAreVerified_MultipleCalls_ShouldRepresentLa await That(result2).IsFalse(); } - [Fact] + [Test] public async Task ThatAllInteractionsAreVerified_MultipleVerifications_ShouldBeCombined() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -32,7 +32,7 @@ public async Task ThatAllInteractionsAreVerified_MultipleVerifications_ShouldBeC await That(sut.Mock.VerifyThatAllInteractionsAreVerified()).IsTrue(); } - [Fact] + [Test] public async Task ThatAllInteractionsAreVerified_WithoutInteractions_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -40,7 +40,7 @@ public async Task ThatAllInteractionsAreVerified_WithoutInteractions_ShouldRetur await That(sut.Mock.VerifyThatAllInteractionsAreVerified()).IsTrue(); } - [Fact] + [Test] public async Task ThatAllInteractionsAreVerified_WithUnverifiedInteractions_ShouldReturnFalse() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -52,7 +52,7 @@ public async Task ThatAllInteractionsAreVerified_WithUnverifiedInteractions_Shou await That(sut.Mock.VerifyThatAllInteractionsAreVerified()).IsFalse(); } - [Fact] + [Test] public async Task ThatAllInteractionsAreVerified_WithVerifiedInteractions_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -64,10 +64,10 @@ public async Task ThatAllInteractionsAreVerified_WithVerifiedInteractions_Should await That(sut.Mock.VerifyThatAllInteractionsAreVerified()).IsTrue(); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(5, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(5, true)] public async Task ThatAllSetupsAreUsed_ShouldCheckIndexersWithGetter(int interactionCount, bool expectedResult) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -81,10 +81,10 @@ public async Task ThatAllSetupsAreUsed_ShouldCheckIndexersWithGetter(int interac await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsEqualTo(expectedResult); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(5, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(5, true)] public async Task ThatAllSetupsAreUsed_ShouldCheckIndexersWithSetter(int interactionCount, bool expectedResult) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -98,10 +98,10 @@ public async Task ThatAllSetupsAreUsed_ShouldCheckIndexersWithSetter(int interac await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsEqualTo(expectedResult); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(5, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(5, true)] public async Task ThatAllSetupsAreUsed_ShouldCheckMethods(int interactionCount, bool expectedResult) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -115,10 +115,10 @@ public async Task ThatAllSetupsAreUsed_ShouldCheckMethods(int interactionCount, await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsEqualTo(expectedResult); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(5, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(5, true)] public async Task ThatAllSetupsAreUsed_ShouldCheckPropertiesWithGetter(int interactionCount, bool expectedResult) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -132,10 +132,10 @@ public async Task ThatAllSetupsAreUsed_ShouldCheckPropertiesWithGetter(int inter await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsEqualTo(expectedResult); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(5, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(5, true)] public async Task ThatAllSetupsAreUsed_ShouldCheckPropertiesWithSetter(int interactionCount, bool expectedResult) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -149,7 +149,7 @@ public async Task ThatAllSetupsAreUsed_ShouldCheckPropertiesWithSetter(int inter await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsEqualTo(expectedResult); } - [Fact] + [Test] public async Task ThatAllSetupsAreUsed_WithMultipleUsedSetups_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -163,7 +163,7 @@ public async Task ThatAllSetupsAreUsed_WithMultipleUsedSetups_ShouldReturnTrue() await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsTrue(); } - [Fact] + [Test] public async Task ThatAllSetupsAreUsed_WithoutSetup_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -173,10 +173,10 @@ public async Task ThatAllSetupsAreUsed_WithoutSetup_ShouldReturnTrue() await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsTrue(); } - [Theory] - [InlineData(0)] - [InlineData(1)] - [InlineData(5)] + [Test] + [Arguments(0)] + [Arguments(1)] + [Arguments(5)] public async Task ThatAllSetupsAreUsed_WithoutSetups_ShouldReturnTrue(int interactionCount) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -188,7 +188,7 @@ public async Task ThatAllSetupsAreUsed_WithoutSetups_ShouldReturnTrue(int intera await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsTrue(); } - [Fact] + [Test] public async Task ThatAllSetupsAreUsed_WithPartlyUsedSetups_ShouldReturnFalse() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -203,7 +203,7 @@ public async Task ThatAllSetupsAreUsed_WithPartlyUsedSetups_ShouldReturnFalse() await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsFalse(); } - [Fact] + [Test] public async Task ThatAllSetupsAreUsed_WithUnusedSetup_ShouldReturnFalse() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -212,7 +212,7 @@ public async Task ThatAllSetupsAreUsed_WithUnusedSetup_ShouldReturnFalse() await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsFalse(); } - [Fact] + [Test] public async Task ThatAllSetupsAreUsed_WithUsedSetup_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -223,7 +223,7 @@ public async Task ThatAllSetupsAreUsed_WithUsedSetup_ShouldReturnTrue() await That(sut.Mock.VerifyThatAllSetupsAreUsed()).IsTrue(); } - [Fact] + [Test] public async Task VerificationResult_ShouldUpdateWhenInteractionsChange() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/Verify/VerificationResultExtensionsTests.cs b/Tests/Mockolate.Tests/Verify/VerificationResultExtensionsTests.cs index 8bacd7730..38c1a76e0 100644 --- a/Tests/Mockolate.Tests/Verify/VerificationResultExtensionsTests.cs +++ b/Tests/Mockolate.Tests/Verify/VerificationResultExtensionsTests.cs @@ -7,11 +7,11 @@ namespace Mockolate.Tests.Verify; public class VerificationResultExtensionsTests { - [Theory] - [InlineData(0, 0, true)] - [InlineData(2, 3, false)] - [InlineData(2, 2, true)] - [InlineData(2, 1, true)] + [Test] + [Arguments(0, 0, true)] + [Arguments(2, 3, false)] + [Arguments(2, 2, true)] + [Arguments(2, 1, true)] public async Task AtLeast_ShouldReturnExpectedResult(int count, int times, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -27,7 +27,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at least 3 times, but it did twice."); } - [Fact] + [Test] public async Task AtLeast_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -43,11 +43,11 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at least 5 times, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(2, true)] - [InlineData(3, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(2, true)] + [Arguments(3, true)] public async Task AtLeastOnce_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -63,7 +63,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at least once, but it never did."); } - [Fact] + [Test] public async Task AtLeastOnce_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -79,11 +79,11 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at least once, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, false)] - [InlineData(1, false)] - [InlineData(2, true)] - [InlineData(3, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, false)] + [Arguments(2, true)] + [Arguments(3, true)] public async Task AtLeastTwice_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -99,7 +99,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at least twice, but it {count switch { 0 => "never did", _ => "did once", }}."); } - [Fact] + [Test] public async Task AtLeastTwice_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -115,11 +115,11 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at least twice, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, 0, true)] - [InlineData(2, 1, false)] - [InlineData(2, 2, true)] - [InlineData(2, 3, true)] + [Test] + [Arguments(0, 0, true)] + [Arguments(2, 1, false)] + [Arguments(2, 2, true)] + [Arguments(2, 3, true)] public async Task AtMost_ShouldReturnExpectedResult(int count, int times, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -135,7 +135,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at most once, but it did twice."); } - [Fact] + [Test] public async Task AtMost_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -152,11 +152,11 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at most 4 times, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, true)] - [InlineData(1, true)] - [InlineData(2, false)] - [InlineData(3, false)] + [Test] + [Arguments(0, true)] + [Arguments(1, true)] + [Arguments(2, false)] + [Arguments(3, false)] public async Task AtMostOnce_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -172,7 +172,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at most once, but it did {(count == 2 ? "twice" : $"{count} times")}."); } - [Fact] + [Test] public async Task AtMostOnce_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -189,11 +189,11 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at most once, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, true)] - [InlineData(1, true)] - [InlineData(2, true)] - [InlineData(3, false)] + [Test] + [Arguments(0, true)] + [Arguments(1, true)] + [Arguments(2, true)] + [Arguments(3, false)] public async Task AtMostTwice_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -209,7 +209,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at most twice, but it did {count} times."); } - [Fact] + [Test] public async Task AtMostTwice_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -226,14 +226,14 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) at most twice, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, 0, 0, true)] - [InlineData(1, 0, 2, true)] - [InlineData(2, 0, 2, true)] - [InlineData(3, 2, 5, true)] - [InlineData(1, 2, 5, false)] - [InlineData(6, 2, 5, false)] - [InlineData(2, 2, 2, true)] + [Test] + [Arguments(0, 0, 0, true)] + [Arguments(1, 0, 2, true)] + [Arguments(2, 0, 2, true)] + [Arguments(3, 2, 5, true)] + [Arguments(1, 2, 5, false)] + [Arguments(6, 2, 5, false)] + [Arguments(2, 2, 2, true)] public async Task Between_ShouldReturnExpectedResult(int count, int minimum, int maximum, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -257,7 +257,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) between {minimum} and {maximum} times, but it {expectedDidTimes}."); } - [Fact] + [Test] public async Task Between_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -273,7 +273,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) between 3 and 5 times, but it timed out after 00:00:00.0200000."); } - [Fact] + [Test] public async Task Between_WithMaximumLessThanMinimum_ShouldThrowArgumentOutOfRangeException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -288,7 +288,7 @@ await That(Act).Throws() .WithMessage("Maximum value must be greater than or equal to minimum.").AsPrefix(); } - [Fact] + [Test] public async Task Between_WithNegativeMinimum_ShouldThrowArgumentOutOfRangeException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -303,11 +303,11 @@ await That(Act).Throws() .WithMessage("Minimum value must be non-negative.").AsPrefix(); } - [Theory] - [InlineData(0, 0, true)] - [InlineData(2, 3, false)] - [InlineData(2, 2, true)] - [InlineData(2, 1, false)] + [Test] + [Arguments(0, 0, true)] + [Arguments(2, 3, false)] + [Arguments(2, 2, true)] + [Arguments(2, 1, false)] public async Task Exactly_ShouldReturnExpectedResult(int count, int times, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -323,7 +323,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) exactly {(times == 1 ? "once" : $"{times} times")}, but it did twice."); } - [Fact] + [Test] public async Task Exactly_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -339,11 +339,11 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) exactly 3 times, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, true)] - [InlineData(1, false)] - [InlineData(2, false)] - [InlineData(3, false)] + [Test] + [Arguments(0, true)] + [Arguments(1, false)] + [Arguments(2, false)] + [Arguments(3, false)] public async Task Never_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -359,7 +359,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock never invoked method Dispense(It.IsAny(), It.IsAny()), but it did {count switch { 1 => "once", 2 => "twice", _ => $"{count} times", }}."); } - [Fact] + [Test] public async Task Never_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -376,11 +376,11 @@ await That(Act).Throws() "Expected that mock never invoked method Dispense(It.IsAny(), It.IsAny()), but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, false)] - [InlineData(1, true)] - [InlineData(2, false)] - [InlineData(3, false)] + [Test] + [Arguments(0, false)] + [Arguments(1, true)] + [Arguments(2, false)] + [Arguments(3, false)] public async Task Once_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -396,7 +396,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) exactly once, but it {count switch { 0 => "never did", 2 => "did twice", _ => $"did {count} times", }}."); } - [Fact] + [Test] public async Task Once_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -412,7 +412,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) exactly once, but it timed out after 00:00:00.0200000."); } - [Fact] + [Test] public void Then_RepeatedPropertyGetter_ShouldNotCollapseIntoOnePosition() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -424,7 +424,7 @@ public void Then_RepeatedPropertyGetter_ShouldNotCollapseIntoOnePosition() .Then(m => m.TotalDispensed.Got()); } - [Fact] + [Test] public async Task Then_ShouldVerifyInOrder() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -449,10 +449,10 @@ await That(Act).Throws() .Then(m => m.Dispense(It.IsAny(), It.Is(2))); } - [Theory] - [InlineData(false, 1, 2, 3, 4)] - [InlineData(true, 1, 2, 2, 4)] - [InlineData(true, 1, 2, 3, 2, 4)] + [Test] + [Arguments(false, 1, 2, 3, 4)] + [Arguments(true, 1, 2, 2, 4)] + [Arguments(true, 1, 2, 3, 2, 4)] public async Task Then_TwiceSame_ShouldOnlyCountOnce(bool expectMatch, params int[] values) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -470,7 +470,7 @@ void Act() await That(Act).Throws().OnlyIf(!expectMatch); } - [Fact] + [Test] public async Task Then_WhenNoMatch_ShouldFail() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -500,7 +500,7 @@ await That(void () => sut.Mock.Verify.Dispense(It.IsAny(), It.Is(1)) "Expected that mock invoked method Dispense(It.IsAny(), 1), then invoked method Dispense(It.IsAny(), 2), then invoked method Dispense(It.IsAny(), 6) in order, but it invoked method Dispense(It.IsAny(), 6) not at all."); } - [Fact] + [Test] public async Task Then_WhenOnlyPartlyMatch_ShouldFail() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -517,7 +517,7 @@ await That(void () => sut.Mock.Verify.Dispense(It.IsAny(), It.Is(2)) "Expected that mock invoked method Dispense(It.IsAny(), 2), then invoked method Dispense(It.IsAny(), 1), then invoked method Dispense(It.IsAny(), 4) in order, but it invoked method Dispense(It.IsAny(), 1) too early."); } - [Fact] + [Test] public async Task Times_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -533,13 +533,13 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) according to the predicate _ => false, but it timed out after 00:00:00.0200000."); } - [Theory] - [InlineData(0, true)] - [InlineData(1, false)] - [InlineData(2, true)] - [InlineData(3, false)] - [InlineData(4, true)] - [InlineData(5, false)] + [Test] + [Arguments(0, true)] + [Arguments(1, false)] + [Arguments(2, true)] + [Arguments(3, false)] + [Arguments(4, true)] + [Arguments(5, false)] public async Task Times_WithEvenPredicate_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -563,15 +563,15 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) according to the predicate n => n % 2 == 0, but it {expectedDidTimes}."); } - [Theory] - [InlineData(0, false)] - [InlineData(1, false)] - [InlineData(2, true)] - [InlineData(3, true)] - [InlineData(4, false)] - [InlineData(5, true)] - [InlineData(6, false)] - [InlineData(7, true)] + [Test] + [Arguments(0, false)] + [Arguments(1, false)] + [Arguments(2, true)] + [Arguments(3, true)] + [Arguments(4, false)] + [Arguments(5, true)] + [Arguments(6, false)] + [Arguments(7, true)] public async Task Times_WithPrimePredicate_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -624,11 +624,11 @@ static bool IsPrime(int number) } } - [Theory] - [InlineData(0, false)] - [InlineData(1, false)] - [InlineData(2, true)] - [InlineData(3, false)] + [Test] + [Arguments(0, false)] + [Arguments(1, false)] + [Arguments(2, true)] + [Arguments(3, false)] public async Task Twice_ShouldReturnExpectedResult(int count, bool expectSuccess) { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -644,7 +644,7 @@ await That(Act).Throws().OnlyIf(!expectSuccess) $"Expected that mock invoked method Dispense(It.IsAny(), It.IsAny()) exactly twice, but it {count switch { 0 => "never did", 1 => "did once", _ => $"did {count} times", }}."); } - [Fact] + [Test] public async Task Twice_WhenTimedOut_ShouldThrowMockVerificationException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/Verify/VerificationResultMutationTests.cs b/Tests/Mockolate.Tests/Verify/VerificationResultMutationTests.cs index 39824856a..b5eb30407 100644 --- a/Tests/Mockolate.Tests/Verify/VerificationResultMutationTests.cs +++ b/Tests/Mockolate.Tests/Verify/VerificationResultMutationTests.cs @@ -8,7 +8,7 @@ namespace Mockolate.Tests.Verify; public sealed class VerificationResultMutationTests { - [Fact] + [Test] public async Task AwaitableVerify_AfterMatching_ShouldMarkMatchingInteractionsAsVerified() { IMyService sut = IMyService.CreateMock(); @@ -21,7 +21,7 @@ public async Task AwaitableVerify_AfterMatching_ShouldMarkMatchingInteractionsAs await That(interactions.GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task AwaitableVerify_RecordsArrayPath_AfterSuccess_MarksMatchingInteractionsAsVerified() { // Pins the `_interactions.Verified(matchingInteractions);` call inside Awaitable's @@ -41,7 +41,7 @@ public async Task AwaitableVerify_RecordsArrayPath_AfterSuccess_MarksMatchingInt await That(interactions.GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task AwaitableVerify_WithRecordingDisabled_ShouldThrowMockException() { IMyService sut = IMyService.CreateMock(MockBehavior.Default.SkippingInteractionRecording()); @@ -57,7 +57,7 @@ await That(Act).Throws() .WithMessage("*interaction recording is disabled*").AsWildcard(); } - [Fact] + [Test] public async Task AwaitableVerifyCount_NoFastCountSource_AfterSuccess_MarksMatchingInteractionsAsVerified() { // Pins the `_interactions.Verified(matchingInteractions);` call inside Awaitable's @@ -78,7 +78,7 @@ public async Task AwaitableVerifyCount_NoFastCountSource_AfterSuccess_MarksMatch await That(((IMockInteractions)store).GetUnverifiedInteractions()).IsEmpty(); } - [Fact] + [Test] public async Task CollectMatching_WithMultipleRecordsOutOfSeqOrder_SortsBySeqBeforeReturning() { // Kills the `records.Sort(...)` statement removal and the `records.Count > 1` → `<= 1` @@ -118,7 +118,7 @@ public async Task CollectMatching_WithMultipleRecordsOutOfSeqOrder_SortsBySeqBef await That(values).IsEqualTo([1, 3, 5,]); } - [Fact] + [Test] public async Task SyncVerifyCount_NoFastCountSource_AfterSuccess_MarksMatchingInteractionsAsVerified() { // Pins the `_interactions.Verified(matchingInteractions);` call inside the non-Awaitable diff --git a/Tests/Mockolate.Tests/Verify/VerificationResultTests.AsyncTests.cs b/Tests/Mockolate.Tests/Verify/VerificationResultTests.AsyncTests.cs index ec3ed1316..41074312c 100644 --- a/Tests/Mockolate.Tests/Verify/VerificationResultTests.AsyncTests.cs +++ b/Tests/Mockolate.Tests/Verify/VerificationResultTests.AsyncTests.cs @@ -11,7 +11,7 @@ public sealed partial class VerificationResultTests { public class AsyncTests { - [Fact] + [Test] public async Task MultipleWithin_ShouldOverwritePreviousTimeout() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -29,7 +29,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(Match.AnyParameters()) at least once, but it timed out after 00:00:00.2000000."); } - [Fact] + [Test] public async Task Verify_OnAwaitable_WhenPredicateBecomesSatisfied_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -57,7 +57,7 @@ public async Task Verify_OnAwaitable_WhenPredicateBecomesSatisfied_ShouldReturnT await backgroundTask; } - [Fact] + [Test] public async Task Verify_OnAwaitable_WhenPredicateIsAlreadySatisfied_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -70,7 +70,7 @@ public async Task Verify_OnAwaitable_WhenPredicateIsAlreadySatisfied_ShouldRetur await That(((IVerificationResult)result).Verify(l => l.Length > 0)).IsTrue(); } - [Fact] + [Test] public async Task Verify_OnAwaitable_WhenPredicateIsNeverSatisfied_ShouldThrowTimeoutException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -86,7 +86,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task VerifyAsync_WhenAlreadySuccessful_ShouldReturnTrue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -99,7 +99,7 @@ public async Task VerifyAsync_WhenAlreadySuccessful_ShouldReturnTrue() await That(((IAsyncVerificationResult)result).VerifyAsync(l => l.Length > 0, CancellationToken.None)).IsTrue(); } - [Fact] + [Test] public async Task VerifyAsync_WhenMultipleIterationsAreNecessary_ShouldStopWhenSuccessful() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -127,7 +127,7 @@ public async Task VerifyAsync_WhenMultipleIterationsAreNecessary_ShouldStopWhenS await backgroundTask; } - [Fact] + [Test] public async Task VerifyAsync_WithCancellationToken_ShouldKeepConfiguredTimeout() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -143,7 +143,7 @@ await That(Act).Throws() .Whose(e => e.Timeout, t => t.IsEqualTo(50.Milliseconds())); } - [Fact] + [Test] public async Task VerifyAsync_WithCancellationToken_ShouldLeaveResultUnchanged() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -163,7 +163,7 @@ await That(ActWithoutToken).Throws() .Whose(e => e.Timeout, t => t.IsEqualTo(50.Milliseconds())); } - [Fact] + [Test] public async Task VerifyAsync_WithCancellationToken_ShouldStopWaitingWhenConfiguredTokenIsCanceled() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -180,7 +180,7 @@ await That(Act).Throws() .Whose(e => e.Timeout, t => t.IsNull()); } - [Fact] + [Test] public async Task VerifyAsync_WithCancellationToken_WhenCanceled_ShouldThrowOperationCanceledException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -197,7 +197,7 @@ await That(Act).Throws() .Whose(e => e.CancellationToken, t => t.IsEqualTo(token)); } - [Fact] + [Test] public async Task VerifyAsync_WithCancellationToken_WhenCanceledWithoutTimeout_ShouldThrowOperationCanceledException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -214,7 +214,7 @@ await That(Act).Throws() .Whose(e => e.CancellationToken, t => t.IsEqualTo(token)); } - [Fact] + [Test] public async Task WithCancellation_ShouldReturnAsyncVerificationResult() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -225,7 +225,7 @@ public async Task WithCancellation_ShouldReturnAsyncVerificationResult() await That(result).Is(); } - [Fact] + [Test] public async Task WithCancellationAndTimeout_ShouldCombineBoth() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -245,7 +245,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(Match.AnyParameters()) at least once, but it timed out."); } - [Fact] + [Test] public async Task WithCancellationAndTimeout_ShouldIncludeTimeoutInExceptionWhenLessThanCancellationToken() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -265,7 +265,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(Match.AnyParameters()) at least once, but it timed out after 00:00:00.0500000."); } - [Fact] + [Test] public async Task WithCancellationToken_ShouldIncludeTimeoutInException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -282,7 +282,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(Match.AnyParameters()) at least once, but it timed out."); } - [Fact] + [Test] public async Task Within_ShouldAbortAsSoonAsConditionIsSatisfied() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -312,7 +312,7 @@ public async Task Within_ShouldAbortAsSoonAsConditionIsSatisfied() await That(sw.Elapsed).IsLessThan(5.Seconds()); } - [Fact] + [Test] public async Task Within_ShouldIncludeTimeoutInException() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -328,7 +328,7 @@ await That(Act).Throws() "Expected that mock invoked method Dispense(Match.AnyParameters()) at least once, but it timed out after 00:00:00.1000000."); } - [Fact] + [Test] public async Task Within_ShouldReturnAsyncVerificationResult() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -339,7 +339,7 @@ public async Task Within_ShouldReturnAsyncVerificationResult() await That(result).Is(); } - [Fact] + [Test] public async Task Within_WhenInvokedMultipleTimesInBackground_ShouldNotThrow() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/Verify/VerificationResultTests.cs b/Tests/Mockolate.Tests/Verify/VerificationResultTests.cs index e58d8f158..6f1ac0265 100644 --- a/Tests/Mockolate.Tests/Verify/VerificationResultTests.cs +++ b/Tests/Mockolate.Tests/Verify/VerificationResultTests.cs @@ -5,7 +5,7 @@ namespace Mockolate.Tests.Verify; public sealed partial class VerificationResultTests { - [Fact] + [Test] public async Task AnyParameters_OnOverloadedGenericMethod_LegacyPath_ShouldOnlyCountTheTargetedOverload() { IOverloadedMethodService sut = IOverloadedMethodService.CreateMock(); @@ -18,7 +18,7 @@ public async Task AnyParameters_OnOverloadedGenericMethod_LegacyPath_ShouldOnlyC await That(sut.Mock.Verify.GetInstance("ignored").AnyParameters()).Once(); } - [Fact] + [Test] public async Task AnyParameters_OnOverloadedMethod_FastPath_ShouldOnlyCountTheTargetedOverload() { IOverloadedMethodService sut = IOverloadedMethodService.CreateMock(); @@ -31,7 +31,7 @@ public async Task AnyParameters_OnOverloadedMethod_FastPath_ShouldOnlyCountTheTa await That(sut.Mock.Verify.DoSomething(0, false).AnyParameters()).Once(); } - [Fact] + [Test] public async Task AnyParameters_OnUntypedDefaultArguments_ShouldBindToValuesOverload() { IOverloadedMethodService sut = IOverloadedMethodService.CreateMock(); @@ -45,7 +45,7 @@ public async Task AnyParameters_OnUntypedDefaultArguments_ShouldBindToValuesOver await That(sut.Mock.Verify.DoSomething(default!, default!).AnyParameters()).Once(); } - [Fact] + [Test] public async Task CustomVerificationResult_ShouldKeepExpectation() { IMockInteractions interactions = new FastMockInteractions(0); @@ -56,7 +56,7 @@ public async Task CustomVerificationResult_ShouldKeepExpectation() await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task CustomVerificationResult_WithFuncExpectation_ShouldKeepExpectation() { IMockInteractions interactions = new FastMockInteractions(0); @@ -67,7 +67,7 @@ public async Task CustomVerificationResult_WithFuncExpectation_ShouldKeepExpecta await That(result).IsEqualTo("foo"); } - [Fact] + [Test] public async Task CustomVerificationResult_WithIMockInteractions_ShouldExposeInteractions() { IMockInteractions interactions = new FastMockInteractions(0); @@ -78,7 +78,7 @@ public async Task CustomVerificationResult_WithIMockInteractions_ShouldExposeInt await That(exposed).IsSameAs(interactions); } - [Fact] + [Test] public async Task VerificationResult_Got_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -89,7 +89,7 @@ public async Task VerificationResult_Got_ShouldHaveExpectedValue() await That(((IVerificationResult)result).Expectation).IsEqualTo("got property TotalDispensed"); } - [Fact] + [Test] public async Task VerificationResult_GotIndexer_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -100,7 +100,7 @@ public async Task VerificationResult_GotIndexer_ShouldHaveExpectedValue() await That(((IVerificationResult)result).Expectation).IsEqualTo("got indexer [It.IsAny()]"); } - [Fact] + [Test] public async Task VerificationResult_GotIndexerWithMultipleParameters_ShouldHaveExpectedValue() { IIndexerVerificationService sut = IIndexerVerificationService.CreateMock(); @@ -111,7 +111,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("got indexer [It.IsAny(), null]"); } - [Fact] + [Test] public async Task VerificationResult_Invoked_AnyParameters_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -123,7 +123,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("invoked method Dispense(Match.AnyParameters())"); } - [Fact] + [Test] public async Task VerificationResult_Invoked_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -135,7 +135,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("invoked method Dispense(It.IsAny(), It.IsAny())"); } - [Fact] + [Test] public async Task VerificationResult_MockInteractions_HasAllInteractions() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -152,7 +152,7 @@ public async Task VerificationResult_MockInteractions_HasAllInteractions() await That(((IVerificationResult)result).Interactions.Count).IsEqualTo(5); } - [Fact] + [Test] public async Task VerificationResult_Set_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -164,7 +164,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("set property TotalDispensed to 5"); } - [Fact] + [Test] public async Task VerificationResult_SetIndexer_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -176,7 +176,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("set indexer [It.IsAny()] to 5"); } - [Fact] + [Test] public async Task VerificationResult_SetIndexerWithMultipleParameters_ShouldHaveExpectedValue() { IIndexerVerificationService sut = IIndexerVerificationService.CreateMock(); @@ -187,7 +187,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("set indexer [\"foo\", null] to 5"); } - [Fact] + [Test] public async Task VerificationResult_SetIndexerWithMultipleParametersToNull_ShouldHaveExpectedValue() { IIndexerVerificationService sut = IIndexerVerificationService.CreateMock(); @@ -198,7 +198,7 @@ await That(((IVerificationResult)result).Expectation) .IsEqualTo("set indexer [\"foo\", null] to null"); } - [Fact] + [Test] public async Task VerificationResult_SubscribedTo_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); @@ -209,7 +209,7 @@ public async Task VerificationResult_SubscribedTo_ShouldHaveExpectedValue() await That(((IVerificationResult)result).Expectation).IsEqualTo("subscribed to event ChocolateDispensed"); } - [Fact] + [Test] public async Task VerificationResult_UnsubscribedFrom_ShouldHaveExpectedValue() { IChocolateDispenser sut = IChocolateDispenser.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ReturnsAsyncTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ReturnsAsyncTests.cs index 222be3a1f..f149c1d35 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ReturnsAsyncTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ReturnsAsyncTests.cs @@ -9,11 +9,11 @@ public sealed partial class HttpClientExtensionsTests { public sealed class ReturnsAsyncTests { - [Theory] - [InlineData(HttpStatusCode.OK)] - [InlineData(HttpStatusCode.NotFound)] - [InlineData(HttpStatusCode.InternalServerError)] - [InlineData(HttpStatusCode.Forbidden)] + [Test] + [Arguments(HttpStatusCode.OK)] + [Arguments(HttpStatusCode.NotFound)] + [Arguments(HttpStatusCode.InternalServerError)] + [Arguments(HttpStatusCode.Forbidden)] public async Task WithStatusCode_ShouldReturnHttpResponseMessageWithStatusCode(HttpStatusCode statusCode) { HttpClient httpClient = HttpClient.CreateMock(); @@ -31,9 +31,9 @@ public async Task WithStatusCode_ShouldReturnHttpResponseMessageWithStatusCode(H #endif } - [Theory] - [InlineData(HttpStatusCode.OK, "foo")] - [InlineData(HttpStatusCode.NotFound, "bar")] + [Test] + [Arguments(HttpStatusCode.OK, "foo")] + [Arguments(HttpStatusCode.NotFound, "bar")] public async Task WithStatusCodeAndBytes_ShouldReturnHttpResponseMessageWithStatusCodeAndByteArrayContent( HttpStatusCode statusCode, string stringContent) { @@ -51,9 +51,9 @@ public async Task WithStatusCodeAndBytes_ShouldReturnHttpResponseMessageWithStat await That(result.Content.Headers.ContentType).IsNull(); } - [Theory] - [InlineData(HttpStatusCode.OK, "foo")] - [InlineData(HttpStatusCode.NotFound, "bar")] + [Test] + [Arguments(HttpStatusCode.OK, "foo")] + [Arguments(HttpStatusCode.NotFound, "bar")] public async Task WithStatusCodeAndHttpContent_ShouldReturnHttpResponseMessageWithStatusCodeAndByteArrayContent( HttpStatusCode statusCode, string stringContent) @@ -73,9 +73,9 @@ public async Task await That(result.Content.Headers.ContentType).IsNull(); } - [Theory] - [InlineData(HttpStatusCode.OK, "foo")] - [InlineData(HttpStatusCode.NotFound, "bar")] + [Test] + [Arguments(HttpStatusCode.OK, "foo")] + [Arguments(HttpStatusCode.NotFound, "bar")] public async Task WithStatusCodeAndString_ShouldReturnHttpResponseMessageWithStatusCodeAndStringContent( HttpStatusCode statusCode, string content) { @@ -92,9 +92,9 @@ public async Task WithStatusCodeAndString_ShouldReturnHttpResponseMessageWithSta await That(result.Content.Headers.ContentType?.MediaType).IsEqualTo("text/plain"); } - [Theory] - [InlineData(HttpStatusCode.OK, "foo", "text/plain")] - [InlineData(HttpStatusCode.NotFound, "bar", "application/json")] + [Test] + [Arguments(HttpStatusCode.OK, "foo", "text/plain")] + [Arguments(HttpStatusCode.NotFound, "bar", "application/json")] public async Task WithStatusCodeBytesAndMediaType_ShouldReturnHttpResponseMessageWithStatusCodeAndByteArrayContent( HttpStatusCode statusCode, string stringContent, string mediaType) @@ -113,9 +113,9 @@ public async Task await That(result.Content.Headers.ContentType?.MediaType).IsEqualTo(mediaType); } - [Theory] - [InlineData(HttpStatusCode.OK, "foo", "text/plain")] - [InlineData(HttpStatusCode.NotFound, "bar", "application/json")] + [Test] + [Arguments(HttpStatusCode.OK, "foo", "text/plain")] + [Arguments(HttpStatusCode.NotFound, "bar", "application/json")] public async Task WithStatusCodeStringContentAndMediaType_ShouldReturnHttpResponseMessageWithStatusCodeAndStringContent( HttpStatusCode statusCode, string content, string mediaType) diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.DeleteTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.DeleteTests.cs index 23f710485..ce248a362 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.DeleteTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.DeleteTests.cs @@ -12,11 +12,11 @@ public sealed partial class Setup { public sealed class DeleteTests { - [Theory] - [InlineData(nameof(HttpMethod.Delete), true)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), true)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task StringUri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -32,11 +32,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", false)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", false)] + [Arguments("*foo*", false)] public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -51,9 +51,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -70,7 +70,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -87,11 +87,11 @@ await That(Act).Throws() "Cannot setup HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), true)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), true)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task Uri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -107,11 +107,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", true)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", true)] + [Arguments("*foo*", false)] public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -126,9 +126,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -145,7 +145,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.GetTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.GetTests.cs index b732f8381..6b2dcebd9 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.GetTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.GetTests.cs @@ -12,11 +12,11 @@ public sealed partial class Setup { public sealed class GetTests { - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), true)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), true)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task StringUri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -32,11 +32,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", false)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", false)] + [Arguments("*foo*", false)] public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -51,9 +51,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -70,7 +70,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -87,11 +87,11 @@ await That(Act).Throws() "Cannot setup HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), true)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), true)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task Uri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -107,11 +107,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", true)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", true)] + [Arguments("*foo*", false)] public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -126,9 +126,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -145,7 +145,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PatchTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PatchTests.cs index d5b500622..f2cb46ddf 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PatchTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PatchTests.cs @@ -14,10 +14,10 @@ public sealed partial class Setup { public sealed class PatchTests { - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task StringUri_ShouldVerifyHttpContent(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -33,12 +33,12 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Patch), true)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Patch), true)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task StringUri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -54,11 +54,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", false)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", false)] + [Arguments("*foo*", false)] public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -74,9 +74,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -95,7 +95,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -112,10 +112,10 @@ await That(Act).Throws() "Cannot setup HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task Uri_ShouldVerifyHttpContent(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -131,12 +131,12 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Patch), true)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Patch), true)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task Uri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -152,11 +152,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", true)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", true)] + [Arguments("*foo*", false)] public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -172,9 +172,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -193,7 +193,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PostTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PostTests.cs index 6a7726e39..e07ffb948 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PostTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PostTests.cs @@ -13,10 +13,10 @@ public sealed partial class Setup { public sealed class PostTests { - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task StringUri_ShouldVerifyHttpContent(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -32,11 +32,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Post), true)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Post), true)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task StringUri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -52,11 +52,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", false)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", false)] + [Arguments("*foo*", false)] public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -72,9 +72,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -93,7 +93,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -110,10 +110,10 @@ await That(Act).Throws() "Cannot setup HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task Uri_ShouldVerifyHttpContent(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -129,11 +129,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Post), true)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Post), true)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task Uri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -149,11 +149,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", true)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", true)] + [Arguments("*foo*", false)] public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -169,9 +169,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -190,7 +190,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PutTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PutTests.cs index 2affdafb3..d752df6d4 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PutTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Setup.PutTests.cs @@ -13,10 +13,10 @@ public sealed partial class Setup { public sealed class PutTests { - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task StringUri_ShouldVerifyHttpContent(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -32,11 +32,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), true)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), true)] public async Task StringUri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -52,11 +52,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", false)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", false)] + [Arguments("*foo*", false)] public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -72,9 +72,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -93,7 +93,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -110,10 +110,10 @@ await That(Act).Throws() "Cannot setup HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task Uri_ShouldVerifyHttpContent(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -129,11 +129,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Get), false)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), true)] + [Test] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Get), false)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), true)] public async Task Uri_ShouldVerifyHttpMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -149,11 +149,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org*", true)] - [InlineData("*testably.org", true)] - [InlineData("testably.org*", true)] - [InlineData("*foo*", false)] + [Test] + [Arguments("*testably.org*", true)] + [Arguments("*testably.org", true)] + [Arguments("testably.org*", true)] + [Arguments("*foo*", false)] public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -169,9 +169,9 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -190,7 +190,7 @@ await That(result.StatusCode) .IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ToStringTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ToStringTests.cs index 4446f61ed..520da9181 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ToStringTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.ToStringTests.cs @@ -9,7 +9,7 @@ public sealed partial class HttpClientExtensionsTests { public sealed class ToStringTests { - [Fact] + [Test] public async Task GetAsync_StringUri_ShouldIncludeMethodAndUriInVerificationMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -23,7 +23,7 @@ await That(Act).Throws() .WithMessage("*GET-Request with Uri matching It.Matches(\"*testably.org*\")*").AsWildcard(); } - [Fact] + [Test] public async Task GetAsync_UriParameter_ShouldIncludeMethodAndUriInVerificationMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -37,7 +37,7 @@ await That(Act).Throws() .WithMessage("*GET-Request with https Uri*").AsWildcard(); } - [Fact] + [Test] public async Task PostAsync_ShouldIncludeMethodInVerificationMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -53,7 +53,7 @@ await That(Act).Throws() .WithMessage("*POST-Request with Uri matching It.IsAny() and Http content with media type \"application/json\"*").AsWildcard(); } - [Fact] + [Test] public async Task PostAsync_ShouldIncludeStringInformationInVerificationMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -69,7 +69,7 @@ await That(Act).Throws() .WithMessage("*POST-Request with any Uri and string content equal to \"foo\"*").AsWildcard(); } - [Fact] + [Test] public async Task SendAsync_ShouldIncludeRequestMessageInVerificationMessage() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.DeleteTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.DeleteTests.cs index 685458b87..b912119e7 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.DeleteTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.DeleteTests.cs @@ -12,11 +12,11 @@ public sealed partial class Verify { public sealed class DeleteTests { - [Theory] - [InlineData(nameof(HttpMethod.Delete), 1)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 1)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task StringUri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -30,11 +30,11 @@ await That(httpClient.Mock.Verify.DeleteAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 0)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 0)] + [Arguments("*foo*", 0)] public async Task StringUri_ShouldVerifyUriString(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -47,9 +47,9 @@ await That(httpClient.Mock.Verify.DeleteAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -62,7 +62,7 @@ await That(httpClient.Mock.Verify.DeleteAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -78,11 +78,11 @@ await That(Act).Throws() "Cannot verify HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 1)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 1)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task Uri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -96,11 +96,11 @@ await That(httpClient.Mock.Verify.DeleteAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 1)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 1)] + [Arguments("*foo*", 0)] public async Task Uri_ShouldVerifyUri(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -112,9 +112,9 @@ await That(httpClient.Mock.Verify.DeleteAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -127,7 +127,7 @@ await That(httpClient.Mock.Verify.DeleteAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.ExpectationMessageTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.ExpectationMessageTests.cs index 94f66b35f..8c042f4d7 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.ExpectationMessageTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.ExpectationMessageTests.cs @@ -11,7 +11,7 @@ public sealed partial class Verify { public sealed class ExpectationMessageTests { - [Fact] + [Test] public async Task DeleteAsync_StringUri_FailingVerification_ShouldMentionSendAsyncInMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -25,7 +25,7 @@ await That(Act).Throws() .WithMessage("*SendAsync*").AsWildcard(); } - [Fact] + [Test] public async Task DeleteAsync_Uri_FailingVerification_ShouldMentionSendAsyncInMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -39,7 +39,7 @@ await That(Act).Throws() .WithMessage("*SendAsync*").AsWildcard(); } - [Fact] + [Test] public async Task PutAsync_StringUri_FailingVerification_ShouldMentionSendAsyncInMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -53,7 +53,7 @@ await That(Act).Throws() .WithMessage("*SendAsync*").AsWildcard(); } - [Fact] + [Test] public async Task PutAsync_Uri_FailingVerification_ShouldMentionSendAsyncInMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -68,7 +68,7 @@ await That(Act).Throws() } #if NET8_0_OR_GREATER - [Fact] + [Test] public async Task PatchAsync_StringUri_FailingVerification_ShouldMentionSendAsyncInMessage() { HttpClient httpClient = HttpClient.CreateMock(); @@ -82,7 +82,7 @@ await That(Act).Throws() .WithMessage("*SendAsync*").AsWildcard(); } - [Fact] + [Test] public async Task PatchAsync_Uri_FailingVerification_ShouldMentionSendAsyncInMessage() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.GetTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.GetTests.cs index cca4179b0..65e06d647 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.GetTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.GetTests.cs @@ -12,11 +12,11 @@ public sealed partial class Verify { public sealed class GetTests { - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 1)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 1)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task StringUri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -30,11 +30,11 @@ await That(httpClient.Mock.Verify.GetAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 0)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 0)] + [Arguments("*foo*", 0)] public async Task StringUri_ShouldVerifyUriString(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -47,9 +47,9 @@ await That(httpClient.Mock.Verify.GetAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -62,7 +62,7 @@ await That(httpClient.Mock.Verify.GetAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -78,11 +78,11 @@ await That(Act).Throws() "Cannot verify HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 1)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 1)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task Uri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -96,11 +96,11 @@ await That(httpClient.Mock.Verify.GetAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 1)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 1)] + [Arguments("*foo*", 0)] public async Task Uri_ShouldVerifyUri(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -112,9 +112,9 @@ await That(httpClient.Mock.Verify.GetAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -127,7 +127,7 @@ await That(httpClient.Mock.Verify.GetAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PatchTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PatchTests.cs index 6da9dfc74..9c27e5934 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PatchTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PatchTests.cs @@ -14,10 +14,10 @@ public sealed partial class Verify { public sealed class PatchTests { - [Theory] - [InlineData("application/json", 1)] - [InlineData("text/plain", 0)] - [InlineData("application/txt", 0)] + [Test] + [Arguments("application/json", 1)] + [Arguments("text/plain", 0)] + [Arguments("application/txt", 0)] public async Task StringUri_ShouldVerifyHttpContent(string mediaType, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -32,12 +32,12 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(expected); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Patch), 1)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Patch), 1)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task StringUri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -52,11 +52,11 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 0)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 0)] + [Arguments("*foo*", 0)] public async Task StringUri_ShouldVerifyUriString(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -70,9 +70,9 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -86,7 +86,7 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -102,10 +102,10 @@ await That(Act).Throws() "Cannot verify HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData("application/json", 1)] - [InlineData("text/plain", 0)] - [InlineData("application/txt", 0)] + [Test] + [Arguments("application/json", 1)] + [Arguments("text/plain", 0)] + [Arguments("application/txt", 0)] public async Task Uri_ShouldVerifyHttpContent(string mediaType, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -120,12 +120,12 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(expected); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Patch), 1)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Patch), 1)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task Uri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -140,11 +140,11 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 1)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 1)] + [Arguments("*foo*", 0)] public async Task Uri_ShouldVerifyUri(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -157,9 +157,9 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -173,7 +173,7 @@ await That(httpClient.Mock.Verify.PatchAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PostTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PostTests.cs index 5a03c68ca..0e6ce7f95 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PostTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PostTests.cs @@ -13,10 +13,10 @@ public sealed partial class Verify { public sealed class PostTests { - [Theory] - [InlineData("application/json", 1)] - [InlineData("text/plain", 0)] - [InlineData("application/txt", 0)] + [Test] + [Arguments("application/json", 1)] + [Arguments("text/plain", 0)] + [Arguments("application/txt", 0)] public async Task StringUri_ShouldVerifyHttpContent(string mediaType, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -31,11 +31,11 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(expected); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Post), 1)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Post), 1)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task StringUri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -50,11 +50,11 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 0)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 0)] + [Arguments("*foo*", 0)] public async Task StringUri_ShouldVerifyUriString(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -68,9 +68,9 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -84,7 +84,7 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -100,10 +100,10 @@ await That(Act).Throws() "Cannot verify HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData("application/json", 1)] - [InlineData("text/plain", 0)] - [InlineData("application/txt", 0)] + [Test] + [Arguments("application/json", 1)] + [Arguments("text/plain", 0)] + [Arguments("application/txt", 0)] public async Task Uri_ShouldVerifyHttpContent(string mediaType, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -118,11 +118,11 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(expected); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Post), 1)] - [InlineData(nameof(HttpMethod.Put), 0)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Post), 1)] + [Arguments(nameof(HttpMethod.Put), 0)] public async Task Uri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -137,11 +137,11 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 1)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 1)] + [Arguments("*foo*", 0)] public async Task Uri_ShouldVerifyUri(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -154,9 +154,9 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -170,7 +170,7 @@ await That(httpClient.Mock.Verify.PostAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PutTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PutTests.cs index a17c567c8..9fb75a01a 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PutTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.Verify.PutTests.cs @@ -13,10 +13,10 @@ public sealed partial class Verify { public sealed class PutTests { - [Theory] - [InlineData("application/json", 1)] - [InlineData("text/plain", 0)] - [InlineData("application/txt", 0)] + [Test] + [Arguments("application/json", 1)] + [Arguments("text/plain", 0)] + [Arguments("application/txt", 0)] public async Task StringUri_ShouldVerifyHttpContent(string mediaType, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -31,11 +31,11 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(expected); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 1)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 1)] public async Task StringUri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -50,11 +50,11 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 0)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 0)] + [Arguments("*foo*", 0)] public async Task StringUri_ShouldVerifyUriString(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -68,9 +68,9 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -84,7 +84,7 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -100,10 +100,10 @@ await That(Act).Throws() "Cannot verify HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Theory] - [InlineData("application/json", 1)] - [InlineData("text/plain", 0)] - [InlineData("application/txt", 0)] + [Test] + [Arguments("application/json", 1)] + [Arguments("text/plain", 0)] + [Arguments("application/txt", 0)] public async Task Uri_ShouldVerifyHttpContent(string mediaType, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -118,11 +118,11 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(expected); } - [Theory] - [InlineData(nameof(HttpMethod.Delete), 0)] - [InlineData(nameof(HttpMethod.Get), 0)] - [InlineData(nameof(HttpMethod.Post), 0)] - [InlineData(nameof(HttpMethod.Put), 1)] + [Test] + [Arguments(nameof(HttpMethod.Delete), 0)] + [Arguments(nameof(HttpMethod.Get), 0)] + [Arguments(nameof(HttpMethod.Post), 0)] + [Arguments(nameof(HttpMethod.Put), 1)] public async Task Uri_ShouldVerifyHttpMethod(string method, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -137,11 +137,11 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(expected); } - [Theory] - [InlineData("*testably.org*", 1)] - [InlineData("*testably.org", 1)] - [InlineData("testably.org*", 1)] - [InlineData("*foo*", 0)] + [Test] + [Arguments("*testably.org*", 1)] + [Arguments("*testably.org", 1)] + [Arguments("testably.org*", 1)] + [Arguments("*foo*", 0)] public async Task Uri_ShouldVerifyUri(string pattern, int expected) { HttpClient httpClient = HttpClient.CreateMock(); @@ -154,9 +154,9 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(expected); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Test] + [Arguments(true)] + [Arguments(false)] public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool tokenMatches) { HttpClient httpClient = HttpClient.CreateMock(); @@ -170,7 +170,7 @@ await That(httpClient.Mock.Verify.PutAsync( .Exactly(tokenMatches ? 1 : 0); } - [Fact] + [Test] public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); diff --git a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.cs b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.cs index 9ac57361f..d1a086f15 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientExtensionsTests.cs @@ -11,7 +11,7 @@ namespace Mockolate.Tests.Web; public sealed partial class HttpClientExtensionsTests { - [Fact] + [Test] public async Task CustomParameter_WithoutIParameterMatch_ShouldBeInvokedViaAdapter() { HttpClient httpClient = HttpClient.CreateMock(); @@ -32,7 +32,7 @@ void Act() await That(Act).Throws(); } - [Fact] + [Test] public async Task InvokedSetup_ShouldWorkForHttpClient() { HttpClient httpClient = HttpClient.CreateMock(); @@ -47,7 +47,7 @@ await That(result.StatusCode) await That(httpClient.Mock.VerifySetup(setup)).Once(); } - [Fact] + [Test] public async Task InvokedSetup_WhenMethodSetupIsNotVerifiable_ShouldThrowMockException() { HttpClient sut = HttpClient.CreateMock(); @@ -62,7 +62,7 @@ await That(Act).Throws() .WithMessage("The setup is not verifiable."); } - [Fact] + [Test] public async Task NullRequestUri_ShouldInvokeCallbackWithNull() { // ReSharper disable once VariableCanBeNotNullable @@ -78,7 +78,7 @@ public async Task NullRequestUri_ShouldInvokeCallbackWithNull() await That(callbackUri).IsNull(); } - [Fact] + [Test] public async Task NullRequestUri_ShouldReturnFalse() { HttpClient httpClient = HttpClient.CreateMock(); @@ -94,7 +94,7 @@ public async Task NullRequestUri_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task NullUri_ShouldReturnFalse() { HttpClient httpClient = HttpClient.CreateMock(); @@ -110,7 +110,7 @@ public async Task NullUri_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task SendAsync_WithoutMockedHttpMessageHandler_ShouldThrowMockException() { HttpClient httpClient = HttpClient.CreateMock([]); @@ -127,7 +127,7 @@ await That(Act).Throws() "Cannot setup HttpClient when it is not mocked with a mockable HttpMessageHandler."); } - [Fact] + [Test] public async Task ShouldSupportMonitoring() { int callbackCount = 0; @@ -149,9 +149,9 @@ await That(monitor.Values).IsEqualTo([ await That(callbackCount).IsEqualTo(2); } - [Theory] - [InlineData("*testably.org")] - [InlineData("*testably.org/")] + [Test] + [Arguments("*testably.org")] + [Arguments("*testably.org/")] public async Task TrailingSlash_ShouldBeIgnored(string matchPattern) { HttpClient httpClient = HttpClient.CreateMock(); @@ -166,7 +166,7 @@ await That(result.StatusCode) .IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task TrailingSlash_WhenNotPresent_ShouldNotBeAdded() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/HttpClientTests.cs b/Tests/Mockolate.Tests/Web/HttpClientTests.cs index f66689bc8..c0e02bc31 100644 --- a/Tests/Mockolate.Tests/Web/HttpClientTests.cs +++ b/Tests/Mockolate.Tests/Web/HttpClientTests.cs @@ -9,7 +9,7 @@ namespace Mockolate.Tests.Web; public class HttpClientTests { - [Fact] + [Test] public async Task HttpClientMock_WithHandler_ShouldUseSharedRegistry() { HttpMessageHandler handler = HttpMessageHandler.CreateMock(); @@ -26,7 +26,7 @@ public async Task HttpClientMock_WithHandler_ShouldUseSharedRegistry() await That(client2.Mock.VerifySetup(setup)).Once(); } - [Fact] + [Test] public async Task WithDifferentBehavior_ShouldThrow() { MockBehavior behavior1 = MockBehavior.Default.SkippingBaseClass(); @@ -42,7 +42,7 @@ await That(Act).Throws().WithMessage( "Mock of type 'System.Net.Http.HttpClient' cannot be created with behavior 'ThrowingWhenNotSetup' because it shares its mock registry with a mock of type 'System.Net.Http.HttpMessageHandler' that has behavior 'SkippingBaseClass'."); } - [Fact] + [Test] public async Task WithoutBehavior_ShouldSucceed() { MockBehavior behavior1 = MockBehavior.Default.SkippingBaseClass(); @@ -56,7 +56,7 @@ void Act() await That(Act).DoesNotThrow(); } - [Fact] + [Test] public async Task WithSameBehavior_ShouldSucceed() { MockBehavior behavior1 = MockBehavior.Default.SkippingBaseClass(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.ToStringTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.ToStringTests.cs index 9b1068726..82111e75e 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.ToStringTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.ToStringTests.cs @@ -9,7 +9,7 @@ public sealed partial class IsHttpContentTests { public sealed class ToStringTests { - [Fact] + [Test] public async Task Default_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -19,7 +19,7 @@ public async Task Default_ShouldReturnExpectedValue() await That(result).IsEqualTo("Http content"); } - [Fact] + [Test] public async Task MultipleConditions_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent("image/png") @@ -32,7 +32,7 @@ await That(result).IsEqualTo( "string content c => c.Length > 0 and binary content b => b.Length > 0 with media type \"image/png\""); } - [Fact] + [Test] public async Task WithBytesPredicate_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent().WithBytes(b => b.Length > 0); @@ -42,7 +42,7 @@ public async Task WithBytesPredicate_ShouldReturnExpectedValue() await That(result).IsEqualTo("binary content b => b.Length > 0"); } - [Fact] + [Test] public async Task WithFormData_Exactly_ShouldReturnExpectedValue() { ItExtensions.IFormDataContentParameter sut = @@ -53,7 +53,7 @@ public async Task WithFormData_Exactly_ShouldReturnExpectedValue() await That(result).IsEqualTo("form data content exactly \"x=123\""); } - [Fact] + [Test] public async Task WithFormData_KeyValue_ShouldReturnExpectedValue() { ItExtensions.IFormDataContentParameter sut = @@ -64,7 +64,7 @@ public async Task WithFormData_KeyValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("form data content \"x=123\""); } - [Fact] + [Test] public async Task WithFormData_MultipleValues_Exactly_ShouldReturnExpectedValue() { ItExtensions.IFormDataContentParameter sut = @@ -75,7 +75,7 @@ public async Task WithFormData_MultipleValues_Exactly_ShouldReturnExpectedValue( await That(result).IsEqualTo("form data content exactly \"x=123\", \"y=234\""); } - [Fact] + [Test] public async Task WithFormData_MultipleValues_ShouldReturnExpectedValue() { ItExtensions.IFormDataContentParameter sut = @@ -86,7 +86,7 @@ public async Task WithFormData_MultipleValues_ShouldReturnExpectedValue() await That(result).IsEqualTo("form data content \"x=123\", \"y=234\""); } - [Fact] + [Test] public async Task WithFormData_String_ShouldReturnExpectedValue() { ItExtensions.IFormDataContentParameter sut = @@ -97,7 +97,7 @@ public async Task WithFormData_String_ShouldReturnExpectedValue() await That(result).IsEqualTo("form data content \"x=123\""); } - [Fact] + [Test] public async Task WithFormData_StringMultiple_ShouldReturnExpectedValue() { ItExtensions.IFormDataContentParameter sut = @@ -108,7 +108,7 @@ public async Task WithFormData_StringMultiple_ShouldReturnExpectedValue() await That(result).IsEqualTo("form data content \"x=123\", \"y=234\""); } - [Fact] + [Test] public async Task WithHeaders_Multiple_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = @@ -122,7 +122,7 @@ await That(result) "Http content with headers \"x-my-header: my-value\", \"x-my-other-header: my-other-value\""); } - [Fact] + [Test] public async Task WithHeaders_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = @@ -133,7 +133,7 @@ public async Task WithHeaders_ShouldReturnExpectedValue() await That(result).IsEqualTo("Http content with header \"x-my-header: my-value\""); } - [Fact] + [Test] public async Task WithMediaType_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent().WithMediaType("text/plain"); @@ -143,7 +143,7 @@ public async Task WithMediaType_ShouldReturnExpectedValue() await That(result).IsEqualTo("Http content with media type \"text/plain\""); } - [Fact] + [Test] public async Task WithMediaTypeThenWithString_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -155,7 +155,7 @@ await That(result).IsEqualTo( "string content containing \"foo\" with media type \"text/plain\""); } - [Fact] + [Test] public async Task WithMediaTypeViaFactory_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent("application/json"); @@ -165,7 +165,7 @@ public async Task WithMediaTypeViaFactory_ShouldReturnExpectedValue() await That(result).IsEqualTo("Http content with media type \"application/json\""); } - [Fact] + [Test] public async Task WithString_Exactly_IgnoringCase_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = It.IsHttpContent().WithString("foo").Exactly() @@ -176,7 +176,7 @@ public async Task WithString_Exactly_IgnoringCase_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content equal to \"foo\" ignoring case"); } - [Fact] + [Test] public async Task WithString_Exactly_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = It.IsHttpContent().WithString("foo").Exactly(); @@ -186,7 +186,7 @@ public async Task WithString_Exactly_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content equal to \"foo\""); } - [Fact] + [Test] public async Task WithString_IgnoringCase_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -197,7 +197,7 @@ public async Task WithString_IgnoringCase_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content containing \"foo\" ignoring case"); } - [Fact] + [Test] public async Task WithString_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = It.IsHttpContent().WithString("foo"); @@ -207,7 +207,7 @@ public async Task WithString_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content containing \"foo\""); } - [Fact] + [Test] public async Task WithStringMatching_AsRegex_IgnoringCase_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -218,7 +218,7 @@ public async Task WithStringMatching_AsRegex_IgnoringCase_ShouldReturnExpectedVa await That(result).IsEqualTo("string content matching regex pattern \"^foo\" ignoring case"); } - [Fact] + [Test] public async Task WithStringMatching_AsRegex_IgnoringCase_WithOptions_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -230,7 +230,7 @@ await That(result) .IsEqualTo("string content matching regex pattern \"^foo\" ignoring case with options Multiline"); } - [Fact] + [Test] public async Task WithStringMatching_AsRegex_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -241,7 +241,7 @@ public async Task WithStringMatching_AsRegex_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content matching regex pattern \"^foo\""); } - [Fact] + [Test] public async Task WithStringMatching_AsRegex_WithOptions_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -252,7 +252,7 @@ public async Task WithStringMatching_AsRegex_WithOptions_ShouldReturnExpectedVal await That(result).IsEqualTo("string content matching regex pattern \"^foo\" with options Multiline"); } - [Fact] + [Test] public async Task WithStringMatching_IgnoringCase_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyParameter sut = @@ -263,7 +263,7 @@ public async Task WithStringMatching_IgnoringCase_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content matching pattern \"*foo*\" ignoring case"); } - [Fact] + [Test] public async Task WithStringMatching_ShouldReturnExpectedValue() { ItExtensions.IStringContentBodyMatchingParameter sut = @@ -274,7 +274,7 @@ public async Task WithStringMatching_ShouldReturnExpectedValue() await That(result).IsEqualTo("string content matching pattern \"*foo*\""); } - [Fact] + [Test] public async Task WithStringPredicate_ShouldReturnExpectedValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent().WithString(c => c.Length > 0); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithBytesTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithBytesTests.cs index fdea8ca8a..ac2c33a42 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithBytesTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithBytesTests.cs @@ -12,7 +12,7 @@ public sealed partial class IsHttpContentTests { public sealed class WithBytesTests { - [Fact] + [Test] public async Task CalledTwice_ShouldUseFirstPredicate() { HttpClient httpClient = HttpClient.CreateMock(); @@ -33,25 +33,25 @@ await That(httpClient.Mock.Verify.PostAsync( "the first WithBytes predicate matches (length == 3) while the second does not, and the first one must win"); } - [Theory] - [InlineData(new byte[0], 0x1, false)] - [InlineData(new byte[] + [Test] + [Arguments(new byte[0], 0x1, false)] + [Arguments(new byte[] { 0x1, }, 0x1, true)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, }, 0x2, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, 0x2, 0x3, }, 0x1, true)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, 0x2, 0x3, }, 0x2, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, 0x2, 0x3, }, 0x3, false)] @@ -71,30 +71,30 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(new byte[0], new byte[0], true)] - [InlineData(new byte[] + [Test] + [Arguments(new byte[0], new byte[0], true)] + [Arguments(new byte[] { 0x66, }, new byte[] { 0x66, }, true)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x66, }, new byte[] { 0x67, }, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x66, 0x67, }, new byte[] { 0x67, }, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x66, 0x67, }, new byte[] @@ -116,7 +116,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WhenValidatedAndSetup_ShouldResetStreamPosition() { byte[] body = [0x66, 0x67,]; @@ -134,7 +134,7 @@ await That(httpClient.Mock.Verify await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task WhenVerifiedConcurrently_ShouldMatchEveryTime() { byte[] body = [0x66, 0x67,]; diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithFormDataTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithFormDataTests.cs index 30e010aac..9d47ae66f 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithFormDataTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithFormDataTests.cs @@ -12,16 +12,16 @@ public sealed partial class IsHttpContentTests { public sealed class WithFormDataTests { - [Theory] - [InlineData(true, "x", "123", "y", "234", "z", "345", "z", "567")] - [InlineData(true, "z", "567", "x", "123", "z", "345", "y", "234")] - [InlineData(true, "x", "123", "y", "234", "z", "345", "z", "567", "z", "567")] - [InlineData(false, "z", "567", "x", "123", "x", "345", "y", "234")] - [InlineData(false, "x", "123", "y", "234", "z", "345", "z", "567", "z", "789")] - [InlineData(false, "y", "234", "z", "345", "z", "567")] - [InlineData(false, "x", "123", "z", "345")] - [InlineData(false, "x", "123", "y", "234")] - [InlineData(false, "x", "123", "y", "234", "z", "345")] + [Test] + [Arguments(true, "x", "123", "y", "234", "z", "345", "z", "567")] + [Arguments(true, "z", "567", "x", "123", "z", "345", "y", "234")] + [Arguments(true, "x", "123", "y", "234", "z", "345", "z", "567", "z", "567")] + [Arguments(false, "z", "567", "x", "123", "x", "345", "y", "234")] + [Arguments(false, "x", "123", "y", "234", "z", "345", "z", "567", "z", "789")] + [Arguments(false, "y", "234", "z", "345", "z", "567")] + [Arguments(false, "x", "123", "z", "345")] + [Arguments(false, "x", "123", "y", "234")] + [Arguments(false, "x", "123", "y", "234", "z", "345")] public async Task Exactly_ShouldOnlyMatchWhenAllParametersAreChecked( bool expectSuccess, params string[] rawValues) { @@ -53,8 +53,8 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x<>", "1<2> 3 ")] + [Test] + [Arguments("x<>", "1<2> 3 ")] public async Task ShouldEncodeValues(string key, string value) { HttpClient httpClient = HttpClient.CreateMock(); @@ -77,9 +77,9 @@ public async Task ShouldEncodeValues(string key, string value) await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("x", "123", "z", "345")] - [InlineData("z", "345", "x", "123")] + [Test] + [Arguments("x", "123", "z", "345")] + [Arguments("z", "345", "x", "123")] public async Task WithFormData_ShouldMatchParametersInAnyOrder(params string[] rawValues) { List<(string, HttpFormDataValue)> values = new(); @@ -117,14 +117,14 @@ await That(httpClient.Mock.Verify await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("x", "123", true)] - [InlineData("y", "234", true)] - [InlineData("x", "", false)] - [InlineData("y", "", false)] - [InlineData("x", "234", false)] - [InlineData("y", "123", false)] - [InlineData("foo", "", true)] + [Test] + [Arguments("x", "123", true)] + [Arguments("y", "234", true)] + [Arguments("x", "", false)] + [Arguments("y", "", false)] + [Arguments("x", "234", false)] + [Arguments("y", "123", false)] + [Arguments("foo", "", true)] public async Task WithFormDataParameter_ShouldVerifyParameters(string key, string value, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); @@ -154,18 +154,18 @@ await That(result.StatusCode) .IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("?x=123&y=234", true)] - [InlineData("?y=234&x=123&", true)] - [InlineData("x=123", true)] - [InlineData("y=234", true)] - [InlineData("x", false)] - [InlineData("y", false)] - [InlineData("x=234", false)] - [InlineData("y=123", false)] - [InlineData("x=123&y=432", false)] - [InlineData("y=432&x=123", false)] - [InlineData("foo", true)] + [Test] + [Arguments("?x=123&y=234", true)] + [Arguments("?y=234&x=123&", true)] + [Arguments("x=123", true)] + [Arguments("y=234", true)] + [Arguments("x", false)] + [Arguments("y", false)] + [Arguments("x=234", false)] + [Arguments("y=123", false)] + [Arguments("x=123&y=432", false)] + [Arguments("y=432&x=123", false)] + [Arguments("foo", true)] public async Task WithFormDataString_ShouldVerifyParameters(string values, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithHeadersTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithHeadersTests.cs index a44998484..4746c5c4b 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithHeadersTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithHeadersTests.cs @@ -12,7 +12,7 @@ public sealed partial class IsHttpContentTests { public sealed class WithHeadersTests { - [Fact] + [Test] public async Task IncludingRequestHeaders_ShouldMatchRequestHeadersFromContentAndRequest() { HttpClient httpClient = HttpClient.CreateMock(); @@ -31,7 +31,7 @@ public async Task IncludingRequestHeaders_ShouldMatchRequestHeadersFromContentAn await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task IncludingRequestHeaders_WhenNotSet_ShouldOnlyMatchRequestHeadersFromContent() { HttpClient httpClient = HttpClient.CreateMock(); @@ -50,11 +50,11 @@ public async Task IncludingRequestHeaders_WhenNotSet_ShouldOnlyMatchRequestHeade await That(result.StatusCode).IsEqualTo(HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x-myHeader1", "foo", "x-myHeader3", "baz", true)] - [InlineData("x-myHeader3", "baz", "x-myHeader1", "foo", true)] - [InlineData("x-myHeader2", "baz", "x-myHeader1", "foo", false)] - [InlineData("x-myHeader1", "foo", "x-myHeader2", "baz", false)] + [Test] + [Arguments("x-myHeader1", "foo", "x-myHeader3", "baz", true)] + [Arguments("x-myHeader3", "baz", "x-myHeader1", "foo", true)] + [Arguments("x-myHeader2", "baz", "x-myHeader1", "foo", false)] + [Arguments("x-myHeader1", "foo", "x-myHeader2", "baz", false)] public async Task MultipleCalls_ShouldVerifyKeyValueHeaders( string key1, string value1, string key2, string value2, bool expectSuccess) { @@ -76,11 +76,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x-myHeader1", "foo", "x-myHeader3", "baz", true)] - [InlineData("x-myHeader3", "baz", "x-myHeader1", "foo", true)] - [InlineData("x-myHeader2", "baz", "x-myHeader1", "foo", false)] - [InlineData("x-myHeader1", "foo", "x-myHeader2", "baz", false)] + [Test] + [Arguments("x-myHeader1", "foo", "x-myHeader3", "baz", true)] + [Arguments("x-myHeader3", "baz", "x-myHeader1", "foo", true)] + [Arguments("x-myHeader2", "baz", "x-myHeader1", "foo", false)] + [Arguments("x-myHeader1", "foo", "x-myHeader2", "baz", false)] public async Task MultipleCalls_ShouldVerifyKeyValuePairHeaders( string key1, string value1, string key2, string value2, bool expectSuccess) { @@ -102,11 +102,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x-myHeader1: foo", "x-myHeader3: baz", true)] - [InlineData("x-myHeader3: baz", "x-myHeader1: foo", true)] - [InlineData("x-myHeader2: baz", "x-myHeader1: foo", false)] - [InlineData("x-myHeader1: foo", "x-myHeader2: baz", false)] + [Test] + [Arguments("x-myHeader1: foo", "x-myHeader3: baz", true)] + [Arguments("x-myHeader3: baz", "x-myHeader1: foo", true)] + [Arguments("x-myHeader2: baz", "x-myHeader1: foo", false)] + [Arguments("x-myHeader1: foo", "x-myHeader2: baz", false)] public async Task MultipleCalls_ShouldVerifyStringHeaders( string headers1, string headers2, bool expectSuccess) { @@ -128,7 +128,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task ShouldOnlyRequireOneMatchingValue() { HttpClient httpClient = HttpClient.CreateMock(); @@ -147,10 +147,10 @@ public async Task ShouldOnlyRequireOneMatchingValue() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("foo", true)] - [InlineData("bar", false)] - [InlineData("FOO", true)] + [Test] + [Arguments("foo", true)] + [Arguments("bar", false)] + [Arguments("FOO", true)] public async Task ShouldVerifyHeaderKeyCaseInsensitive(string key, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -168,10 +168,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", true)] - [InlineData("bar", false)] - [InlineData("FOO", false)] + [Test] + [Arguments("foo", true)] + [Arguments("bar", false)] + [Arguments("FOO", false)] public async Task ShouldVerifyHeaderValueCaseSensitive(string value, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -189,10 +189,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", true)] - [InlineData("bar", false)] - [InlineData("FOO", true)] + [Test] + [Arguments("foo", true)] + [Arguments("bar", false)] + [Arguments("FOO", true)] public async Task ShouldVerifyMultipleHeaderKeyCaseInsensitive(string key, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -215,10 +215,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", true)] - [InlineData("bar", false)] - [InlineData("FOO", false)] + [Test] + [Arguments("foo", true)] + [Arguments("bar", false)] + [Arguments("FOO", false)] public async Task ShouldVerifyMultipleHeaderValueCaseSensitive(string value, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -241,16 +241,16 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(""" + [Test] + [Arguments(""" x-myHeader1 : foo x-myHeader3: baz """, true)] - [InlineData(""" + [Arguments(""" x-myHeader3: baz x-myHeader1: foo """, true)] - [InlineData(""" + [Arguments(""" x-myHeader2: foo x-myHeader3: baz """, false)] @@ -274,7 +274,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WithInvalidStringHeader_ShouldThrowArgumentException() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithMediaTypeTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithMediaTypeTests.cs index f22118ee8..4680295b8 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithMediaTypeTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithMediaTypeTests.cs @@ -12,10 +12,10 @@ public sealed partial class IsHttpContentTests { public sealed class WithMediaTypeTests { - [Theory] - [InlineData("application/json", true)] - [InlineData("text/plain", false)] - [InlineData("application/txt", false)] + [Test] + [Arguments("application/json", true)] + [Arguments("text/plain", false)] + [Arguments("application/txt", false)] public async Task ShouldVerifyMediaType(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringMatchingTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringMatchingTests.cs index 39796f735..dbde23a03 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringMatchingTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringMatchingTests.cs @@ -13,10 +13,10 @@ public sealed partial class IsHttpContentTests { public sealed class WithStringMatchingTests { - [Theory] - [InlineData("foo", "f[aeiou]*", true)] - [InlineData("foo", "F[aeiou]*", true)] - [InlineData("foo", ".a.", false)] + [Test] + [Arguments("foo", "f[aeiou]*", true)] + [Arguments("foo", "F[aeiou]*", true)] + [Arguments("foo", ".a.", false)] public async Task AsRegex_IgnoringCase_ShouldCheckForCaseInsensitiveMatchingWildcard( string body, string pattern, bool expectSuccess) { @@ -33,10 +33,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "f[aeiou]*", true)] - [InlineData("foo", "F[aeiou]*", false)] - [InlineData("foo", ".a.", false)] + [Test] + [Arguments("foo", "f[aeiou]*", true)] + [Arguments("foo", "F[aeiou]*", false)] + [Arguments("foo", ".a.", false)] public async Task AsRegex_ShouldCheckForMatchingWildcard(string body, string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -52,7 +52,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task AsRegex_ShouldUseProvidedOptions() { HttpClient httpClient = HttpClient.CreateMock(); @@ -68,7 +68,7 @@ public async Task AsRegex_ShouldUseProvidedOptions() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task AsRegex_ShouldUseTimeout() { HttpClient httpClient = HttpClient.CreateMock(); @@ -89,13 +89,13 @@ await That(Act) .WithParamName("matchTimeout"); } - [Theory] - [InlineData("foo", "f?", true)] - [InlineData("foo", "f??", true)] - [InlineData("foo", "f*", true)] - [InlineData("foo", "*", true)] - [InlineData("foo", "F*", true)] - [InlineData("foo", "*a*", false)] + [Test] + [Arguments("foo", "f?", true)] + [Arguments("foo", "f??", true)] + [Arguments("foo", "f*", true)] + [Arguments("foo", "*", true)] + [Arguments("foo", "F*", true)] + [Arguments("foo", "*a*", false)] public async Task IgnoringCase_ShouldCheckForCaseInsensitiveMatchingWildcard( string body, string pattern, bool expectSuccess) { @@ -112,16 +112,16 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "f?", true)] - [InlineData("foo", "f??", true)] - [InlineData("foo", "f*", true)] - [InlineData("foo", "*", true)] - [InlineData("foo", "o?", true)] - [InlineData("foo", "?o", true)] - [InlineData("foo", "o", true)] - [InlineData("foo", "F*", false)] - [InlineData("foo", "*a*", false)] + [Test] + [Arguments("foo", "f?", true)] + [Arguments("foo", "f??", true)] + [Arguments("foo", "f*", true)] + [Arguments("foo", "*", true)] + [Arguments("foo", "o?", true)] + [Arguments("foo", "?o", true)] + [Arguments("foo", "o", true)] + [Arguments("foo", "F*", false)] + [Arguments("foo", "*a*", false)] public async Task ShouldCheckForMatchingWildcard(string body, string pattern, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -137,16 +137,16 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(true, "f?o", "foo")] - [InlineData(true, "f?o", "bar")] - [InlineData(true, "bar", "f?o")] - [InlineData(true, "bar", "bar")] - [InlineData(true, "f?o", "?oo", "b?r", "?ar")] - [InlineData(false, "f?o", "b?r", "baz")] - [InlineData(false, "f?o", "baz", "b?r")] - [InlineData(false, "?az", "f?o", "b?r")] - [InlineData(false, "?az")] + [Test] + [Arguments(true, "f?o", "foo")] + [Arguments(true, "f?o", "bar")] + [Arguments(true, "bar", "f?o")] + [Arguments(true, "bar", "bar")] + [Arguments(true, "f?o", "?oo", "b?r", "?ar")] + [Arguments(false, "f?o", "b?r", "baz")] + [Arguments(false, "f?o", "baz", "b?r")] + [Arguments(false, "?az", "f?o", "b?r")] + [Arguments(false, "?az")] public async Task WithMultipleExpectations_ShouldVerifyAll(bool expectSuccess, params string[] expectedValues) { diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringTests.cs index eb0e1ea92..4827f547e 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringTests.cs @@ -18,8 +18,8 @@ public sealed partial class IsHttpContentTests { public sealed class WithStringTests { - [Theory] - [InlineData("foo", "FOO", true)] + [Test] + [Arguments("foo", "FOO", true)] public async Task Exactly_IgnoringCase_ShouldCheckCaseInsensitiveForFullContentBody( string body, string expected, bool expectSuccess) { @@ -36,12 +36,12 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "foo", true)] - [InlineData("foo", "FOO", false)] - [InlineData("foo", "baz", false)] - [InlineData(" bar", "bar", false)] - [InlineData("baz ", "baz", false)] + [Test] + [Arguments("foo", "foo", true)] + [Arguments("foo", "FOO", false)] + [Arguments("foo", "baz", false)] + [Arguments(" bar", "bar", false)] + [Arguments("baz ", "baz", false)] public async Task Exactly_ShouldCheckForFullContentBody(string body, string expected, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -57,12 +57,12 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "foo", true)] - [InlineData("foo", "FOO", true)] - [InlineData(" foo", "FOO", true)] - [InlineData("FOO ", "foo", true)] - [InlineData("foo", "bar", false)] + [Test] + [Arguments("foo", "foo", true)] + [Arguments("foo", "FOO", true)] + [Arguments(" foo", "FOO", true)] + [Arguments("FOO ", "foo", true)] + [Arguments("foo", "bar", false)] public async Task IgnoringCase_ShouldCheckForCaseInsensitiveEquality(string body, string expected, bool expectSuccess) { @@ -79,12 +79,12 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("", true)] - [InlineData("foo", true)] - [InlineData("FOO", false)] - [InlineData("bar", true)] - [InlineData("BAR", false)] + [Test] + [Arguments("", true)] + [Arguments("foo", true)] + [Arguments("FOO", false)] + [Arguments("bar", true)] + [Arguments("BAR", false)] public async Task Predicate_ShouldValidatePredicate(string content, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -101,11 +101,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "foo", true)] - [InlineData("foo", "FOO", false)] - [InlineData("foo", "bar", false)] - [InlineData("foo", "f*o", false)] + [Test] + [Arguments("foo", "foo", true)] + [Arguments("foo", "FOO", false)] + [Arguments("foo", "bar", false)] + [Arguments("foo", "f*o", false)] public async Task ShouldCheckForEquality(string body, string expected, bool expectSuccess) { @@ -122,7 +122,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task ShouldNotCheckHttpContentType() { string expectedValue = "foo"; @@ -139,7 +139,7 @@ public async Task ShouldNotCheckHttpContentType() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task ShouldSupportMonitoring() { int callbackCount = 0; @@ -169,10 +169,10 @@ await Task.WhenAll(monitor.Values.Select(c => c!.ReadAsStringAsync()))) await That(callbackCount).IsEqualTo(3); } - [Theory] - [InlineData("image/png", false)] - [InlineData("text/plain", true)] - [InlineData("text/csv", false)] + [Test] + [Arguments("image/png", false)] + [Arguments("text/plain", true)] + [Arguments("text/csv", false)] public async Task ShouldVerifyMediaType(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -189,7 +189,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WhenCharsetHeaderIsNotSet_ShouldFallbackToUtf8() { string original = "äöüß"; @@ -209,11 +209,11 @@ await That(result.StatusCode) .IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("UTF-8", false)] - [InlineData("iso-8859-1", true)] - [InlineData("ISO-8859-1", true)] - [InlineData(" iso-8859-1\t", true)] + [Test] + [Arguments("UTF-8", false)] + [Arguments("iso-8859-1", true)] + [Arguments("ISO-8859-1", true)] + [Arguments(" iso-8859-1\t", true)] public async Task WhenCharsetHeaderIsSet_ShouldApplyEncodingCorrectly( string charsetHeader, bool expectSuccess) { @@ -235,7 +235,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WhenValidatedAndSetup_ShouldResetStreamPosition() { HttpClient httpClient = HttpClient.CreateMock(); @@ -252,7 +252,7 @@ await That(httpClient.Mock.Verify await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task WhenVerifiedConcurrently_ShouldMatchEveryTime() { HttpClient httpClient = HttpClient.CreateMock(); @@ -268,8 +268,8 @@ void Act() await That(Act).DoesNotThrow(); } - [Theory] - [InlineData("foo")] + [Test] + [Arguments("foo")] public async Task WithInvalidCharsetHeader_ShouldFallbackToUtf8(string charsetHeader) { string original = "äöüß"; @@ -293,16 +293,16 @@ await That(result.StatusCode) .IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData(true, "foo", "foo")] - [InlineData(true, "foo", "bar")] - [InlineData(true, "bar", "foo")] - [InlineData(true, "bar", "bar")] - [InlineData(true, "foo", "foo", "bar", "bar")] - [InlineData(false, "foo", "bar", "baz")] - [InlineData(false, "foo", "baz", "bar")] - [InlineData(false, "baz", "foo", "bar")] - [InlineData(false, "baz")] + [Test] + [Arguments(true, "foo", "foo")] + [Arguments(true, "foo", "bar")] + [Arguments(true, "bar", "foo")] + [Arguments(true, "bar", "bar")] + [Arguments(true, "foo", "foo", "bar", "bar")] + [Arguments(false, "foo", "bar", "baz")] + [Arguments(false, "foo", "baz", "bar")] + [Arguments(false, "baz", "foo", "bar")] + [Arguments(false, "baz")] public async Task WithMultipleExpectations_ShouldVerifyAll(bool expectSuccess, params string[] expectedValues) { @@ -326,7 +326,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WithMultipleWithString_FailingVerification_ShouldJoinPredicatesWithAnd() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.cs index 0f6fa6d18..04a8aee71 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.cs @@ -14,7 +14,7 @@ public sealed partial class ItExtensionsTests { public sealed partial class IsHttpContentTests { - [Fact] + [Test] public async Task NonGeneric_DispatchesContentThroughCallback() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -27,7 +27,7 @@ public async Task NonGeneric_DispatchesContentThroughCallback() await That(captured).IsSameAs(target); } - [Fact] + [Test] public async Task NonGeneric_DispatchesNullThroughCallback() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -45,7 +45,7 @@ public async Task NonGeneric_DispatchesNullThroughCallback() await That(captured).IsNull(); } - [Fact] + [Test] public async Task NonGeneric_IgnoresUnrelatedTypes() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -57,7 +57,7 @@ public async Task NonGeneric_IgnoresUnrelatedTypes() await That(invocations).IsEqualTo(0); } - [Fact] + [Test] public async Task NonGenericMatches_ReturnsFalseForNullValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -67,7 +67,7 @@ public async Task NonGenericMatches_ReturnsFalseForNullValue() await That(result).IsFalse(); } - [Fact] + [Test] public async Task NonGenericMatches_ReturnsFalseForUnrelatedType() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -77,7 +77,7 @@ public async Task NonGenericMatches_ReturnsFalseForUnrelatedType() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldSupportMonitoring() { int callbackCount = 0; @@ -107,7 +107,7 @@ await That( await That(callbackCount).IsEqualTo(3); } - [Fact] + [Test] public async Task ShouldSupportMultipleCombinations() { byte[] bytes = "foo"u8.ToArray(); @@ -128,7 +128,7 @@ public async Task ShouldSupportMultipleCombinations() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task ShouldSupportWithHeadersInWrapper() { byte[] bytes = "foo"u8.ToArray(); @@ -148,10 +148,10 @@ public async Task ShouldSupportWithHeadersInWrapper() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("image/png", true)] - [InlineData("text/plain", false)] - [InlineData("image/gif", false)] + [Test] + [Arguments("image/png", true)] + [Arguments("text/plain", false)] + [Arguments("image/gif", false)] public async Task ShouldVerifyMediaType(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -169,7 +169,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task TypedMatches_ReturnsFalseForNullValue() { ItExtensions.IHttpContentParameter sut = It.IsHttpContent(); @@ -179,10 +179,10 @@ public async Task TypedMatches_ReturnsFalseForNullValue() await That(result).IsFalse(); } - [Theory] - [InlineData("image/png", true)] - [InlineData("text/plain", false)] - [InlineData("image/gif", false)] + [Test] + [Arguments("image/png", true)] + [Arguments("text/plain", false)] + [Arguments("image/gif", false)] public async Task WithMediaType_ShouldVerifyMediaType(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -200,7 +200,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task Wrapper_NonGenericInvokeCallbacks_DelegatesToInnerParameter() { ItExtensions.IStringContentBodyMatchingParameter sut = It.IsHttpContent().WithStringMatching("foo*"); @@ -218,7 +218,7 @@ public async Task Wrapper_NonGenericInvokeCallbacks_DelegatesToInnerParameter() await That(captured).IsNull(); } - [Fact] + [Test] public async Task Wrapper_NonGenericMatches_DelegatesToInnerParameter() { ItExtensions.IStringContentBodyMatchingParameter sut = It.IsHttpContent().WithStringMatching("foo*"); @@ -230,7 +230,7 @@ public async Task Wrapper_NonGenericMatches_DelegatesToInnerParameter() await That(resultForUnrelated).IsFalse(); } - [Fact] + [Test] public async Task Wrapper_TypedMatches_ReturnsFalseForNullValue() { ItExtensions.IStringContentBodyMatchingParameter sut = It.IsHttpContent().WithStringMatching("foo*"); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.ToStringTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.ToStringTests.cs index bb389fb08..735100137 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.ToStringTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.ToStringTests.cs @@ -9,7 +9,7 @@ public sealed partial class IsHttpRequestMessageTests { public sealed class ToStringTests { - [Fact] + [Test] public async Task Default_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage(); @@ -19,7 +19,7 @@ public async Task Default_ShouldReturnExpectedValue() await That(result).IsEqualTo("a Http-Request"); } - [Fact] + [Test] public async Task MultipleConditions_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage(HttpMethod.Post) @@ -32,7 +32,7 @@ await That(result).IsEqualTo( "POST-Request with Uri matching \"https://example.com\" and Http content with media type \"application/json\""); } - [Fact] + [Test] public async Task WhoseContentIsAction_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = @@ -44,7 +44,7 @@ await That(result).IsEqualTo( "a Http-Request with Http content with media type \"text/plain\""); } - [Fact] + [Test] public async Task WhoseContentIsMediaType_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = @@ -56,7 +56,7 @@ await That(result).IsEqualTo( "a Http-Request with Http content with media type \"application/json\""); } - [Fact] + [Test] public async Task WhoseUriIsAction_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = @@ -68,7 +68,7 @@ await That(result).IsEqualTo( "a Http-Request with https Uri with host matching \"example.com\""); } - [Fact] + [Test] public async Task WhoseUriIsString_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = @@ -79,7 +79,7 @@ public async Task WhoseUriIsString_ShouldReturnExpectedValue() await That(result).IsEqualTo("a Http-Request with Uri matching \"https://example.com\""); } - [Fact] + [Test] public async Task WithHeaders_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = @@ -90,7 +90,7 @@ public async Task WithHeaders_ShouldReturnExpectedValue() await That(result).IsEqualTo("a Http-Request with header \"x-my-header: my-value\""); } - [Fact] + [Test] public async Task WithMethod_ShouldReturnExpectedValue() { ItExtensions.IHttpRequestMessageParameter sut = diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseContentIsTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseContentIsTests.cs index 8c2d0544e..e3ad78f24 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseContentIsTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseContentIsTests.cs @@ -15,7 +15,7 @@ public sealed partial class IsHttpRequestMessageTests { public sealed class WhoseContentIsTests { - [Fact] + [Test] public async Task ShouldNotCheckHttpContentType() { string expectedValue = "foo"; @@ -32,10 +32,10 @@ public async Task ShouldNotCheckHttpContentType() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("image/png", true)] - [InlineData("text/plain", false)] - [InlineData("image/gif", false)] + [Test] + [Arguments("image/png", true)] + [Arguments("text/plain", false)] + [Arguments("image/gif", false)] public async Task ShouldVerifyMediaType(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -53,10 +53,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("text/plain", "foo", true)] - [InlineData("image/png", "foo", false)] - [InlineData("text/plain", "bar", false)] + [Test] + [Arguments("text/plain", "foo", true)] + [Arguments("image/png", "foo", false)] + [Arguments("text/plain", "bar", false)] public async Task ShouldVerifyMediaTypeAndContent(string mediaType, string value, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -73,25 +73,25 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(new byte[0], 0x1, false)] - [InlineData(new byte[] + [Test] + [Arguments(new byte[0], 0x1, false)] + [Arguments(new byte[] { 0x1, }, 0x1, true)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, }, 0x2, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, 0x2, 0x3, }, 0x1, true)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, 0x2, 0x3, }, 0x2, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x1, 0x2, 0x3, }, 0x3, false)] @@ -111,30 +111,30 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData(new byte[0], new byte[0], true)] - [InlineData(new byte[] + [Test] + [Arguments(new byte[0], new byte[0], true)] + [Arguments(new byte[] { 0x66, }, new byte[] { 0x66, }, true)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x66, }, new byte[] { 0x67, }, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x66, 0x67, }, new byte[] { 0x67, }, false)] - [InlineData(new byte[] + [Arguments(new byte[] { 0x66, 0x67, }, new byte[] @@ -156,10 +156,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("image/png", true)] - [InlineData("text/plain", false)] - [InlineData("image/gif", false)] + [Test] + [Arguments("image/png", true)] + [Arguments("text/plain", false)] + [Arguments("image/gif", false)] public async Task WithMediaType_ShouldVerifyMediaType(string mediaType, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -177,10 +177,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "foo", true)] - [InlineData("foo", "FOO", true)] - [InlineData("foo", "bar", false)] + [Test] + [Arguments("foo", "foo", true)] + [Arguments("foo", "FOO", true)] + [Arguments("foo", "bar", false)] public async Task WithString_IgnoringCase_ShouldCheckForCaseInsensitiveEquality(string body, string expected, bool expectSuccess) { @@ -197,12 +197,12 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("", true)] - [InlineData("foo", true)] - [InlineData("FOO", false)] - [InlineData("bar", true)] - [InlineData("BAR", false)] + [Test] + [Arguments("", true)] + [Arguments("foo", true)] + [Arguments("FOO", false)] + [Arguments("bar", true)] + [Arguments("BAR", false)] public async Task WithString_Predicate_ShouldValidatePredicate(string content, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -219,10 +219,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "foo", true)] - [InlineData("foo", "FOO", false)] - [InlineData("foo", "bar", false)] + [Test] + [Arguments("foo", "foo", true)] + [Arguments("foo", "FOO", false)] + [Arguments("foo", "bar", false)] public async Task WithString_ShouldCheckForEquality(string body, string expected, bool expectSuccess) { @@ -239,10 +239,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "f[aeiou]*", true)] - [InlineData("foo", "F[aeiou]*", true)] - [InlineData("foo", ".a.", false)] + [Test] + [Arguments("foo", "f[aeiou]*", true)] + [Arguments("foo", "F[aeiou]*", true)] + [Arguments("foo", ".a.", false)] public async Task WithStringMatching_AsRegex_IgnoringCase_ShouldCheckForCaseInsensitiveMatchingWildcard( string body, string pattern, bool expectSuccess) @@ -261,10 +261,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "f[aeiou]*", true)] - [InlineData("foo", "F[aeiou]*", false)] - [InlineData("foo", ".a.", false)] + [Test] + [Arguments("foo", "f[aeiou]*", true)] + [Arguments("foo", "F[aeiou]*", false)] + [Arguments("foo", ".a.", false)] public async Task WithStringMatching_AsRegex_ShouldCheckForMatchingWildcard( string body, string pattern, bool expectSuccess) { @@ -282,7 +282,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WithStringMatching_AsRegex_ShouldUseProvidedOptions() { HttpClient httpClient = HttpClient.CreateMock(); @@ -298,7 +298,7 @@ public async Task WithStringMatching_AsRegex_ShouldUseProvidedOptions() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task WithStringMatching_AsRegex_ShouldUseTimeout() { HttpClient httpClient = HttpClient.CreateMock(); @@ -319,13 +319,13 @@ await That(Act) .WithParamName("matchTimeout"); } - [Theory] - [InlineData("foo", "f?", true)] - [InlineData("foo", "f??", true)] - [InlineData("foo", "f*", true)] - [InlineData("foo", "*", true)] - [InlineData("foo", "F*", true)] - [InlineData("foo", "*a*", false)] + [Test] + [Arguments("foo", "f?", true)] + [Arguments("foo", "f??", true)] + [Arguments("foo", "f*", true)] + [Arguments("foo", "*", true)] + [Arguments("foo", "F*", true)] + [Arguments("foo", "*a*", false)] public async Task WithStringMatching_IgnoringCase_ShouldCheckForCaseInsensitiveMatchingWildcard( string body, string pattern, bool expectSuccess) { @@ -343,13 +343,13 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", "f?", true)] - [InlineData("foo", "f??", true)] - [InlineData("foo", "f*", true)] - [InlineData("foo", "*", true)] - [InlineData("foo", "F*", false)] - [InlineData("foo", "*a*", false)] + [Test] + [Arguments("foo", "f?", true)] + [Arguments("foo", "f??", true)] + [Arguments("foo", "f*", true)] + [Arguments("foo", "*", true)] + [Arguments("foo", "F*", false)] + [Arguments("foo", "*a*", false)] public async Task WithStringMatching_ShouldCheckForMatchingWildcard( string body, string pattern, bool expectSuccess) { diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseUriIsTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseUriIsTests.cs index 6589d8997..17bd37734 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseUriIsTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseUriIsTests.cs @@ -11,9 +11,9 @@ public sealed partial class IsHttpRequestMessageTests { public sealed class WhoseUriIsTests { - [Theory] - [InlineData("https://www.testably.org", true)] - [InlineData("http://www.testably.org", false)] + [Test] + [Arguments("https://www.testably.org", true)] + [Arguments("http://www.testably.org", false)] public async Task ShouldSupportPatternWithUriConfiguration(string uri, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); @@ -27,9 +27,9 @@ await That(result.StatusCode) .IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("https://www.testably.org", true)] - [InlineData("http://www.testably.org", false)] + [Test] + [Arguments("https://www.testably.org", true)] + [Arguments("http://www.testably.org", false)] public async Task ShouldSupportUriConfiguration(string uri, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); @@ -43,21 +43,21 @@ await That(result.StatusCode) .IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123&y=4", + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123&y=4", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "http://www.testably.org/foo/bar?x=123&y=4", + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "http://www.testably.org/foo/bar?x=123&y=4", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/baz?x=123&y=4", + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/baz?x=123&y=4", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=124&y=4", + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=124&y=4", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*www.testably.org*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*/foo/bar*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*x=123*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*y=4*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*www.testably.org*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*/foo/bar*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*x=123*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*y=4*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https*", true)] public async Task ShouldVerifyFullUriWithWildcardMatch(string uri, string pattern, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); @@ -71,9 +71,9 @@ await That(result.StatusCode) .IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org")] - [InlineData("*testably.org/")] + [Test] + [Arguments("*testably.org")] + [Arguments("*testably.org/")] public async Task TrailingSlash_ShouldBeIgnored(string matchPattern) { HttpClient httpClient = HttpClient.CreateMock(); @@ -89,7 +89,7 @@ await That(result.StatusCode) .IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task TrailingSlash_WhenNotPresent_ShouldNotBeAdded() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WithHeadersTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WithHeadersTests.cs index d5e7d45d7..8885d734d 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WithHeadersTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WithHeadersTests.cs @@ -12,11 +12,11 @@ public sealed partial class IsHttpRequestMessageTests { public sealed class WithHeadersTests { - [Theory] - [InlineData("x-myHeader", "foo", "Authorization", "Basic abcdef", true)] - [InlineData("Authorization", "Basic abcdef", "x-myHeader", "foo", true)] - [InlineData("Authorization", "Basic xyz", "x-myHeader", "foo", false)] - [InlineData("x-myHeader", "foo", "Authorization", "Basic xyz", false)] + [Test] + [Arguments("x-myHeader", "foo", "Authorization", "Basic abcdef", true)] + [Arguments("Authorization", "Basic abcdef", "x-myHeader", "foo", true)] + [Arguments("Authorization", "Basic xyz", "x-myHeader", "foo", false)] + [Arguments("x-myHeader", "foo", "Authorization", "Basic xyz", false)] public async Task MultipleCalls_ShouldVerifyKeyValueHeaders( string key1, string value1, string key2, string value2, bool expectSuccess) { @@ -38,11 +38,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x-myHeader", "foo", "Authorization", "Basic abcdef", true)] - [InlineData("Authorization", "Basic abcdef", "x-myHeader", "foo", true)] - [InlineData("Authorization", "Basic xyz", "x-myHeader", "foo", false)] - [InlineData("x-myHeader", "foo", "Authorization", "Basic xyz", false)] + [Test] + [Arguments("x-myHeader", "foo", "Authorization", "Basic abcdef", true)] + [Arguments("Authorization", "Basic abcdef", "x-myHeader", "foo", true)] + [Arguments("Authorization", "Basic xyz", "x-myHeader", "foo", false)] + [Arguments("x-myHeader", "foo", "Authorization", "Basic xyz", false)] public async Task MultipleCalls_ShouldVerifyKeyValuePairHeaders( string key1, string value1, string key2, string value2, bool expectSuccess) { @@ -64,11 +64,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x-myHeader: foo", "Authorization: Basic abcdef", true)] - [InlineData("Authorization: Basic abcdef", "x-myHeader: foo", true)] - [InlineData("Authorization: Basic xyz", "x-myHeader: foo", false)] - [InlineData("x-myHeader: foo", "Authorization: Basic xyz", false)] + [Test] + [Arguments("x-myHeader: foo", "Authorization: Basic abcdef", true)] + [Arguments("Authorization: Basic abcdef", "x-myHeader: foo", true)] + [Arguments("Authorization: Basic xyz", "x-myHeader: foo", false)] + [Arguments("x-myHeader: foo", "Authorization: Basic xyz", false)] public async Task MultipleCalls_ShouldVerifyStringHeaders( string headers1, string headers2, bool expectSuccess) { @@ -90,7 +90,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task ShouldAlsoMatchContentHeaders() { HttpClient httpClient = HttpClient.CreateMock(); @@ -116,7 +116,7 @@ public async Task ShouldAlsoMatchContentHeaders() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task ShouldMatchAgainstDefaultRequestHeaders() { HttpClient httpClient = HttpClient.CreateMock(); @@ -137,10 +137,10 @@ public async Task ShouldMatchAgainstDefaultRequestHeaders() await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("Authorization", true)] - [InlineData("AUTHORIZATION", true)] - [InlineData("Authentication", false)] + [Test] + [Arguments("Authorization", true)] + [Arguments("AUTHORIZATION", true)] + [Arguments("Authentication", false)] public async Task ShouldVerifyHeaderKeyCaseInsensitive(string key, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -158,10 +158,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", true)] - [InlineData("bar", false)] - [InlineData("FOO", false)] + [Test] + [Arguments("foo", true)] + [Arguments("bar", false)] + [Arguments("FOO", false)] public async Task ShouldVerifyHeaderValueCaseSensitive(string value, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -179,10 +179,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("Authorization", true)] - [InlineData("AUTHORIZATION", true)] - [InlineData("Authentication", false)] + [Test] + [Arguments("Authorization", true)] + [Arguments("AUTHORIZATION", true)] + [Arguments("Authentication", false)] public async Task ShouldVerifyMultipleHeaderKeyCaseInsensitive(string key, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -203,10 +203,10 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("foo", true)] - [InlineData("bar", false)] - [InlineData("FOO", false)] + [Test] + [Arguments("foo", true)] + [Arguments("bar", false)] + [Arguments("FOO", false)] public async Task ShouldVerifyMultipleHeaderValueCaseSensitive(string value, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); @@ -227,7 +227,7 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WithInvalidStringHeader_ShouldThrowArgumentException() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.cs index f240b71f0..aafef2902 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.cs @@ -12,7 +12,7 @@ public sealed partial class ItExtensionsTests { public sealed partial class IsHttpRequestMessageTests { - [Fact] + [Test] public async Task NonGeneric_DispatchesHttpRequestMessageThroughCallback() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage(); @@ -25,7 +25,7 @@ public async Task NonGeneric_DispatchesHttpRequestMessageThroughCallback() await That(captured).IsSameAs(target); } - [Fact] + [Test] public async Task NonGeneric_IgnoresUnrelatedTypes() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage(); @@ -37,7 +37,7 @@ public async Task NonGeneric_IgnoresUnrelatedTypes() await That(invocations).IsEqualTo(0); } - [Fact] + [Test] public async Task NonGenericMatches_ReturnsFalseForUnrelatedType() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage(); @@ -47,7 +47,7 @@ public async Task NonGenericMatches_ReturnsFalseForUnrelatedType() await That(result).IsFalse(); } - [Fact] + [Test] public async Task NonGenericMatches_ReturnsTrueForHttpRequestMessage() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage(); @@ -57,7 +57,7 @@ public async Task NonGenericMatches_ReturnsTrueForHttpRequestMessage() await That(result).IsTrue(); } - [Fact] + [Test] public async Task ShouldSupportMonitoring() { int callbackCount = 0; @@ -86,7 +86,7 @@ await That( await That(callbackCount).IsEqualTo(3); } - [Fact] + [Test] public async Task WithHeaders_OnRequestWithoutContent_ShouldStillEvaluate() { ItExtensions.IHttpRequestMessageParameter sut = It.IsHttpRequestMessage() @@ -106,11 +106,11 @@ public async Task WithHeaders_OnRequestWithoutContent_ShouldStillEvaluate() await That(matchesWithContent).IsTrue(); } - [Theory] - [InlineData(nameof(HttpMethod.Get), true)] - [InlineData(nameof(HttpMethod.Delete), false)] - [InlineData(nameof(HttpMethod.Post), false)] - [InlineData(nameof(HttpMethod.Put), false)] + [Test] + [Arguments(nameof(HttpMethod.Get), true)] + [Arguments(nameof(HttpMethod.Delete), false)] + [Arguments(nameof(HttpMethod.Post), false)] + [Arguments(nameof(HttpMethod.Put), false)] public async Task WithMethod_ShouldVerifyMethod(string method, bool expectSuccess) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ForHttpAndHttpsTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ForHttpAndHttpsTests.cs index 74801930f..f2454963f 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ForHttpAndHttpsTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ForHttpAndHttpsTests.cs @@ -11,10 +11,10 @@ public sealed partial class IsUriTests { public sealed class ForHttpAndHttpsTests { - [Theory] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", true)] - [InlineData("HTTP://www.testably.org/foo/bar?x=123&y=234", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", false)] + [Test] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", true)] + [Arguments("HTTP://www.testably.org/foo/bar?x=123&y=234", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", false)] public async Task ForHttp_ShouldVerifyHttpScheme(string uri, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); @@ -28,10 +28,10 @@ await That(result.StatusCode) .IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", true)] - [InlineData("HTTPS://www.testably.org/foo/bar?x=123&y=234", true)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", false)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", true)] + [Arguments("HTTPS://www.testably.org/foo/bar?x=123&y=234", true)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", false)] public async Task ForHttps_ShouldVerifyHttpsScheme(string uri, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ToStringTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ToStringTests.cs index 6ad5e5c2e..1f8431f8b 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ToStringTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ToStringTests.cs @@ -8,7 +8,7 @@ public sealed partial class IsUriTests { public sealed class ToStringTests { - [Fact] + [Test] public async Task Default_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -18,7 +18,7 @@ public async Task Default_ShouldReturnExpectedValue() await That(result).IsEqualTo("any Uri"); } - [Fact] + [Test] public async Task ForHttp_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().ForHttp(); @@ -28,7 +28,7 @@ public async Task ForHttp_ShouldReturnExpectedValue() await That(result).IsEqualTo("http Uri"); } - [Fact] + [Test] public async Task ForHttps_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().ForHttps(); @@ -38,7 +38,7 @@ public async Task ForHttps_ShouldReturnExpectedValue() await That(result).IsEqualTo("https Uri"); } - [Fact] + [Test] public async Task MultipleConditions_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri("*example.com*") @@ -54,7 +54,7 @@ await That(result).IsEqualTo( "https Uri matching \"*example.com*\" with host matching \"example.com\" with port 443 with path matching \"/api\" with query containing \"x=1\""); } - [Fact] + [Test] public async Task MultipleWithQuery_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri() @@ -66,7 +66,7 @@ public async Task MultipleWithQuery_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri with query containing \"x=1\", \"y=2\""); } - [Fact] + [Test] public async Task WithHost_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().WithHost("example.com"); @@ -76,7 +76,7 @@ public async Task WithHost_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri with host matching \"example.com\""); } - [Fact] + [Test] public async Task WithPath_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().WithPath("/api/v1"); @@ -86,7 +86,7 @@ public async Task WithPath_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri with path matching \"/api/v1\""); } - [Fact] + [Test] public async Task WithPattern_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri("*example.com*"); @@ -96,7 +96,7 @@ public async Task WithPattern_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri matching \"*example.com*\""); } - [Fact] + [Test] public async Task WithPort_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().WithPort(443); @@ -106,7 +106,7 @@ public async Task WithPort_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri with port 443"); } - [Fact] + [Test] public async Task WithQueryKeyValue_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().WithQuery("x", "1"); @@ -116,7 +116,7 @@ public async Task WithQueryKeyValue_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri with query containing \"x=1\""); } - [Fact] + [Test] public async Task WithQueryString_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().WithQuery("x=1"); @@ -126,7 +126,7 @@ public async Task WithQueryString_ShouldReturnExpectedValue() await That(result).IsEqualTo("Uri with query containing \"x=1\""); } - [Fact] + [Test] public async Task WithQueryTuple_ShouldReturnExpectedValue() { ItExtensions.IUriParameter sut = It.IsUri().WithQuery(("x", "1")); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithHostTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithHostTests.cs index 83ea8f5a5..8830c83b1 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithHostTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithHostTests.cs @@ -11,11 +11,11 @@ public sealed partial class IsUriTests { public sealed class WithHostTests { - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "www.testably.org", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "*testably*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "*Testably*", true)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "mockolate.com", false)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "www.testably.org", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "*testably*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "*Testably*", true)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "mockolate.com", false)] public async Task ShouldVerifyHost(string uri, string hostPattern, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPathTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPathTests.cs index 9be9d015f..ae86011e8 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPathTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPathTests.cs @@ -11,12 +11,12 @@ public sealed partial class IsUriTests { public sealed class WithPathTests { - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "/foo/bar", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "*foo*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "*FOO*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "*bar*", true)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "*baz*", false)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "/foo/bar", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "*foo*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "*FOO*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "*bar*", true)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "*baz*", false)] public async Task ShouldVerifyPath(string uri, string pathPattern, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPortTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPortTests.cs index c59a4c34b..af53bdd57 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPortTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPortTests.cs @@ -11,12 +11,12 @@ public sealed partial class IsUriTests { public sealed class WithPortTests { - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", 443, true)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", 80, true)] - [InlineData("https://www.testably.org:8080/foo/bar?x=123&y=234", 8080, true)] - [InlineData("https://www.testably.org:442/foo/bar?x=123&y=234", 443, false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", 442, false)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", 443, true)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", 80, true)] + [Arguments("https://www.testably.org:8080/foo/bar?x=123&y=234", 8080, true)] + [Arguments("https://www.testably.org:442/foo/bar?x=123&y=234", 443, false)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", 442, false)] public async Task ShouldVerifyPort(string uri, int port, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithQueryTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithQueryTests.cs index a0179b62f..d11a674a4 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithQueryTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithQueryTests.cs @@ -12,11 +12,11 @@ public sealed partial class IsUriTests { public sealed class WithQueryTests { - [Theory] - [InlineData("x", "123", "z", "345", true)] - [InlineData("z", "345", "x", "123", true)] - [InlineData("x", "123", "y", "345", false)] - [InlineData("y", "345", "x", "123", false)] + [Test] + [Arguments("x", "123", "z", "345", true)] + [Arguments("z", "345", "x", "123", true)] + [Arguments("x", "123", "y", "345", false)] + [Arguments("y", "345", "x", "123", false)] public async Task MultipleCalls_ShouldVerifyKeyValuePairQueryParameters( string key1, string value1, string key2, string value2, bool expectSuccess) { @@ -32,11 +32,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x", "123", "z", "345", true)] - [InlineData("z", "345", "x", "123", true)] - [InlineData("x", "123", "y", "345", false)] - [InlineData("y", "345", "x", "123", false)] + [Test] + [Arguments("x", "123", "z", "345", true)] + [Arguments("z", "345", "x", "123", true)] + [Arguments("x", "123", "y", "345", false)] + [Arguments("y", "345", "x", "123", false)] public async Task MultipleCalls_ShouldVerifyKeyValueQueryParameters( string key1, string value1, string key2, string value2, bool expectSuccess) { @@ -52,11 +52,11 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x=123", "z=345", true)] - [InlineData("z=345", "x=123", true)] - [InlineData("x=123", "y=345", false)] - [InlineData("y=345", "x=123", false)] + [Test] + [Arguments("x=123", "z=345", true)] + [Arguments("z=345", "x=123", true)] + [Arguments("x=123", "y=345", false)] + [Arguments("y=345", "x=123", false)] public async Task MultipleCalls_ShouldVerifyStringQueryParameters( string query1, string query2, bool expectSuccess) { @@ -72,8 +72,8 @@ await That(result.StatusCode) .IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x<>", "1<2> 3")] + [Test] + [Arguments("x<>", "1<2> 3")] public async Task ShouldEncodeValues(string key, string value) { HttpClient httpClient = HttpClient.CreateMock(); @@ -87,14 +87,14 @@ public async Task ShouldEncodeValues(string key, string value) await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "x", "123", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "y", "234", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "x", "", false)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "y", "", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "x", "234", false)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "y", "123", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&foo&y=234", "foo", "", true)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "x", "123", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "y", "234", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "x", "", false)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "y", "", false)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "x", "234", false)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "y", "123", false)] + [Arguments("https://www.testably.org/foo/bar?x=123&foo&y=234", "foo", "", true)] public async Task WithQueryParameter_ShouldVerifyQueryParameters(string uri, string key, string value, bool expectMatch) { @@ -109,9 +109,9 @@ await That(result.StatusCode) .IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("x", "123", "z", "345")] - [InlineData("z", "345", "x", "123")] + [Test] + [Arguments("x", "123", "z", "345")] + [Arguments("z", "345", "x", "123")] public async Task WithQueryParameters_ShouldMatchQueryParametersInAnyOrder(params string[] query) { List<(string, HttpQueryParameterValue)> queryParameters = new(); @@ -131,17 +131,17 @@ public async Task WithQueryParameters_ShouldMatchQueryParametersInAnyOrder(param await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK); } - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "?x=123&y=234", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "?y=234&x=123&", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "x=123", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "y=234", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "x", false)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "y", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=234", "x=234", false)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "y=123", false)] - [InlineData("http://www.testably.org/foo/bar?x=123&y=234", "x=123&y=23", false)] - [InlineData("http://www.testably.org/foo/bar?x=123&foo&y=234", "foo", true)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "?x=123&y=234", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "?y=234&x=123&", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "x=123", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "y=234", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "x", false)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "y", false)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=234", "x=234", false)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "y=123", false)] + [Arguments("http://www.testably.org/foo/bar?x=123&y=234", "x=123&y=23", false)] + [Arguments("http://www.testably.org/foo/bar?x=123&foo&y=234", "foo", true)] public async Task WithQueryString_ShouldVerifyQueryParameters(string uri, string query, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.cs b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.cs index 3e9c93b0c..97d7fa73a 100644 --- a/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.cs +++ b/Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.cs @@ -11,7 +11,7 @@ public sealed partial class ItExtensionsTests { public sealed partial class IsUriTests { - [Fact] + [Test] public async Task NonGeneric_DispatchesNullThroughCallback() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -29,7 +29,7 @@ public async Task NonGeneric_DispatchesNullThroughCallback() await That(captured).IsNull(); } - [Fact] + [Test] public async Task NonGeneric_DispatchesUriThroughCallback() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -42,7 +42,7 @@ public async Task NonGeneric_DispatchesUriThroughCallback() await That(captured).IsSameAs(target); } - [Fact] + [Test] public async Task NonGeneric_IgnoresUnrelatedTypes() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -54,7 +54,7 @@ public async Task NonGeneric_IgnoresUnrelatedTypes() await That(invocations).IsEqualTo(0); } - [Fact] + [Test] public async Task NonGenericMatches_ReturnsFalseForNonUriValue() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -64,7 +64,7 @@ public async Task NonGenericMatches_ReturnsFalseForNonUriValue() await That(result).IsFalse(); } - [Fact] + [Test] public async Task NonGenericMatches_ReturnsFalseForNullValue() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -74,7 +74,7 @@ public async Task NonGenericMatches_ReturnsFalseForNullValue() await That(result).IsFalse(); } - [Fact] + [Test] public async Task ShouldSupportMonitoring() { int callbackCount = 0; @@ -96,18 +96,18 @@ await That(monitor.Values.Select(u => u?.ToString())) await That(callbackCount).IsEqualTo(3); } - [Theory] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "testably.org*x=123", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123&y=4", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "http://www.testably.org/foo/bar?x=123&y=4", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/baz?x=123&y=4", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=124&y=4", false)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*www.testably.org*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*/foo/bar*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*x=123*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "*y=4*", true)] - [InlineData("https://www.testably.org/foo/bar?x=123&y=4", "https*", true)] + [Test] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "testably.org*x=123", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123&y=4", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "http://www.testably.org/foo/bar?x=123&y=4", false)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/baz?x=123&y=4", false)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=124&y=4", false)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https://www.testably.org/foo/bar?x=123", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*www.testably.org*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*/foo/bar*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*x=123*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "*y=4*", true)] + [Arguments("https://www.testably.org/foo/bar?x=123&y=4", "https*", true)] public async Task ShouldVerifyFullUriWithWildcardMatch(string uri, string pattern, bool expectMatch) { HttpClient httpClient = HttpClient.CreateMock(); @@ -120,9 +120,9 @@ public async Task ShouldVerifyFullUriWithWildcardMatch(string uri, string patter await That(result.StatusCode).IsEqualTo(expectMatch ? HttpStatusCode.OK : HttpStatusCode.NotImplemented); } - [Theory] - [InlineData("*testably.org")] - [InlineData("*testably.org/")] + [Test] + [Arguments("*testably.org")] + [Arguments("*testably.org/")] public async Task TrailingSlash_ShouldBeIgnored(string matchPattern) { HttpClient httpClient = HttpClient.CreateMock(); @@ -137,7 +137,7 @@ await That(result.StatusCode) .IsEqualTo(HttpStatusCode.OK); } - [Fact] + [Test] public async Task TrailingSlash_WhenNotPresent_ShouldNotBeAdded() { HttpClient httpClient = HttpClient.CreateMock(); @@ -152,7 +152,7 @@ await That(result.StatusCode) .IsEqualTo(HttpStatusCode.NotImplemented); } - [Fact] + [Test] public async Task WhenTypeDoesNotMatch_Null_ShouldReturnFalse() { ItExtensions.IUriParameter sut = It.IsUri(); @@ -163,7 +163,7 @@ public async Task WhenTypeDoesNotMatch_Null_ShouldReturnFalse() await That(result).IsFalse(); } - [Fact] + [Test] public async Task WithPattern_AcceptsBothTrailingSlashAndWithoutTrailingSlash() { ItExtensions.IUriParameter sut = It.IsUri("http://x/foo"); @@ -176,7 +176,7 @@ public async Task WithPattern_AcceptsBothTrailingSlashAndWithoutTrailingSlash() await That(matchesWithoutSlash).IsTrue(); } - [Fact] + [Test] public async Task WithTrailingSlashOnRequestAndNoSuffixWildcardInPattern_ShouldStillMatch() { HttpClient httpClient = HttpClient.CreateMock(); diff --git a/global.json b/global.json index 00ba24c2b..000ffd6ed 100644 --- a/global.json +++ b/global.json @@ -2,5 +2,8 @@ "sdk": { "version": "10.0.300", "rollForward": "latestPatch" + }, + "test": { + "runner": "Microsoft.Testing.Platform" } }