From d62bacf2d297b9417d0b50723b0641d57be14c24 Mon Sep 17 00:00:00 2001 From: Dennis Doomen Date: Sun, 17 Sep 2023 10:08:51 +0200 Subject: [PATCH] Drop support for .NET Core --- .github/ISSUE_TEMPLATE/01_bug_report.yml | 2 +- Build/Build.cs | 10 +++---- README.md | 2 +- .../MemberPathSegmentEqualityComparer.cs | 2 +- Src/FluentAssertions/Common/Services.cs | 2 +- Src/FluentAssertions/FluentAssertions.csproj | 24 ++------------- .../Streams/BufferedStreamAssertions.cs | 4 +-- .../CollectionSpecs.cs | 11 +++++-- .../FluentAssertions.Equivalency.Specs.csproj | 25 +--------------- ...CollectionAssertionSpecs.BeEquivalentTo.cs | 9 ++++++ .../Common/TimeSpanExtensions.cs | 2 +- .../Events/EventAssertionSpecs.cs | 15 ++++++---- .../AsyncFunctionExceptionAssertionSpecs.cs | 4 +-- .../FunctionExceptionAssertionSpecs.cs | 4 +-- .../Exceptions/NotThrowSpecs.cs | 6 ++-- .../FluentAssertions.Specs.csproj | 29 +------------------ .../Specialized/TaskOfTAssertionSpecs.cs | 6 ++-- .../Streams/BufferedStreamAssertionSpecs.cs | 4 +-- .../Types/TypeExtensionsSpecs.cs | 6 ++++ docs/_config.yml | 2 +- docs/_pages/about.md | 4 +-- docs/_pages/introduction.md | 2 +- docs/_pages/releases.md | 1 + docs/index.html | 4 +-- 24 files changed, 65 insertions(+), 115 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.yml b/.github/ISSUE_TEMPLATE/01_bug_report.yml index febe299c00..340226b8f9 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/01_bug_report.yml @@ -88,7 +88,7 @@ body: description: | Please provide more information on your .NET configuration: * Which version of Fluent Assertions are you using? - * Which .NET runtime and version are you targeting? E.g. .NET framework 4.6.1 or .NET Core 2.1. + * Which .NET runtime and version are you targeting? E.g. .NET framework 4.6.1 or .NET 7.0. placeholder: Configuration validations: required: false diff --git a/Build/Build.cs b/Build/Build.cs index badaf37a17..b7dc8affb4 100644 --- a/Build/Build.cs +++ b/Build/Build.cs @@ -186,13 +186,13 @@ class Build : NukeBuild ); }); - Target UnitTestsNetCore => _ => _ + Target UnitTestsNewerFrameworks => _ => _ .Unlisted() .DependsOn(Compile) .OnlyWhenDynamic(() => RunAllTargets || HasSourceChanges) .Executes(() => { - const string NET47 = "net47"; + const string net47 = "net47"; DotNetTest(s => s .SetConfiguration(Configuration.Debug) @@ -208,7 +208,7 @@ class Build : NukeBuild (_, project) => _ .SetProjectFile(project) .CombineWith( - project.GetTargetFrameworks().Except(new[] { NET47 }), + project.GetTargetFrameworks().Except(new[] { net47 }), (_, framework) => _ .SetFramework(framework) .AddLoggers($"trx;LogFileName={project.Name}_{framework}.trx") @@ -216,12 +216,12 @@ class Build : NukeBuild ), completeOnFailure: true ); - ReportTestOutcome(globFilters: $"*[!*{NET47}].trx"); + ReportTestOutcome(globFilters: $"*[!*{net47}].trx"); }); Target UnitTests => _ => _ .DependsOn(UnitTestsNetFramework) - .DependsOn(UnitTestsNetCore); + .DependsOn(UnitTestsNewerFrameworks); static string[] Outcomes(AbsolutePath path) => XmlTasks.XmlPeek( diff --git a/README.md b/README.md index a6d5bc792a..8e78319c6b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [![open issues](https://img.shields.io/github/issues/fluentassertions/fluentassertions)](https://github.com/fluentassertions/fluentassertions/issues) ![](https://img.shields.io/badge/release%20strategy-githubflow-orange.svg) -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, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. +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, as well as .NET 6, .NET Standard 2.0 and 2.1. See https://www.fluentassertions.com for [background information](https://fluentassertions.com/about/), [usage documentation](https://fluentassertions.com/introduction), an [extensibility guide](https://fluentassertions.com/extensibility/), support information and more [tips & tricks](https://fluentassertions.com/tips/). diff --git a/Src/FluentAssertions/Common/MemberPathSegmentEqualityComparer.cs b/Src/FluentAssertions/Common/MemberPathSegmentEqualityComparer.cs index edf54813c7..910b5e91aa 100644 --- a/Src/FluentAssertions/Common/MemberPathSegmentEqualityComparer.cs +++ b/Src/FluentAssertions/Common/MemberPathSegmentEqualityComparer.cs @@ -40,7 +40,7 @@ private static bool IsIndexQualifier(string segment) => public int GetHashCode(string obj) { -#if NETCOREAPP2_1_OR_GREATER +#if NET6_0_OR_GREATER return obj.GetHashCode(StringComparison.Ordinal); #else return obj.GetHashCode(); diff --git a/Src/FluentAssertions/Common/Services.cs b/Src/FluentAssertions/Common/Services.cs index 5dd8061ae7..dd283265ee 100644 --- a/Src/FluentAssertions/Common/Services.cs +++ b/Src/FluentAssertions/Common/Services.cs @@ -36,7 +36,7 @@ public static Configuration Configuration public static void ResetToDefaults() { Reflector = new FullFrameworkReflector(); -#if NETFRAMEWORK || NETCOREAPP +#if NETFRAMEWORK || NET6_0_OR_GREATER ConfigurationStore = new ConfigurationStoreExceptionInterceptor(new AppSettingsConfigurationStore()); #else ConfigurationStore = new NullConfigurationStore(); diff --git a/Src/FluentAssertions/FluentAssertions.csproj b/Src/FluentAssertions/FluentAssertions.csproj index 61b8873c74..c42c2a0a28 100644 --- a/Src/FluentAssertions/FluentAssertions.csproj +++ b/Src/FluentAssertions/FluentAssertions.csproj @@ -2,7 +2,7 @@ - net47;net6.0;netcoreapp2.1;netcoreapp3.0;netstandard2.0;netstandard2.1 + net47;net6.0;netstandard2.0;netstandard2.1 True FluentAssertions.snk true @@ -18,7 +18,7 @@ Dennis Doomen;Jonas Nyrup 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 Core 2.1 and 3.0, .NET 6, as well as .NET Standard 2.0 and 2.1. + 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. Supported by InfoSupport B.V. @@ -26,7 +26,7 @@ https://www.fluentassertions.com https://github.com/fluentassertions/fluentassertions git - MSTest2;xUnit;NUnit;MSpec;NSpec;TDD;BDD;Fluent;netcore;netstandard;uwp + MSTest2;xUnit;NUnit;MSpec;NSpec;TDD;BDD;Fluent;netstandard;uwp Apache-2.0 FluentAssertions.png See https://fluentassertions.com/releases/ @@ -62,24 +62,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/Src/FluentAssertions/Streams/BufferedStreamAssertions.cs b/Src/FluentAssertions/Streams/BufferedStreamAssertions.cs index 1557532d8d..82d9b8bf67 100644 --- a/Src/FluentAssertions/Streams/BufferedStreamAssertions.cs +++ b/Src/FluentAssertions/Streams/BufferedStreamAssertions.cs @@ -1,6 +1,6 @@ using System.Diagnostics; using System.IO; -#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1 +#if NET6_0_OR_GREATER || NETSTANDARD2_1 using FluentAssertions.Execution; #endif @@ -29,7 +29,7 @@ public BufferedStreamAssertions(BufferedStream stream) protected override string Identifier => "buffered stream"; -#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1 +#if NET6_0_OR_GREATER || NETSTANDARD2_1 /// /// Asserts that the current has the buffer size. /// diff --git a/Tests/FluentAssertions.Equivalency.Specs/CollectionSpecs.cs b/Tests/FluentAssertions.Equivalency.Specs/CollectionSpecs.cs index 128514b678..741aa7aa75 100644 --- a/Tests/FluentAssertions.Equivalency.Specs/CollectionSpecs.cs +++ b/Tests/FluentAssertions.Equivalency.Specs/CollectionSpecs.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Collections.Immutable; using System.Collections.ObjectModel; using System.Linq; using FluentAssertions.Extensions; @@ -311,21 +310,27 @@ public void When_collection_of_same_count_does_not_match_it_should_include_at_mo .Message.Should().Contain("[9]").And.NotContain("[10]"); } +#if NETFRAMEWORK || NET60_OR_GREATER [Fact] public void When_a_nullable_collection_does_not_match_it_should_throw() { // Arrange - var subject = new { Values = (ImmutableArray?)ImmutableArray.Create(1, 2, 3) }; + var subject = new { Values = ( + System.Collections.Immutable.ImmutableArray?) + System.Collections.Immutable.ImmutableArray.Create(1, 2, 3) }; // Act Action act = () => subject.Should().BeEquivalentTo(new { - Values = (ImmutableArray?)ImmutableArray.Create(1, 2, 4) + Values = ( + System.Collections.Immutable.ImmutableArray?) + System.Collections.Immutable.ImmutableArray.Create(1, 2, 4) }); // Assert act.Should().Throw().WithMessage("Expected*Values[2]*to be 4, but found 3*"); } +#endif [Fact] public void diff --git a/Tests/FluentAssertions.Equivalency.Specs/FluentAssertions.Equivalency.Specs.csproj b/Tests/FluentAssertions.Equivalency.Specs/FluentAssertions.Equivalency.Specs.csproj index 17f0ed9e6b..7f69be6c33 100644 --- a/Tests/FluentAssertions.Equivalency.Specs/FluentAssertions.Equivalency.Specs.csproj +++ b/Tests/FluentAssertions.Equivalency.Specs/FluentAssertions.Equivalency.Specs.csproj @@ -1,7 +1,7 @@ - net47;net6.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.1 + net47;net6.0 True ..\..\Src\FluentAssertions\FluentAssertions.snk false @@ -24,29 +24,6 @@ - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs index b640358a17..595d05fa98 100644 --- a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs +++ b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs @@ -1,5 +1,7 @@ using System; +#if NETFRAMEWORK || NET60_OR_GREATER using System.Collections.Immutable; +#endif using System.Linq; using FluentAssertions.Execution; using Xunit; @@ -137,6 +139,8 @@ public void When_asserting_collections_to_be_equivalent_but_subject_collection_i "Expected collection not to be *"); } +#if NETFRAMEWORK || NET60_OR_GREATER + [Fact] public void Default_immutable_arrays_should_be_equivalent() { @@ -158,6 +162,9 @@ public void Default_immutable_lists_should_be_equivalent() // Act / Assert collection.Should().BeEquivalentTo(collection1); } + +#endif + } public class NotBeEquivalentTo @@ -315,6 +322,7 @@ public void When_asserting_collections_not_to_be_equivalent_with_options_but_sub .WithMessage("Expected actual not to be equivalent *failure message*, but found .*"); } +#if NETFRAMEWORK || NET60_OR_GREATER [Fact] public void Default_immutable_array_should_not_be_equivalent_to_initialized_immutable_array() { @@ -336,5 +344,6 @@ public void Immutable_array_should_not_be_equivalent_to_default_immutable_array( // Act / Assert collection.Should().NotBeEquivalentTo(collection1); } +#endif } } diff --git a/Tests/FluentAssertions.Specs/Common/TimeSpanExtensions.cs b/Tests/FluentAssertions.Specs/Common/TimeSpanExtensions.cs index 1dbd668b12..57e4db9038 100644 --- a/Tests/FluentAssertions.Specs/Common/TimeSpanExtensions.cs +++ b/Tests/FluentAssertions.Specs/Common/TimeSpanExtensions.cs @@ -3,7 +3,7 @@ namespace FluentAssertions.Specs.Common; /// -/// Implements extensions to available in .NET Core 2+, but not in .NET Framework. +/// Implements extensions to /// public static class TimeSpanExtensions { diff --git a/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs index c211c9f0b8..b24a53607b 100644 --- a/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs @@ -1,4 +1,11 @@ -using System; +#if !NETSTANDARD2_0 + +#if NETFRAMEWORK +using System.Reflection; +using System.Reflection.Emit; +#endif + +using System; using System.ComponentModel; using System.Linq; using FluentAssertions.Events; @@ -7,10 +14,6 @@ using FluentAssertions.Formatting; using Xunit; using Xunit.Sdk; -#if NETFRAMEWORK -using System.Reflection; -using System.Reflection.Emit; -#endif namespace FluentAssertions.Specs.Events; @@ -1100,3 +1103,5 @@ public void RaiseEventWithSenderAndPropertyName(string propertyName) } } } + +#endif diff --git a/Tests/FluentAssertions.Specs/Exceptions/AsyncFunctionExceptionAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Exceptions/AsyncFunctionExceptionAssertionSpecs.cs index 47971b006e..f60b1abfb6 100644 --- a/Tests/FluentAssertions.Specs/Exceptions/AsyncFunctionExceptionAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Exceptions/AsyncFunctionExceptionAssertionSpecs.cs @@ -2,11 +2,9 @@ using System.Threading.Tasks; using FluentAssertions.Execution; using FluentAssertions.Extensions; +using FluentAssertions.Specs.Common; using Xunit; using Xunit.Sdk; -#if NETFRAMEWORK -using FluentAssertions.Specs.Common; -#endif namespace FluentAssertions.Specs.Exceptions; diff --git a/Tests/FluentAssertions.Specs/Exceptions/FunctionExceptionAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Exceptions/FunctionExceptionAssertionSpecs.cs index 859aabe359..75447cbb00 100644 --- a/Tests/FluentAssertions.Specs/Exceptions/FunctionExceptionAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Exceptions/FunctionExceptionAssertionSpecs.cs @@ -2,11 +2,9 @@ using System.Threading.Tasks; using FluentAssertions.Execution; using FluentAssertions.Extensions; +using FluentAssertions.Specs.Common; using Xunit; using Xunit.Sdk; -#if NETFRAMEWORK -using FluentAssertions.Specs.Common; -#endif namespace FluentAssertions.Specs.Exceptions; diff --git a/Tests/FluentAssertions.Specs/Exceptions/NotThrowSpecs.cs b/Tests/FluentAssertions.Specs/Exceptions/NotThrowSpecs.cs index 448b553067..7b231192e7 100644 --- a/Tests/FluentAssertions.Specs/Exceptions/NotThrowSpecs.cs +++ b/Tests/FluentAssertions.Specs/Exceptions/NotThrowSpecs.cs @@ -1,9 +1,7 @@ -#if NETFRAMEWORK -using FluentAssertions.Specs.Common; -#endif -using System; +using System; using System.Threading.Tasks; using FluentAssertions.Execution; +using FluentAssertions.Specs.Common; using Xunit; using Xunit.Sdk; using static FluentAssertions.Extensions.FluentTimeSpanExtensions; diff --git a/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj b/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj index 295b1b5d1c..bbdf21d880 100644 --- a/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj +++ b/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj @@ -1,7 +1,7 @@ - net47;net6.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.1 + net47;net6.0 True ..\..\Src\FluentAssertions\FluentAssertions.snk false @@ -9,10 +9,6 @@ full - - - -