diff --git a/Build/Build.cs b/Build/Build.cs index 060496f89e..0b4aa96fa8 100644 --- a/Build/Build.cs +++ b/Build/Build.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using LibGit2Sharp; using Nuke.Common; @@ -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; @@ -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 @@ -95,6 +89,7 @@ class Build : NukeBuild .Executes(() => { SemVer = GitVersion.SemVer; + if (IsPullRequest) { Information( @@ -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()); @@ -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"); @@ -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) { @@ -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( @@ -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()); }); @@ -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)); }); diff --git a/Build/_build.csproj b/Build/_build.csproj index 92b9a65942..476f398ae6 100644 --- a/Build/_build.csproj +++ b/Build/_build.csproj @@ -18,7 +18,6 @@ - diff --git a/FluentAssertions.sln b/FluentAssertions.sln index a5fc376d23..31ee369de2 100644 --- a/FluentAssertions.sln +++ b/FluentAssertions.sln @@ -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}" @@ -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 @@ -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} diff --git a/Src/FluentAssertions/Execution/NSpecFramework.cs b/Src/FluentAssertions/Execution/NSpecFramework.cs deleted file mode 100644 index 90cec47ab0..0000000000 --- a/Src/FluentAssertions/Execution/NSpecFramework.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Reflection; - -namespace FluentAssertions.Execution; - -internal class NSpecFramework : ITestFramework -{ - private Assembly assembly; - - public bool IsAvailable - { - get - { - assembly = Array.Find(AppDomain.CurrentDomain - .GetAssemblies(), a => a.FullName.StartsWith("nspec,", StringComparison.OrdinalIgnoreCase)); - - if (assembly is null) - { - return false; - } - - int majorVersion = assembly.GetName().Version.Major; - - return majorVersion >= 2; - } - } - - [DoesNotReturn] - public void Throw(string message) - { - Type exceptionType = assembly.GetType("NSpec.Domain.AssertionException") - ?? throw new NotSupportedException("Failed to create the NSpec assertion type"); - - throw (Exception)Activator.CreateInstance(exceptionType, message); - } -} diff --git a/Src/FluentAssertions/Execution/TestFrameworkProvider.cs b/Src/FluentAssertions/Execution/TestFrameworkProvider.cs index 486dede58e..f5e291d8f9 100644 --- a/Src/FluentAssertions/Execution/TestFrameworkProvider.cs +++ b/Src/FluentAssertions/Execution/TestFrameworkProvider.cs @@ -16,7 +16,6 @@ internal class TestFrameworkProvider private static readonly Dictionary 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 diff --git a/Src/FluentAssertions/FluentAssertions.csproj b/Src/FluentAssertions/FluentAssertions.csproj index c42c2a0a28..c72f01136a 100644 --- a/Src/FluentAssertions/FluentAssertions.csproj +++ b/Src/FluentAssertions/FluentAssertions.csproj @@ -19,14 +19,14 @@ 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. https://www.fluentassertions.com https://github.com/fluentassertions/fluentassertions git - MSTest2;xUnit;NUnit;MSpec;NSpec;TDD;BDD;Fluent;netstandard;uwp + MSTest2;xUnit;NUnit;MSpec;TDD;BDD;Fluent;netstandard;uwp Apache-2.0 FluentAssertions.png See https://fluentassertions.com/releases/ diff --git a/Tests/FluentAssertions.Specs/Execution/TestFrameworkProviderTests.cs b/Tests/FluentAssertions.Specs/Execution/TestFrameworkProviderTests.cs index 50f2b43d37..bf934d4c12 100644 --- a/Tests/FluentAssertions.Specs/Execution/TestFrameworkProviderTests.cs +++ b/Tests/FluentAssertions.Specs/Execution/TestFrameworkProviderTests.cs @@ -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() - .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() { diff --git a/Tests/TestFrameworks/NSpec3.Net47.Specs/FrameworkSpecs.cs b/Tests/TestFrameworks/NSpec3.Net47.Specs/FrameworkSpecs.cs deleted file mode 100644 index 514b96e343..0000000000 --- a/Tests/TestFrameworks/NSpec3.Net47.Specs/FrameworkSpecs.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using FluentAssertions; -using NSpec; - -namespace NSpec3.Specs; - -public class FrameworkSpecs : nspec -{ - // NSpec requires tests to start with "it" or "specify", see https://github.com/nspec/NSpec/blob/master/sln/src/NSpec/DefaultConventions.cs - public void It_should_throw_nspec3_exceptions_for_assertion_failures_when_nspec3_is_used() - { - // Act - Action act = () => 0.Should().Be(1); - - // Assert - Exception exception = act.Should().Throw().Which; - exception.GetType().FullName.Should().ContainEquivalentOf("NSpec.Domain.AssertionException"); - } -} diff --git a/Tests/TestFrameworks/NSpec3.Net47.Specs/NSpec3.Net47.Specs.csproj b/Tests/TestFrameworks/NSpec3.Net47.Specs/NSpec3.Net47.Specs.csproj deleted file mode 100644 index 6ec84c6e14..0000000000 --- a/Tests/TestFrameworks/NSpec3.Net47.Specs/NSpec3.Net47.Specs.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - net47 - NSpec3.Specs - NSpec3.Specs - - - - - - - - \ No newline at end of file diff --git a/docs/_pages/about.md b/docs/_pages/about.md index 4fb019a2a7..e0f4565207 100644 --- a/docs/_pages/about.md +++ b/docs/_pages/about.md @@ -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 diff --git a/docs/_pages/introduction.md b/docs/_pages/introduction.md index 309c60dffa..d2333c7156 100644 --- a/docs/_pages/introduction.md +++ b/docs/_pages/introduction.md @@ -72,7 +72,7 @@ If, for some unknown reason, Fluent Assertions fails to find the assembly, and y ```xml - + diff --git a/docs/_pages/releases.md b/docs/_pages/releases.md index 1246a23cdd..873762c155 100644 --- a/docs/_pages/releases.md +++ b/docs/_pages/releases.md @@ -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) @@ -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` @@ -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) diff --git a/docs/index.html b/docs/index.html index dd790a02ae..6a02040ba1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -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