Skip to content

Commit

Permalink
Drop support for NSpec3 (fluentassertions#2356)
Browse files Browse the repository at this point in the history
* Drop support for `NSpec3`

* Add release notes

* Fix documentation
  • Loading branch information
ITaluone authored Oct 4, 2023
1 parent 4514a98 commit c5b518a
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 144 deletions.
66 changes: 29 additions & 37 deletions Build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using LibGit2Sharp;
using Nuke.Common;
Expand All @@ -15,8 +14,6 @@
using Nuke.Common.Tools.Xunit;
using Nuke.Common.Utilities.Collections;
using Nuke.Components;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks;
using static Nuke.Common.Tools.Xunit.XunitTasks;
Expand Down Expand Up @@ -62,9 +59,6 @@ class Build : NukeBuild
[GitRepository]
readonly GitRepository GitRepository;

[NuGetPackage("nspec", "NSpecRunner.exe", Version = "3.1.0")]
Tool NSpec3;

#if OS_WINDOWS
[NuGetPackage("Node.js.redist", "node.exe", Version = "16.20.0", Framework = "win-x64")]
#elif OS_MAC
Expand Down Expand Up @@ -95,6 +89,7 @@ class Build : NukeBuild
.Executes(() =>
{
SemVer = GitVersion.SemVer;
if (IsPullRequest)
{
Information(
Expand Down Expand Up @@ -176,9 +171,9 @@ class Build : NukeBuild
.Executes(() =>
{
string[] testAssemblies = Projects
.SelectMany(project => project.Directory.GlobFiles("bin/Debug/net47/*.Specs.dll"))
.Select(_ => _.ToString())
.ToArray();
.SelectMany(project => project.Directory.GlobFiles("bin/Debug/net47/*.Specs.dll"))
.Select(_ => _.ToString())
.ToArray();
Assert.NotEmpty(testAssemblies.ToList());
Expand All @@ -197,25 +192,25 @@ class Build : NukeBuild
const string net47 = "net47";
DotNetTest(s => s
.SetConfiguration(Configuration.Debug)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.EnableNoBuild()
.SetDataCollector("XPlat Code Coverage")
.SetResultsDirectory(TestResultsDirectory)
.AddRunSetting(
"DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DoesNotReturnAttribute",
"DoesNotReturnAttribute")
.CombineWith(
Projects,
(_, project) => _
.SetProjectFile(project)
.CombineWith(
project.GetTargetFrameworks().Except(new[] { net47 }),
(_, framework) => _
.SetFramework(framework)
.AddLoggers($"trx;LogFileName={project.Name}_{framework}.trx")
)
), completeOnFailure: true
.SetConfiguration(Configuration.Debug)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
.EnableNoBuild()
.SetDataCollector("XPlat Code Coverage")
.SetResultsDirectory(TestResultsDirectory)
.AddRunSetting(
"DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DoesNotReturnAttribute",
"DoesNotReturnAttribute")
.CombineWith(
Projects,
(_, project) => _
.SetProjectFile(project)
.CombineWith(
project.GetTargetFrameworks().Except(new[] { net47 }),
(_, framework) => _
.SetFramework(framework)
.AddLoggers($"trx;LogFileName={project.Name}_{framework}.trx")
)
), completeOnFailure: true
);
ReportTestOutcome(globFilters: $"*[!*{net47}].trx");
Expand All @@ -227,9 +222,9 @@ class Build : NukeBuild

static string[] Outcomes(AbsolutePath path)
=> XmlTasks.XmlPeek(
path,
"/xn:TestRun/xn:Results/xn:UnitTestResult/@outcome",
("xn", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010")).ToArray();
path,
"/xn:TestRun/xn:Results/xn:UnitTestResult/@outcome",
("xn", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010")).ToArray();

void ReportTestOutcome(params string[] globFilters)
{
Expand All @@ -254,7 +249,8 @@ void ReportTestOutcome(params string[] globFilters)
.Executes(() =>
{
ReportGenerator(s => s
.SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll", framework: "net6.0"))
.SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll",
framework: "net6.0"))
.SetTargetDirectory(TestResultsDirectory / "reports")
.AddReports(TestResultsDirectory / "**/coverage.cobertura.xml")
.AddReportTypes(
Expand Down Expand Up @@ -303,11 +299,6 @@ from framework in supportedFrameworks
.SetFramework(v.framework)
.AddLoggers($"trx;LogFileName={v.project.Name}_{v.framework}.trx")), completeOnFailure: true);
if (EnvironmentInfo.IsWin)
{
NSpec3($"{Solution.TestFrameworks.NSpec3_Net47_Specs.Directory / "bin" / "Debug" / "net47" / "NSpec3.Specs.dll"}");
}
ReportTestOutcome(projects.Select(p => $"*{p.Name}*.trx").ToArray());
});

Expand Down Expand Up @@ -359,6 +350,7 @@ from framework in supportedFrameworks
.Executes(() =>
{
Node($"{YarnCli} --silent install", workingDirectory: RootDirectory);
Node($"{YarnCli} --silent run cspell", workingDirectory: RootDirectory,
logger: (_, msg) => Error(msg));
});
Expand Down
1 change: 0 additions & 1 deletion Build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="GitVersion.Tool" Version="[5.10.0]" />
<PackageDownload Include="NSpec" Version="[3.1.0]" />
<PackageDownload Include="ReportGenerator" Version="[5.1.23]" />
<PackageDownload Include="xunit.runner.console" Version="[2.5.0]" />
<PackageDownload Include="Node.js.redist" Version="[16.20.0]" />
Expand Down
9 changes: 0 additions & 9 deletions FluentAssertions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentAssertions", "Src\Flu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUnit3.Specs", "Tests\TestFrameworks\NUnit3.Specs\NUnit3.Specs.csproj", "{C8335EA3-C6CE-47C9-AB4F-CE37157E1EB2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSpec3.Net47.Specs", "Tests\TestFrameworks\NSpec3.Net47.Specs\NSpec3.Net47.Specs.csproj", "{4195D943-DEF5-41AA-87E6-E273C33E1111}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSpec.Specs", "Tests\TestFrameworks\MSpec.Specs\MSpec.Specs.csproj", "{4F210C41-7E8E-424A-B956-FC1AA47663C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Tests\Benchmarks\Benchmarks.csproj", "{FCAFB0F1-79EA-4D49-813B-188D4BC4BE71}"
Expand Down Expand Up @@ -99,12 +97,6 @@ Global
{C8335EA3-C6CE-47C9-AB4F-CE37157E1EB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8335EA3-C6CE-47C9-AB4F-CE37157E1EB2}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{C8335EA3-C6CE-47C9-AB4F-CE37157E1EB2}.Release|Any CPU.Build.0 = Debug|Any CPU
{4195D943-DEF5-41AA-87E6-E273C33E1111}.CI|Any CPU.ActiveCfg = Debug|Any CPU
{4195D943-DEF5-41AA-87E6-E273C33E1111}.CI|Any CPU.Build.0 = Debug|Any CPU
{4195D943-DEF5-41AA-87E6-E273C33E1111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4195D943-DEF5-41AA-87E6-E273C33E1111}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4195D943-DEF5-41AA-87E6-E273C33E1111}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{4195D943-DEF5-41AA-87E6-E273C33E1111}.Release|Any CPU.Build.0 = Debug|Any CPU
{4F210C41-7E8E-424A-B956-FC1AA47663C9}.CI|Any CPU.ActiveCfg = Debug|Any CPU
{4F210C41-7E8E-424A-B956-FC1AA47663C9}.CI|Any CPU.Build.0 = Debug|Any CPU
{4F210C41-7E8E-424A-B956-FC1AA47663C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -160,7 +152,6 @@ Global
{A4E37052-5581-4E70-A9C3-FF8364B2F332} = {4D8FA213-8724-4C43-B68A-F018148D238C}
{34E3713D-C02F-4868-BBE7-47DAD2C7F03D} = {31891850-3EDC-480A-9B6C-F60540E9C90F}
{C8335EA3-C6CE-47C9-AB4F-CE37157E1EB2} = {4D8FA213-8724-4C43-B68A-F018148D238C}
{4195D943-DEF5-41AA-87E6-E273C33E1111} = {4D8FA213-8724-4C43-B68A-F018148D238C}
{4F210C41-7E8E-424A-B956-FC1AA47663C9} = {4D8FA213-8724-4C43-B68A-F018148D238C}
{FCAFB0F1-79EA-4D49-813B-188D4BC4BE71} = {963262D0-9FD5-4741-8C0E-E2F34F110EF3}
{F5115158-A038-4D14-A04E-46E7863E40B9} = {963262D0-9FD5-4741-8C0E-E2F34F110EF3}
Expand Down
37 changes: 0 additions & 37 deletions Src/FluentAssertions/Execution/NSpecFramework.cs

This file was deleted.

1 change: 0 additions & 1 deletion Src/FluentAssertions/Execution/TestFrameworkProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal class TestFrameworkProvider
private static readonly Dictionary<string, ITestFramework> Frameworks = new(StringComparer.OrdinalIgnoreCase)
{
["mspec"] = new MSpecFramework(),
["nspec3"] = new NSpecFramework(),
["nunit"] = new NUnitTestFramework(),
["mstestv2"] = new MSTestFrameworkV2(),
["xunit2"] = new XUnit2TestFramework() // Keep this the last one as it uses a try/catch approach
Expand Down
4 changes: 2 additions & 2 deletions Src/FluentAssertions/FluentAssertions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
<PackageDescription>
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or
BDD-style unit tests. Targets .NET Framework 4.7, .NET 6, as well as .NET Standard 2.0 and 2.1.
Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
Supports the unit test frameworks MSTest2, NUnit3, XUnit2 and MSpec.

Supported by InfoSupport B.V.
</PackageDescription>
<PackageProjectUrl>https://www.fluentassertions.com</PackageProjectUrl>
<RepositoryUrl>https://github.com/fluentassertions/fluentassertions</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>MSTest2;xUnit;NUnit;MSpec;NSpec;TDD;BDD;Fluent;netstandard;uwp</PackageTags>
<PackageTags>MSTest2;xUnit;NUnit;MSpec;TDD;BDD;Fluent;netstandard;uwp</PackageTags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageIcon>FluentAssertions.png</PackageIcon>
<PackageReleaseNotes>See https://fluentassertions.com/releases/</PackageReleaseNotes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,6 @@ public void When_running_test_with_unknown_test_framework_it_should_throw()
.WithMessage("*the test framework 'foo' but this is not supported*");
}

[Fact]
public void When_running_test_with_direct_bound_but_unavailable_test_framework_it_should_throw()
{
// Arrange
var configuration = new Configuration(new TestConfigurationStore())
{
TestFrameworkName = "nspec3"
};

var testFrameworkProvider = new TestFrameworkProvider(configuration);

// Act
Action act = () => testFrameworkProvider.Throw("MyMessage");

// Assert
act.Should().Throw<InvalidOperationException>()
.WithMessage("*test framework 'nspec3' but it could not be found*");
}

[Fact]
public void When_running_test_with_late_bound_but_unavailable_test_framework_it_should_throw()
{
Expand Down
19 changes: 0 additions & 19 deletions Tests/TestFrameworks/NSpec3.Net47.Specs/FrameworkSpecs.cs

This file was deleted.

13 changes: 0 additions & 13 deletions Tests/TestFrameworks/NSpec3.Net47.Specs/NSpec3.Net47.Specs.csproj

This file was deleted.

1 change: 0 additions & 1 deletion docs/_pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Fluent Assertions supports the following unit test frameworks:
* [MSTest V2](https://github.com/Microsoft/testfx) (Visual Studio 2017, Visual Studio 2019)
* [NUnit](http://www.nunit.org/)
* [XUnit2](https://github.com/xunit/xunit/releases)
* [NSpec](http://nspec.org/)
* [MSpec](https://github.com/machine/machine.specifications)

## Coding by Example
Expand Down
2 changes: 1 addition & 1 deletion docs/_pages/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ If, for some unknown reason, Fluent Assertions fails to find the assembly, and y
```xml
<configuration>
<appSettings>
<!-- Supported values: nunit, xunit2, mstestv2, nspec3 and mspec -->
<!-- Supported values: nunit, xunit2, mstestv2 and mspec -->
<add key="FluentAssertions.TestFramework" value="nunit"/>
</appSettings>
</configuration>
Expand Down
7 changes: 4 additions & 3 deletions docs/_pages/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sidebar:
### Improvements

### Fixes
* Fixed formatting error when checking nullable `DateTimeOffset` with
* Fixed formatting error when checking nullable `DateTimeOffset` with
`BeWithin(...).Before(...)` - [#2312](https://github.com/fluentassertions/fluentassertions/pull/2312)
* `BeEquivalentTo` will now find and can map subject properties that are implemented through an explicitly-implemented interface - [#2152](https://github.com/fluentassertions/fluentassertions/pull/2152)
* Fixed that the `because` and `becauseArgs` were not passed down the equivalency tree - [#2318](https://github.com/fluentassertions/fluentassertions/pull/2318)
Expand All @@ -23,8 +23,8 @@ sidebar:
* Moved support for `DataSet`, `DataTable`, `DataRow` and `DataColumn` into a new package `FluentAssertions.DataSet` - [#2267](https://github.com/fluentassertions/fluentassertions/pull/2267)
* Removed obsolete `...OrEqualTo` methods - [#2269](https://github.com/fluentassertions/fluentassertions/pull/2269)
* `GenericCollectionAssertions`
* `HaveCountGreaterOrEqualTo`: Use `HaveCountGreaterThanOrEqualTo`
* `HaveCountLessOrEqualTo`: Use `HaveCountLessThanOrEqualTo`
* `HaveCountGreaterOrEqualTo`: Use `HaveCountGreaterThanOrEqualTo`
* `HaveCountLessOrEqualTo`: Use `HaveCountLessThanOrEqualTo`
* `ComparableTypeAssertions`
* `BeGreaterOrEqualTo`: Use `BeGreaterThanOrEqualTo`
* `BeLessOrEqualTo`: Use `BeLessThanOrEqualTo`
Expand All @@ -38,6 +38,7 @@ sidebar:
* Dropped direct support for .NET Core 2.x and .NET Core 3.x - [#2302](https://github.com/fluentassertions/fluentassertions/pull/2302)
* `AllSatisfy` now suceeds when asserting that an empty collection satisfies some predicates - [#2321](https://github.com/fluentassertions/fluentassertions/pull/2321)
* `OnlyContain` now succeeds when asserting that an empty collection matches some predicates - [#2350](https://github.com/fluentassertions/fluentassertions/pull/2350)
* Dropped support for `NSpec3` test framework - [#2356](https://github.com/fluentassertions/fluentassertions/pull/2356)

### Breaking Changes (for extensions)
* Add `ForConstraint` to `IAssertionsScope` to support chaining `.ForConstraint()` after `.Then` - [#2324](https://github.com/fluentassertions/fluentassertions/pull/2324)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
image_path: /assets/images/checklist.svg
excerpt: '
Targets .NET 4.7, .NET 6, .NET Standard 2.0 and 2.1.
Supports MSTest2, xUnit2, NUnit3, MSpec and NSpec3.
Supports MSTest2, xUnit2, NUnit3 and MSpec.
'
- title: "Great Support"
image_path: /assets/images/customer-service.svg
Expand Down

0 comments on commit c5b518a

Please sign in to comment.