Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/stryker/Stryker.Config.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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%

Expand Down
56 changes: 25 additions & 31 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="7.2.0" />
<PackageVersion Include="Testably.Abstractions.Interface" Version="9.0.0" />
<PackageVersion Include="Testably.Abstractions.Testing" Version="4.3.1" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="MinVer" Version="6.0.0" />
<PackageVersion Include="Nullable" Version="1.3.1" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
</ItemGroup>

</Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="AwesomeAssertions" Version="9.1.0" />
<PackageVersion Include="Testably.Abstractions.Interface" Version="9.0.0" />
<PackageVersion Include="Testably.Abstractions.Testing" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="MinVer" Version="6.0.0" />
<PackageVersion Include="Nullable" Version="1.3.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.4" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
</ItemGroup>
</Project>
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
4 changes: 2 additions & 2 deletions Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<Authors>Testably</Authors>
<Copyright>Copyright (c) 2023 Testably</Copyright>
<PackageTags>abstractions testing fluent-assertions</PackageTags>
<PackageProjectUrl>https://github.com/Testably/Testably.Abstractions.FluentAssertions</PackageProjectUrl>
<PackageProjectUrl>https://github.com/Testably/Testably.Abstractions.AwesomeAssertions</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>Docs/logo_256x256.png</PackageIcon>
<RepositoryUrl>https://github.com/Testably/Testably.Abstractions.FluentAssertions.git</RepositoryUrl>
<RepositoryUrl>https://github.com/Testably/Testably.Abstractions.AwesomeAssertions.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Linq;

namespace Testably.Abstractions.FluentAssertions;
namespace Testably.Abstractions.AwesomeAssertions;

/// <summary>
/// Assertions on <see cref="IDirectoryInfo" />.
Expand All @@ -11,8 +11,8 @@ public class DirectoryAssertions :
/// <inheritdoc cref="ReferenceTypeAssertions{TSubject,TAssertions}.Identifier" />
protected override string Identifier => "directory";

internal DirectoryAssertions(IDirectoryInfo? instance)
: base(instance)
internal DirectoryAssertions(IDirectoryInfo? instance, AssertionChain currentAssertionChain)
: base(instance, currentAssertionChain)
{
}

Expand All @@ -26,7 +26,7 @@ public AndConstraint<DirectoryAssertions> HasDirectories(
string because = "",
params object[] becauseArgs)
{
Execute.Assertion
CurrentAssertionChain
.WithDefaultIdentifier(Identifier)
.BecauseOf(because, becauseArgs)
.ForCondition(Subject != null)
Expand Down Expand Up @@ -63,7 +63,7 @@ public AndWhichConstraint<FileSystemAssertions, DirectoryAssertions> 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)
Expand All @@ -90,8 +90,8 @@ public AndWhichConstraint<FileSystemAssertions, DirectoryAssertions> HasDirector
directoryInfo => directoryInfo.Name);

return new AndWhichConstraint<FileSystemAssertions, DirectoryAssertions>(
new FileSystemAssertions(Subject!.FileSystem),
new DirectoryAssertions(subdirectory));
new FileSystemAssertions(Subject!.FileSystem, CurrentAssertionChain),
new DirectoryAssertions(subdirectory, CurrentAssertionChain));
}

/// <summary>
Expand All @@ -101,7 +101,7 @@ public AndWhichConstraint<FileSystemAssertions, FileAssertions> 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)
Expand All @@ -128,8 +128,8 @@ public AndWhichConstraint<FileSystemAssertions, FileAssertions> HasFile(
directoryInfo => directoryInfo.Name);

return new AndWhichConstraint<FileSystemAssertions, FileAssertions>(
new FileSystemAssertions(Subject!.FileSystem),
new FileAssertions(file));
new FileSystemAssertions(Subject!.FileSystem, CurrentAssertionChain),
new FileAssertions(file, CurrentAssertionChain));
}

/// <summary>
Expand All @@ -149,7 +149,7 @@ public AndConstraint<DirectoryAssertions> HasFiles(
string because = "",
params object[] becauseArgs)
{
Execute.Assertion
CurrentAssertionChain
.WithDefaultIdentifier(Identifier)
.BecauseOf(because, becauseArgs)
.ForCondition(Subject != null)
Expand Down
Loading
Loading