diff --git a/.github/stryker/Stryker.Config.json b/.github/stryker/Stryker.Config.json index 3b31066..eeccab2 100644 --- a/.github/stryker/Stryker.Config.json +++ b/.github/stryker/Stryker.Config.json @@ -1,13 +1,13 @@ { "stryker-config": { "project-info": { - "name": "github.com/Testably/Testably.Abstractions.FluentAssertions", - "module": "Testably.Abstractions.FluentAssertions" + "name": "github.com/Testably/Testably.Abstractions.AwesomeAssertions", + "module": "Testably.Abstractions.AwesomeAssertions" }, "test-projects": [ - "./Testably.Abstractions.FluentAssertions.Tests/Testably.Abstractions.FluentAssertions.Tests.csproj" + "./Testably.Abstractions.AwesomeAssertions.Tests/Testably.Abstractions.AwesomeAssertions.Tests.csproj" ], - "project": "Testably.Abstractions.FluentAssertions.csproj", + "project": "Testably.Abstractions.AwesomeAssertions.csproj", "target-framework": "net8.0", "reporters": [ "html", diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a084b0f..e67e693 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: $version = minver -t v $productVersion,$prerelease = $version -split '-',2 echo "Detected product version: $productVersion" - .\.sonar\scanner\dotnet-sonarscanner begin /k:"Testably_Testably.Abstractions.FluentAssertions" /o:"testably" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /v:"$productVersion" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml + .\.sonar\scanner\dotnet-sonarscanner begin /k:"Testably_Testably.Abstractions.AwesomeAssertions" /o:"testably" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /v:"$productVersion" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml dotnet tool install --global dotnet-coverage dotnet restore -s 'nuget.config' dotnet build --no-incremental /p:NetCoreOnly=True --configuration "Release" @@ -184,9 +184,9 @@ jobs: - name: Navigate to Workspace run: cd $GITHUB_WORKSPACE - name: Build solution - run: msbuild.exe Testably.Abstractions.FluentAssertions.sln /p:NetFrameworkOnly=True /p:platform="Any CPU" /p:configuration="Release" -t:restore,build -p:RestorePackagesConfig=true + run: msbuild.exe Testably.Abstractions.AwesomeAssertions.sln /p:NetFrameworkOnly=True /p:platform="Any CPU" /p:configuration="Release" -t:restore,build -p:RestorePackagesConfig=true - name: Run tests - run: vstest.console.exe .\Build\Tests\Testably.Abstractions.FluentAssertions.Tests\net48\Testably.Abstractions.FluentAssertions.Tests.dll + run: vstest.console.exe .\Build\Tests\Testably.Abstractions.AwesomeAssertions.Tests\net48\Testably.Abstractions.AwesomeAssertions.Tests.dll upload-coverage: name: Upload coverage to Codacy @@ -244,7 +244,7 @@ jobs: shell: bash run: | dotnet tool install dotnet-stryker --tool-path ../tools - - name: Analyze Testably.Abstractions.FluentAssertions + - name: Analyze Testably.Abstractions.AwesomeAssertions env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} shell: bash @@ -285,7 +285,7 @@ jobs: run: | version="${GITHUB_REF#refs/heads/release/}" # Add changelog badge to README.md - sed -i -e "2 a\[!\[Changelog](https:\/\/img\.shields\.io\/badge\/Changelog-${version}-blue)](https:\/\/github\.com\/Testably\/Testably\.Abstractions\.FluentAssertions\/releases\/tag\/${version})" "./README.md" + sed -i -e "2 a\[!\[Changelog](https:\/\/img\.shields\.io\/badge\/Changelog-${version}-blue)](https:\/\/github\.com\/Testably\/Testably\.Abstractions\.AwesomeAssertions\/releases\/tag\/${version})" "./README.md" for f in "README.md" do echo "Processing $f" # always double quote "$f" filename @@ -294,9 +294,9 @@ jobs: grep -v "Codacy Badge" "./$f" > "./$f.backup" && mv "./$f.backup" "./$f" # Change status badges to display explicit version sed -i -e "s/branch=main/branch=release%2F${version}/g" "./$f" - sed -i -e "s/Testably.Abstractions.FluentAssertions%2Fmain/Testably.Abstractions.FluentAssertions%2Frelease%2F${version}/g" "./$f" - sed -i -e "s/Testably.Abstractions.FluentAssertions%2Fmain/Testably.Abstractions.FluentAssertions%2Frelease%2F${version}/g" "./$f" - sed -i -e "s/Testably.Abstractions.FluentAssertions\/main)/Testably.Abstractions.FluentAssertions\/release\/${version})/g" "./$f" + sed -i -e "s/Testably.Abstractions.AwesomeAssertions%2Fmain/Testably.Abstractions.AwesomeAssertions%2Frelease%2F${version}/g" "./$f" + sed -i -e "s/Testably.Abstractions.AwesomeAssertions%2Fmain/Testably.Abstractions.AwesomeAssertions%2Frelease%2F${version}/g" "./$f" + sed -i -e "s/Testably.Abstractions.AwesomeAssertions\/main)/Testably.Abstractions.AwesomeAssertions\/release\/${version})/g" "./$f" done - name: Build run: dotnet build --configuration "Release" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f029a08..766e3e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,9 +114,9 @@ jobs: - name: Navigate to Workspace run: cd $GITHUB_WORKSPACE - name: Build solution - run: msbuild.exe Testably.Abstractions.FluentAssertions.sln /p:NetFrameworkOnly=True /p:platform="Any CPU" /p:configuration="Release" -t:restore,build -p:RestorePackagesConfig=true + run: msbuild.exe Testably.Abstractions.AwesomeAssertions.sln /p:NetFrameworkOnly=True /p:platform="Any CPU" /p:configuration="Release" -t:restore,build -p:RestorePackagesConfig=true - name: Run tests - run: vstest.console.exe .\Build\Tests\Testably.Abstractions.FluentAssertions.Tests\net48\Testably.Abstractions.FluentAssertions.Tests.dll /Logger:trx /ResultsDirectory:TestResults + run: vstest.console.exe .\Build\Tests\Testably.Abstractions.AwesomeAssertions.Tests\net48\Testably.Abstractions.AwesomeAssertions.Tests.dll /Logger:trx /ResultsDirectory:TestResults - name: Upload test results (.NET Framework) if: ${{ always() }} uses: actions/upload-artifact@v4 @@ -148,14 +148,14 @@ jobs: shell: bash run: | mkdir Tests/StrykerOutput/Reports -p - - name: Analyze Testably.Abstractions.FluentAssertions + - name: Analyze Testably.Abstractions.AwesomeAssertions env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} shell: bash run: | cd Tests ../../tools/dotnet-stryker -f ../.github/stryker/Stryker.Config.json -v "${GITHUB_HEAD_REF}" -r "Dashboard" -r "html" -r "cleartext" --since:main - mv ./StrykerOutput/**/reports/*.html ./StrykerOutput/Reports/Testably.Abstractions.FluentAssertions-report.html + mv ./StrykerOutput/**/reports/*.html ./StrykerOutput/Reports/Testably.Abstractions.AwesomeAssertions-report.html - name: Upload Stryker reports uses: actions/upload-artifact@v4 with: @@ -167,8 +167,8 @@ jobs: shell: bash run: | prNumber="${{ github.event.number }}" - commentsUrl="https://api.github.com/repos/Testably/Testably.Abstractions.FluentAssertions/issues/$prNumber/comments" - mutationBadge="[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FTestably%2FTestably.Abstractions.FluentAssertions%2F${GITHUB_HEAD_REF})](https://dashboard.stryker-mutator.io/reports/github.com/Testably/Testably.Abstractions.FluentAssertions/${GITHUB_HEAD_REF})" + commentsUrl="https://api.github.com/repos/Testably/Testably.Abstractions.AwesomeAssertions/issues/$prNumber/comments" + mutationBadge="[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FTestably%2FTestably.Abstractions.AwesomeAssertions%2F${GITHUB_HEAD_REF})](https://dashboard.stryker-mutator.io/reports/github.com/Testably/Testably.Abstractions.AwesomeAssertions/${GITHUB_HEAD_REF})" dashboardLink="[Stryker.NET](https://stryker-mutator.io/docs/stryker-net/introduction/) mutation tested the changes in the pull request: \n$mutationBadge" echo "Search for comment in PR#$prNumber containing $mutationBadge..." result=$(curl -X GET $commentsUrl \ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2379146..a3bd6db 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ All code should be covered by unit tests and comply with the coding guideline in ### Technical expectations As a framework for supporting unit testing, this project has a high standard for testing itself. -In order to support this, static code analysis is performed using [SonarCloud](https://sonarcloud.io/project/overview?id=Testably_Testably.Abstractions.FluentAssertions) with quality gate requiring to +In order to support this, static code analysis is performed using [SonarCloud](https://sonarcloud.io/project/overview?id=Testably_Testably.Abstractions.AwesomeAssertions) with quality gate requiring to - solve all issues reported by SonarCloud - have a code coverage of > 90% diff --git a/Directory.Packages.props b/Directory.Packages.props index cfb2af9..5804695 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,32 +1,26 @@ - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + true + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index fb03cda..f457d99 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ -![Testably.Abstractions.FluentAssertions](https://raw.githubusercontent.com/Testably/Testably.Abstractions.FluentAssertions/main/Docs/Images/social-preview.png) -[![Nuget](https://img.shields.io/nuget/v/Testably.Abstractions.FluentAssertions)](https://www.nuget.org/packages/Testably.Abstractions.FluentAssertions) -[![Build](https://github.com/Testably/Testably.Abstractions.FluentAssertions/actions/workflows/build.yml/badge.svg)](https://github.com/Testably/Testably.Abstractions.FluentAssertions/actions/workflows/build.yml) -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5b9b2f79950447a69d69037b43acd590)](https://app.codacy.com/gh/Testably/Testably.Abstractions.FluentAssertions/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) -[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Testably_Testably.Abstractions.FluentAssertions&branch=main&metric=coverage)](https://sonarcloud.io/summary/overall?id=Testably_Testably.Abstractions.FluentAssertions&branch=main) -[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FTestably%2FTestably.Abstractions.FluentAssertions%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/Testably/Testably.Abstractions.FluentAssertions/main) +![Testably.Abstractions.AwesomeAssertions](https://raw.githubusercontent.com/Testably/Testably.Abstractions.AwesomeAssertions/main/Docs/Images/social-preview.png) +[![Nuget](https://img.shields.io/nuget/v/Testably.Abstractions.AwesomeAssertions)](https://www.nuget.org/packages/Testably.Abstractions.AwesomeAssertions) +[![Build](https://github.com/Testably/Testably.Abstractions.AwesomeAssertions/actions/workflows/build.yml/badge.svg)](https://github.com/Testably/Testably.Abstractions.AwesomeAssertions/actions/workflows/build.yml) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5b9b2f79950447a69d69037b43acd590)](https://app.codacy.com/gh/Testably/Testably.Abstractions.AwesomeAssertions/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Testably_Testably.Abstractions.AwesomeAssertions&branch=main&metric=coverage)](https://sonarcloud.io/summary/overall?id=Testably_Testably.Abstractions.AwesomeAssertions&branch=main) +[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FTestably%2FTestably.Abstractions.AwesomeAssertions%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/Testably/Testably.Abstractions.AwesomeAssertions/main) -This library is an extension to [FluentAssertions](https://github.com/fluentassertions/fluentassertions) for the [`IFileSystem` interface](https://github.com/TestableIO/System.IO.Abstractions). +This library is an extension to [AwesomeAssertions](https://github.com/AwesomeAssertions/AwesomeAssertions) for the [`IFileSystem` interface](https://github.com/TestableIO/System.IO.Abstractions). ## Getting Started -- Install `Testably.Abstractions.FluentAssertions` as nuget package. +- Install `Testably.Abstractions.AwesomeAssertions` as nuget package. ```ps - dotnet add package Testably.Abstractions.FluentAssertions + dotnet add package Testably.Abstractions.AwesomeAssertions ``` - Add the following `using` statement: ```csharp - using Testably.Abstractions.FluentAssertions; + using Testably.Abstractions.AwesomeAssertions; ``` This brings the extension methods in the current scope. diff --git a/Source/Directory.Build.props b/Source/Directory.Build.props index 27d8765..d714a5c 100644 --- a/Source/Directory.Build.props +++ b/Source/Directory.Build.props @@ -7,10 +7,10 @@ Testably Copyright (c) 2023 Testably abstractions testing fluent-assertions - https://github.com/Testably/Testably.Abstractions.FluentAssertions + https://github.com/Testably/Testably.Abstractions.AwesomeAssertions MIT Docs/logo_256x256.png - https://github.com/Testably/Testably.Abstractions.FluentAssertions.git + https://github.com/Testably/Testably.Abstractions.AwesomeAssertions.git git v diff --git a/Source/Testably.Abstractions.FluentAssertions/DirectoryAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/DirectoryAssertions.cs similarity index 92% rename from Source/Testably.Abstractions.FluentAssertions/DirectoryAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/DirectoryAssertions.cs index 83be292..c316588 100644 --- a/Source/Testably.Abstractions.FluentAssertions/DirectoryAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/DirectoryAssertions.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -11,8 +11,8 @@ public class DirectoryAssertions : /// protected override string Identifier => "directory"; - internal DirectoryAssertions(IDirectoryInfo? instance) - : base(instance) + internal DirectoryAssertions(IDirectoryInfo? instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } @@ -26,7 +26,7 @@ public AndConstraint HasDirectories( string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -63,7 +63,7 @@ public AndWhichConstraint HasDirector string searchPattern = "*", string because = "", params object[] becauseArgs) { var subdirectory = Subject?.GetDirectories(searchPattern).FirstOrDefault(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -90,8 +90,8 @@ public AndWhichConstraint HasDirector directoryInfo => directoryInfo.Name); return new AndWhichConstraint( - new FileSystemAssertions(Subject!.FileSystem), - new DirectoryAssertions(subdirectory)); + new FileSystemAssertions(Subject!.FileSystem, CurrentAssertionChain), + new DirectoryAssertions(subdirectory, CurrentAssertionChain)); } /// @@ -101,7 +101,7 @@ public AndWhichConstraint HasFile( string searchPattern = "*", string because = "", params object[] becauseArgs) { var file = Subject?.GetFiles(searchPattern).FirstOrDefault(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -128,8 +128,8 @@ public AndWhichConstraint HasFile( directoryInfo => directoryInfo.Name); return new AndWhichConstraint( - new FileSystemAssertions(Subject!.FileSystem), - new FileAssertions(file)); + new FileSystemAssertions(Subject!.FileSystem, CurrentAssertionChain), + new FileAssertions(file, CurrentAssertionChain)); } /// @@ -149,7 +149,7 @@ public AndConstraint HasFiles( string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) diff --git a/Source/Testably.Abstractions.FluentAssertions/DirectoryInfoAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/DirectoryInfoAssertions.cs similarity index 73% rename from Source/Testably.Abstractions.FluentAssertions/DirectoryInfoAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/DirectoryInfoAssertions.cs index 1fb7c5a..e39f31a 100644 --- a/Source/Testably.Abstractions.FluentAssertions/DirectoryInfoAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/DirectoryInfoAssertions.cs @@ -1,4 +1,4 @@ -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -9,8 +9,8 @@ public class DirectoryInfoAssertions : /// protected override string Identifier => "directory"; - internal DirectoryInfoAssertions(IDirectoryInfo? instance) - : base(instance) + internal DirectoryInfoAssertions(IDirectoryInfo? instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } @@ -20,7 +20,7 @@ internal DirectoryInfoAssertions(IDirectoryInfo? instance) public AndConstraint HaveDirectories( string searchPattern = "*", string because = "", params object[] becauseArgs) { - new DirectoryAssertions(Subject).HasDirectories(searchPattern, because, becauseArgs); + new DirectoryAssertions(Subject, CurrentAssertionChain).HasDirectories(searchPattern, because, becauseArgs); return new AndConstraint(this); } @@ -30,7 +30,7 @@ public AndConstraint HaveDirectories( public AndWhichConstraint HaveDirectory( string searchPattern = "*", string because = "", params object[] becauseArgs) { - return new DirectoryAssertions(Subject).HasDirectory(searchPattern, because, + return new DirectoryAssertions(Subject, CurrentAssertionChain).HasDirectory(searchPattern, because, becauseArgs); } @@ -40,7 +40,7 @@ public AndWhichConstraint HaveDirecto public AndWhichConstraint HaveFile( string searchPattern = "*", string because = "", params object[] becauseArgs) { - return new DirectoryAssertions(Subject).HasFile(searchPattern, because, + return new DirectoryAssertions(Subject, CurrentAssertionChain).HasFile(searchPattern, because, becauseArgs); } @@ -50,7 +50,7 @@ public AndWhichConstraint HaveFile( public AndConstraint HaveFiles( string searchPattern = "*", string because = "", params object[] becauseArgs) { - new DirectoryAssertions(Subject).HasFiles(searchPattern, because, becauseArgs); + new DirectoryAssertions(Subject, CurrentAssertionChain).HasFiles(searchPattern, because, becauseArgs); return new AndConstraint(this); } } diff --git a/Source/Testably.Abstractions.FluentAssertions/FileAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/FileAssertions.cs similarity index 95% rename from Source/Testably.Abstractions.FluentAssertions/FileAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/FileAssertions.cs index 1b4cfa8..9dbe98e 100644 --- a/Source/Testably.Abstractions.FluentAssertions/FileAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/FileAssertions.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Text; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -13,8 +13,8 @@ public class FileAssertions : /// protected override string Identifier => "file"; - internal FileAssertions(IFileInfo? instance) - : base(instance) + internal FileAssertions(IFileInfo? instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } @@ -24,7 +24,7 @@ internal FileAssertions(IFileInfo? instance) public AndConstraint DoesNotHaveAttribute( FileAttributes attribute, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -53,7 +53,7 @@ public AndConstraint DoesNotHaveAttribute( public AndConstraint DoesNotHaveFileShare( FileShare fileShare, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -75,7 +75,7 @@ public AndConstraint DoesNotHaveFileShare( public AndConstraint HasAttribute( FileAttributes attribute, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -97,7 +97,7 @@ public AndConstraint HasAttribute( public AndConstraint HasContent( byte[] bytes, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -121,7 +121,7 @@ public AndConstraint HasContent( public AndConstraint HasContent( Match pattern, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -145,7 +145,7 @@ public AndConstraint HasContent( public AndConstraint HasContent( Match pattern, Encoding encoding, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -175,7 +175,7 @@ public AndConstraint HasContent( public AndConstraint HasFileShare( FileShare fileShare, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -197,7 +197,7 @@ public AndConstraint HasFileShare( public AndConstraint IsNotReadOnly( string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -219,7 +219,7 @@ public AndConstraint IsNotReadOnly( public AndConstraint IsReadOnly( string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) diff --git a/Source/Testably.Abstractions.FluentAssertions/FileInfoAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/FileInfoAssertions.cs similarity index 78% rename from Source/Testably.Abstractions.FluentAssertions/FileInfoAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/FileInfoAssertions.cs index e8d9440..54a579b 100644 --- a/Source/Testably.Abstractions.FluentAssertions/FileInfoAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/FileInfoAssertions.cs @@ -1,7 +1,7 @@ using System.IO; using System.Text; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -12,8 +12,8 @@ public class FileInfoAssertions : /// protected override string Identifier => "file"; - internal FileInfoAssertions(IFileInfo? instance) - : base(instance) + internal FileInfoAssertions(IFileInfo? instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } @@ -23,7 +23,7 @@ internal FileInfoAssertions(IFileInfo? instance) public AndConstraint BeReadOnly( string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).IsReadOnly(because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).IsReadOnly(because, becauseArgs); return new AndConstraint(this); } @@ -33,7 +33,7 @@ public AndConstraint BeReadOnly( public AndConstraint HaveAttribute( FileAttributes attribute, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).HasAttribute(attribute, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).HasAttribute(attribute, because, becauseArgs); return new AndConstraint(this); } @@ -43,7 +43,7 @@ public AndConstraint HaveAttribute( public AndConstraint HaveContent( byte[] bytes, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).HasContent(bytes, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).HasContent(bytes, because, becauseArgs); return new AndConstraint(this); } @@ -53,7 +53,7 @@ public AndConstraint HaveContent( public AndConstraint HaveContent( Match pattern, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).HasContent(pattern, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).HasContent(pattern, because, becauseArgs); return new AndConstraint(this); } @@ -64,7 +64,7 @@ public AndConstraint HaveContent( public AndConstraint HaveContent( Match pattern, Encoding encoding, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).HasContent(pattern, encoding, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).HasContent(pattern, encoding, because, becauseArgs); return new AndConstraint(this); } @@ -81,7 +81,7 @@ public AndConstraint HaveContent( public AndConstraint HaveFileShare( FileShare fileShare, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).HasFileShare(fileShare, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).HasFileShare(fileShare, because, becauseArgs); return new AndConstraint(this); } @@ -91,7 +91,7 @@ public AndConstraint HaveFileShare( public AndConstraint NotBeReadOnly( string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).IsNotReadOnly(because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).IsNotReadOnly(because, becauseArgs); return new AndConstraint(this); } @@ -101,7 +101,7 @@ public AndConstraint NotBeReadOnly( public AndConstraint NotHaveAttribute( FileAttributes attribute, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).DoesNotHaveAttribute(attribute, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).DoesNotHaveAttribute(attribute, because, becauseArgs); return new AndConstraint(this); } @@ -118,7 +118,7 @@ public AndConstraint NotHaveAttribute( public AndConstraint NotHaveFileShare( FileShare fileShare, string because = "", params object[] becauseArgs) { - new FileAssertions(Subject).DoesNotHaveFileShare(fileShare, because, becauseArgs); + new FileAssertions(Subject, CurrentAssertionChain).DoesNotHaveFileShare(fileShare, because, becauseArgs); return new AndConstraint(this); } } diff --git a/Source/Testably.Abstractions.FluentAssertions/FileSystemAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/FileSystemAssertions.cs similarity index 85% rename from Source/Testably.Abstractions.FluentAssertions/FileSystemAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/FileSystemAssertions.cs index 666081b..658b36d 100644 --- a/Source/Testably.Abstractions.FluentAssertions/FileSystemAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/FileSystemAssertions.cs @@ -1,4 +1,4 @@ -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -9,8 +9,8 @@ public class FileSystemAssertions : /// protected override string Identifier => "filesystem"; - internal FileSystemAssertions(IFileSystem instance) - : base(instance) + internal FileSystemAssertions(IFileSystem instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } @@ -20,7 +20,7 @@ internal FileSystemAssertions(IFileSystem instance) public AndWhichConstraint HaveDirectory( string path, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(!string.IsNullOrEmpty(path)) @@ -33,7 +33,7 @@ public AndWhichConstraint HaveDirecto _ => path, directoryInfo => directoryInfo.Name); return new AndWhichConstraint(this, - new DirectoryAssertions(Subject.DirectoryInfo.New(path))); + new DirectoryAssertions(Subject.DirectoryInfo.New(path), CurrentAssertionChain)); } /// @@ -42,7 +42,7 @@ public AndWhichConstraint HaveDirecto public AndWhichConstraint HaveFile( string path, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(!string.IsNullOrEmpty(path)) @@ -55,7 +55,7 @@ public AndWhichConstraint HaveFile( _ => path, fileInfo => fileInfo.Name); return new AndWhichConstraint(this, - new FileAssertions(Subject.FileInfo.New(path))); + new FileAssertions(Subject.FileInfo.New(path), CurrentAssertionChain)); } /// @@ -64,7 +64,7 @@ public AndWhichConstraint HaveFile( public AndWhichConstraint NotHaveDirectory( string path, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(!string.IsNullOrEmpty(path)) @@ -78,7 +78,7 @@ public AndWhichConstraint NotHaveDire _ => path, directoryInfo => directoryInfo.Name); return new AndWhichConstraint(this, - new DirectoryAssertions(Subject.DirectoryInfo.New(path))); + new DirectoryAssertions(Subject.DirectoryInfo.New(path), CurrentAssertionChain)); } /// @@ -87,7 +87,7 @@ public AndWhichConstraint NotHaveDire public AndWhichConstraint NotHaveFile( string path, string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(!string.IsNullOrEmpty(path)) @@ -101,6 +101,6 @@ public AndWhichConstraint NotHaveFile( _ => path, fileInfo => fileInfo.Name); return new AndWhichConstraint(this, - new FileAssertions(Subject.FileInfo.New(path))); + new FileAssertions(Subject.FileInfo.New(path), CurrentAssertionChain)); } } diff --git a/Source/Testably.Abstractions.FluentAssertions/FileSystemExtensions.cs b/Source/Testably.Abstractions.AwesomeAssertions/FileSystemExtensions.cs similarity index 82% rename from Source/Testably.Abstractions.FluentAssertions/FileSystemExtensions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/FileSystemExtensions.cs index 796268a..7ea43e7 100644 --- a/Source/Testably.Abstractions.FluentAssertions/FileSystemExtensions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/FileSystemExtensions.cs @@ -1,6 +1,6 @@ using Testably.Abstractions.Testing.Statistics; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertion extensions on . @@ -12,33 +12,33 @@ public static class FileSystemExtensions /// assert the current . /// public static DirectoryInfoAssertions Should(this IDirectoryInfo? instance) - => new(instance); + => new(instance, AssertionChain.GetOrCreate()); /// /// Returns a object that can be used to /// assert the current . /// public static FileInfoAssertions Should(this IFileInfo? instance) - => new(instance); + => new(instance, AssertionChain.GetOrCreate()); /// /// Returns a object that can be used to /// assert the current . /// public static FileSystemInfoAssertions Should(this IFileSystemInfo? instance) - => new(instance); + => new(instance, AssertionChain.GetOrCreate()); /// /// Returns a object that can be used to /// assert the current . /// public static FileSystemAssertions Should(this IFileSystem instance) - => new(instance); + => new(instance, AssertionChain.GetOrCreate()); /// /// Returns a object that can be used to /// assert the current . /// public static StatisticAssertions Should(this IStatistics? instance) - => new(instance); + => new(instance, AssertionChain.GetOrCreate()); } diff --git a/Source/Testably.Abstractions.FluentAssertions/FileSystemInfoAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/FileSystemInfoAssertions.cs similarity index 84% rename from Source/Testably.Abstractions.FluentAssertions/FileSystemInfoAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/FileSystemInfoAssertions.cs index 0c60016..71bebef 100644 --- a/Source/Testably.Abstractions.FluentAssertions/FileSystemInfoAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/FileSystemInfoAssertions.cs @@ -1,4 +1,4 @@ -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -9,8 +9,8 @@ public class FileSystemInfoAssertions : /// protected override string Identifier => "file system info"; - internal FileSystemInfoAssertions(IFileSystemInfo? instance) - : base(instance) + internal FileSystemInfoAssertions(IFileSystemInfo? instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } } @@ -27,7 +27,10 @@ public abstract class /// /// Initializes a new instance of /// - protected FileSystemInfoAssertions(TFileSystemInfo? subject) : base(subject) + protected FileSystemInfoAssertions( + TFileSystemInfo? subject, + AssertionChain currentAssertionChain) + : base(subject, currentAssertionChain) { } @@ -37,7 +40,7 @@ protected FileSystemInfoAssertions(TFileSystemInfo? subject) : base(subject) public AndConstraint Exist( string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) @@ -58,7 +61,7 @@ public AndConstraint Exist( public AndConstraint NotExist( string because = "", params object[] becauseArgs) { - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier(Identifier) .BecauseOf(because, becauseArgs) .ForCondition(Subject != null) diff --git a/Source/Testably.Abstractions.FluentAssertions/Match.cs b/Source/Testably.Abstractions.AwesomeAssertions/Match.cs similarity index 98% rename from Source/Testably.Abstractions.FluentAssertions/Match.cs rename to Source/Testably.Abstractions.AwesomeAssertions/Match.cs index b44284b..3937006 100644 --- a/Source/Testably.Abstractions.FluentAssertions/Match.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/Match.cs @@ -1,7 +1,7 @@ using System; using System.Text.RegularExpressions; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Match a against a pattern. diff --git a/Source/Testably.Abstractions.FluentAssertions/StatisticAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/StatisticAssertions.cs similarity index 76% rename from Source/Testably.Abstractions.FluentAssertions/StatisticAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/StatisticAssertions.cs index cf0b024..f924c8a 100644 --- a/Source/Testably.Abstractions.FluentAssertions/StatisticAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/StatisticAssertions.cs @@ -1,7 +1,7 @@ using System.Linq; using Testably.Abstractions.Testing.Statistics; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on . @@ -12,8 +12,8 @@ public class StatisticAssertions : /// protected override string Identifier => "statistics"; - internal StatisticAssertions(IStatistics? instance) - : base(instance) + internal StatisticAssertions(IStatistics? instance, AssertionChain currentAssertionChain) + : base(instance, currentAssertionChain) { } @@ -26,11 +26,12 @@ public StatisticPropertyAssertions> HaveAccess { if (Subject == null) { - return new StatisticPropertyAssertions>(this, propertyName); + return new StatisticPropertyAssertions>(this, + propertyName, CurrentAssertionChain); } return new StatisticPropertyAssertions>(this, propertyName, - Subject.Properties.Where(p => p.Name == propertyName)); + Subject.Properties.Where(p => p.Name == propertyName), CurrentAssertionChain); } /// @@ -42,10 +43,10 @@ public StatisticMethodAssertions> HaveCalled( { if (Subject == null) { - return new StatisticMethodAssertions>(this, methodName); + return new StatisticMethodAssertions>(this, methodName, CurrentAssertionChain); } return new StatisticMethodAssertions>(this, methodName, - Subject.Methods.Where(m => m.Name == methodName)); + Subject.Methods.Where(m => m.Name == methodName), CurrentAssertionChain); } } diff --git a/Source/Testably.Abstractions.FluentAssertions/StatisticAssertionsCount.cs b/Source/Testably.Abstractions.AwesomeAssertions/StatisticAssertionsCount.cs similarity index 84% rename from Source/Testably.Abstractions.FluentAssertions/StatisticAssertionsCount.cs rename to Source/Testably.Abstractions.AwesomeAssertions/StatisticAssertionsCount.cs index 26bb163..c070fdd 100644 --- a/Source/Testably.Abstractions.FluentAssertions/StatisticAssertionsCount.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/StatisticAssertionsCount.cs @@ -1,11 +1,26 @@ -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on statistics. /// -public abstract class StatisticAssertionsCount(TAssertions assertions) - where TAssertions : StatisticAssertions +public abstract class StatisticAssertionsCount where TAssertions : StatisticAssertions { + /// + /// Provides access to the that this assertion class was initialized with. + /// + public AssertionChain CurrentAssertionChain { get; } + + private readonly TAssertions _assertions; + + /// + /// Assertions on statistics. + /// + protected StatisticAssertionsCount(TAssertions assertions, AssertionChain currentAssertionChain) + { + _assertions = assertions; + CurrentAssertionChain = currentAssertionChain; + } + /// /// Flag indicating if the subject of the assertion is null. /// @@ -33,7 +48,7 @@ public AndConstraint AtLeast(int count, string because = "", params object[] becauseArgs) { int actualCount = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -43,7 +58,7 @@ public AndConstraint AtLeast(int count, .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} at least {CountToString(count)}{{reason}}, but it was {CountToString(actualCount)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -53,7 +68,7 @@ public AndConstraint AtLeastOnce( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -63,7 +78,7 @@ public AndConstraint AtLeastOnce( .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} at least once{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -73,7 +88,7 @@ public AndConstraint AtLeastTwice( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -83,7 +98,7 @@ public AndConstraint AtLeastTwice( .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} at least twice{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -93,7 +108,7 @@ public AndConstraint AtMost(int count, string because = "", params object[] becauseArgs) { int actualCount = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -103,7 +118,7 @@ public AndConstraint AtMost(int count, .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} at most {CountToString(count)}{{reason}}, but it was {CountToString(actualCount)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -113,7 +128,7 @@ public AndConstraint AtMostOnce( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -123,7 +138,7 @@ public AndConstraint AtMostOnce( .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} at most once{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -133,7 +148,7 @@ public AndConstraint AtMostTwice( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -143,7 +158,7 @@ public AndConstraint AtMostTwice( .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} at most twice{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -153,7 +168,7 @@ public AndConstraint Exactly(int count, string because = "", params object[] becauseArgs) { int actualCount = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -163,7 +178,7 @@ public AndConstraint Exactly(int count, .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} {CountToString(count)}{{reason}}, but it was {CountToString(actualCount)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -173,7 +188,7 @@ public AndConstraint Never( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -183,7 +198,7 @@ public AndConstraint Never( .FailWith( $"Expected {StatisticType} `{StatisticName}` to never be {StatisticTypeVerb}{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -193,7 +208,7 @@ public AndConstraint Once( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -203,7 +218,7 @@ public AndConstraint Once( .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} once{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// @@ -213,7 +228,7 @@ public AndConstraint Twice( string because = "", params object[] becauseArgs) { int count = GetCount(); - Execute.Assertion + CurrentAssertionChain .WithDefaultIdentifier("Statistic") .BecauseOf(because, becauseArgs) .ForCondition(!IsSubjectNull) @@ -223,7 +238,7 @@ public AndConstraint Twice( .FailWith( $"Expected {StatisticType} `{StatisticName}` to be {StatisticTypeVerb} twice{{reason}}, but it was {CountToString(count)}."); - return new AndConstraint(assertions); + return new AndConstraint(_assertions); } /// diff --git a/Source/Testably.Abstractions.FluentAssertions/StatisticMethodAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/StatisticMethodAssertions.cs similarity index 91% rename from Source/Testably.Abstractions.FluentAssertions/StatisticMethodAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/StatisticMethodAssertions.cs index 095e2ae..183530c 100644 --- a/Source/Testably.Abstractions.FluentAssertions/StatisticMethodAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/StatisticMethodAssertions.cs @@ -3,7 +3,7 @@ using System.Linq; using Testably.Abstractions.Testing.Statistics; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on method statistics. @@ -28,18 +28,18 @@ public class StatisticMethodAssertions private readonly IEnumerable _methods; - internal StatisticMethodAssertions(TAssertions assertions, string methodName) - : base(assertions) + internal StatisticMethodAssertions(TAssertions assertions, string methodName, AssertionChain currentAssertionChain) + : base(assertions, currentAssertionChain) { _assertions = assertions; IsSubjectNull = true; StatisticName = methodName; - _methods = Array.Empty(); + _methods = []; } internal StatisticMethodAssertions(TAssertions assertions, string methodName, - IEnumerable methods) - : base(assertions) + IEnumerable methods, AssertionChain currentAssertionChain) + : base(assertions, currentAssertionChain) { IsSubjectNull = false; StatisticName = methodName; @@ -78,7 +78,7 @@ public StatisticMethodAssertions WithParameterAt public StatisticMethodAssertions WithParameterAt(int index, Func predicate) => new(_assertions, StatisticName, - _methods.Where(p => p.Parameters[index].Is(predicate))); + _methods.Where(p => p.Parameters[index].Is(predicate)), CurrentAssertionChain); /// /// Filters for methods whose second parameter equals . diff --git a/Source/Testably.Abstractions.FluentAssertions/StatisticPropertyAssertions.cs b/Source/Testably.Abstractions.AwesomeAssertions/StatisticPropertyAssertions.cs similarity index 82% rename from Source/Testably.Abstractions.FluentAssertions/StatisticPropertyAssertions.cs rename to Source/Testably.Abstractions.AwesomeAssertions/StatisticPropertyAssertions.cs index 96813d5..9c470c9 100644 --- a/Source/Testably.Abstractions.FluentAssertions/StatisticPropertyAssertions.cs +++ b/Source/Testably.Abstractions.AwesomeAssertions/StatisticPropertyAssertions.cs @@ -3,7 +3,7 @@ using System.Linq; using Testably.Abstractions.Testing.Statistics; -namespace Testably.Abstractions.FluentAssertions; +namespace Testably.Abstractions.AwesomeAssertions; /// /// Assertions on property statistics. @@ -26,17 +26,18 @@ public class StatisticPropertyAssertions private readonly IEnumerable _properties; - internal StatisticPropertyAssertions(TAssertions assertions, string propertyName) - : base(assertions) + internal StatisticPropertyAssertions(TAssertions assertions, string propertyName, + AssertionChain currentAssertionChain) + : base(assertions, currentAssertionChain) { IsSubjectNull = true; StatisticName = propertyName; - _properties = Array.Empty(); + _properties = []; } internal StatisticPropertyAssertions(TAssertions assertions, string propertyName, - IEnumerable properties) - : base(assertions) + IEnumerable properties, AssertionChain currentAssertionChain) + : base(assertions, currentAssertionChain) { IsSubjectNull = false; StatisticName = propertyName; diff --git a/Source/Testably.Abstractions.FluentAssertions/Testably.Abstractions.FluentAssertions.csproj b/Source/Testably.Abstractions.AwesomeAssertions/Testably.Abstractions.AwesomeAssertions.csproj similarity index 63% rename from Source/Testably.Abstractions.FluentAssertions/Testably.Abstractions.FluentAssertions.csproj rename to Source/Testably.Abstractions.AwesomeAssertions/Testably.Abstractions.AwesomeAssertions.csproj index ece9d1f..b170adf 100644 --- a/Source/Testably.Abstractions.FluentAssertions/Testably.Abstractions.FluentAssertions.csproj +++ b/Source/Testably.Abstractions.AwesomeAssertions/Testably.Abstractions.AwesomeAssertions.csproj @@ -1,8 +1,9 @@  - Testably.Abstractions.FluentAssertions - FluentAssertions extension methods for `Testably.Abstractions`. + net9.0 + Testably.Abstractions.AwesomeAssertions + AwesomeAssertions extension methods for `Testably.Abstractions`. Docs/README.md false false @@ -13,7 +14,7 @@ - + diff --git a/Source/Testably.Abstractions.AwesomeAssertions/Usings.cs b/Source/Testably.Abstractions.AwesomeAssertions/Usings.cs new file mode 100644 index 0000000..e97ad8d --- /dev/null +++ b/Source/Testably.Abstractions.AwesomeAssertions/Usings.cs @@ -0,0 +1,4 @@ +global using AwesomeAssertions; +global using AwesomeAssertions.Execution; +global using AwesomeAssertions.Primitives; +global using System.IO.Abstractions; diff --git a/Source/Testably.Abstractions.FluentAssertions/Usings.cs b/Source/Testably.Abstractions.FluentAssertions/Usings.cs deleted file mode 100644 index 868bcfa..0000000 --- a/Source/Testably.Abstractions.FluentAssertions/Usings.cs +++ /dev/null @@ -1,4 +0,0 @@ -global using FluentAssertions; -global using FluentAssertions.Execution; -global using FluentAssertions.Primitives; -global using System.IO.Abstractions; diff --git a/Testably.Abstractions.FluentAssertions.sln b/Testably.Abstractions.AwesomeAssertions.sln similarity index 91% rename from Testably.Abstractions.FluentAssertions.sln rename to Testably.Abstractions.AwesomeAssertions.sln index 87d1337..d36be1b 100644 --- a/Testably.Abstractions.FluentAssertions.sln +++ b/Testably.Abstractions.AwesomeAssertions.sln @@ -42,9 +42,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\test-report.yml = .github\workflows\test-report.yml EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.FluentAssertions", "Source\Testably.Abstractions.FluentAssertions\Testably.Abstractions.FluentAssertions.csproj", "{BC318ADF-0A23-4D0F-8FBE-4E73F839450A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.AwesomeAssertions", "Source\Testably.Abstractions.AwesomeAssertions\Testably.Abstractions.AwesomeAssertions.csproj", "{BC318ADF-0A23-4D0F-8FBE-4E73F839450A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.FluentAssertions.Tests", "Tests\Testably.Abstractions.FluentAssertions.Tests\Testably.Abstractions.FluentAssertions.Tests.csproj", "{67F7AF4E-B807-4627-9452-E5BC50E32B90}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.AwesomeAssertions.Tests", "Tests\Testably.Abstractions.AwesomeAssertions.Tests\Testably.Abstractions.AwesomeAssertions.Tests.csproj", "{67F7AF4E-B807-4627-9452-E5BC50E32B90}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Testably.Abstractions.FluentAssertions.sln.DotSettings b/Testably.Abstractions.AwesomeAssertions.sln.DotSettings similarity index 99% rename from Testably.Abstractions.FluentAssertions.sln.DotSettings rename to Testably.Abstractions.AwesomeAssertions.sln.DotSettings index a088a7e..d18ca1c 100644 --- a/Testably.Abstractions.FluentAssertions.sln.DotSettings +++ b/Testably.Abstractions.AwesomeAssertions.sln.DotSettings @@ -427,6 +427,7 @@ True True True + True True True True diff --git a/Tests/Directory.Build.props b/Tests/Directory.Build.props index 13d33b2..707895a 100644 --- a/Tests/Directory.Build.props +++ b/Tests/Directory.Build.props @@ -24,7 +24,7 @@ - + diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/DirectoryAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/DirectoryAssertionsTests.cs similarity index 99% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/DirectoryAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/DirectoryAssertionsTests.cs index 43d424e..79c6965 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/DirectoryAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/DirectoryAssertionsTests.cs @@ -1,10 +1,10 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using Testably.Abstractions.Testing; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class DirectoryAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/DirectoryInfoAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/DirectoryInfoAssertionsTests.cs similarity index 99% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/DirectoryInfoAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/DirectoryInfoAssertionsTests.cs index b8e4442..09cf685 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/DirectoryInfoAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/DirectoryInfoAssertionsTests.cs @@ -1,11 +1,11 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO.Abstractions; using Testably.Abstractions.Testing; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class DirectoryInfoAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileAssertionsTests.cs similarity index 99% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/FileAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileAssertionsTests.cs index cc36a19..0ba48f6 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileAssertionsTests.cs @@ -1,5 +1,5 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO; using System.IO.Abstractions; @@ -9,7 +9,7 @@ using Testably.Abstractions.Testing.Initializer; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class FileAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileInfoAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileInfoAssertionsTests.cs similarity index 99% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/FileInfoAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileInfoAssertionsTests.cs index d36f832..3259458 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileInfoAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileInfoAssertionsTests.cs @@ -1,5 +1,5 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO; using System.IO.Abstractions; @@ -9,7 +9,7 @@ using Testably.Abstractions.Testing.Initializer; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class FileInfoAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileSystemAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileSystemAssertionsTests.cs similarity index 98% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/FileSystemAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileSystemAssertionsTests.cs index d35b8d1..26367a4 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileSystemAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileSystemAssertionsTests.cs @@ -1,10 +1,10 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using Testably.Abstractions.Testing; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class FileSystemAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileSystemInfoAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileSystemInfoAssertionsTests.cs similarity index 99% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/FileSystemInfoAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileSystemInfoAssertionsTests.cs index 1d4d724..5f53f42 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/FileSystemInfoAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/FileSystemInfoAssertionsTests.cs @@ -1,11 +1,11 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO.Abstractions; using Testably.Abstractions.Testing; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class FileSystemInfoAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/MatchTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/MatchTests.cs similarity index 94% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/MatchTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/MatchTests.cs index fb7cc77..023ddb1 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/MatchTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/MatchTests.cs @@ -1,7 +1,7 @@ -using FluentAssertions; +using AwesomeAssertions; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public sealed class MatchTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticAssertionsCountTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticAssertionsCountTests.cs similarity index 99% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticAssertionsCountTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticAssertionsCountTests.cs index 9e697d3..df58777 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticAssertionsCountTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticAssertionsCountTests.cs @@ -1,12 +1,12 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO.Abstractions; using Testably.Abstractions.Testing; using Testably.Abstractions.Testing.Statistics; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class StatisticAssertionsCountTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticMethodAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticMethodAssertionsTests.cs similarity index 98% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticMethodAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticMethodAssertionsTests.cs index b5d5120..6fb4eae 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticMethodAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticMethodAssertionsTests.cs @@ -1,5 +1,5 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO.Abstractions; using System.Text; @@ -7,7 +7,7 @@ using Testably.Abstractions.Testing.Statistics; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class StatisticMethodAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticPropertyAssertionsTests.cs b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticPropertyAssertionsTests.cs similarity index 92% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticPropertyAssertionsTests.cs rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticPropertyAssertionsTests.cs index d7f7675..fd66638 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/StatisticPropertyAssertionsTests.cs +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/StatisticPropertyAssertionsTests.cs @@ -1,12 +1,12 @@ using AutoFixture.Xunit2; -using FluentAssertions; +using AwesomeAssertions; using System; using System.IO.Abstractions; using Testably.Abstractions.Testing; using Testably.Abstractions.Testing.Statistics; using Xunit; -namespace Testably.Abstractions.FluentAssertions.Tests; +namespace Testably.Abstractions.AwesomeAssertions.Tests; public class StatisticPropertyAssertionsTests { diff --git a/Tests/Testably.Abstractions.FluentAssertions.Tests/Testably.Abstractions.FluentAssertions.Tests.csproj b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/Testably.Abstractions.AwesomeAssertions.Tests.csproj similarity index 52% rename from Tests/Testably.Abstractions.FluentAssertions.Tests/Testably.Abstractions.FluentAssertions.Tests.csproj rename to Tests/Testably.Abstractions.AwesomeAssertions.Tests/Testably.Abstractions.AwesomeAssertions.Tests.csproj index dbc096a..5860e1c 100644 --- a/Tests/Testably.Abstractions.FluentAssertions.Tests/Testably.Abstractions.FluentAssertions.Tests.csproj +++ b/Tests/Testably.Abstractions.AwesomeAssertions.Tests/Testably.Abstractions.AwesomeAssertions.Tests.csproj @@ -1,15 +1,17 @@  - - net6.0 + + net9.0 - + + +