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/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/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..1e1d2f64aa 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;netstandard2.0;netstandard2.1 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..2ec2156fc0 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;netstandard2.0;netstandard2.1 True ..\..\Src\FluentAssertions\FluentAssertions.snk false @@ -28,29 +28,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/Specialized/TaskOfTAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs index 31bd834ef8..4b990a73e8 100644 --- a/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs @@ -1,10 +1,8 @@ -#if NETFRAMEWORK -using FluentAssertions.Specs.Common; -#endif -using System; +using System; using System.Threading.Tasks; using FluentAssertions.Execution; using FluentAssertions.Extensions; +using FluentAssertions.Specs.Common; using FluentAssertions.Specs.Exceptions; using Xunit; using Xunit.Sdk; diff --git a/Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs b/Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs index 73ef4247ed..e0fd15e594 100644 --- a/Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs +++ b/Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs @@ -1,5 +1,7 @@ using System; +#if NETFRAMEWORK || NET60_OR_GREATER using System.Collections.Immutable; +#endif using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; @@ -191,12 +193,16 @@ public void When_checking_if_value_tuple_is_record_it_should_return_false() (42, "the answer").GetType().IsRecord().Should().BeFalse(); } +#if NETFRAMEWORK || NET60_OR_GREATER + [Fact] public void When_checking_if_class_with_multiple_equality_methods_is_record_it_should_return_false() { typeof(ImmutableArray).IsRecord().Should().BeFalse(); } +#endif + private static MethodInfo GetFakeConversionOperator(Type type, string name, BindingFlags bindingAttr, Type returnType) { MethodInfo[] methods = type.GetMethods(bindingAttr); diff --git a/docs/_config.yml b/docs/_config.yml index 710e659ace..15429a99d2 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -19,7 +19,7 @@ locale : "en-US" title : "Fluent Assertions" title_separator : "-" name : "Dennis Doomen" -description : "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, as well as .NET Standard 2.0 and 2.1." +description : "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.0, as well as .NET Standard 2.0 and 2.1." url : "http://www.fluentassertions.com" # the base hostname & protocol for your site e.g. "https://mmistakes.github.io" baseurl : # the subpath of your site, e.g. "/blog" repository : "fluentassertions/fluentassertions" # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes" diff --git a/docs/_pages/about.md b/docs/_pages/about.md index 9aefef4fe2..4fb019a2a7 100644 --- a/docs/_pages/about.md +++ b/docs/_pages/about.md @@ -39,12 +39,12 @@ will fail with: ## Supported Frameworks and Libraries -Fluent Assertions cross-compiles to .NET Framework 4.7, as well as .NET Core 2.1 and 3.0, .NET 6, .NET Standard 2.0 and 2.1. +Fluent Assertions cross-compiles to .NET Framework 4.7, as well as .NET 6, .NET Standard 2.0 and 2.1. Because of that Fluent Assertions supports the following minimum platforms. -* .NET Core 2.1 and 3.0 * .NET Framework 4.7 and later +* .NET 6.0 and later * Mono 5.4, Xamarin.iOS 10.14, Xamarin.Mac 3.8 and Xamarin.Android 8.0 * Universal Windows Platform 10.0.16299 and later diff --git a/docs/_pages/introduction.md b/docs/_pages/introduction.md index 9d0b23b857..309c60dffa 100644 --- a/docs/_pages/introduction.md +++ b/docs/_pages/introduction.md @@ -67,7 +67,7 @@ This chaining can make your unit tests a lot easier to read. Fluent Assertions supports a lot of different unit testing frameworks. Just add a reference to the corresponding test framework assembly to the unit test project. Fluent Assertions will automatically find the corresponding assembly and use it for throwing the framework-specific exceptions. -If, for some unknown reason, Fluent Assertions fails to find the assembly, and you're running under .NET 4.7 or a .NET Core 3.0 project, try specifying the framework explicitly using a configuration setting in the project’s app.config. If it cannot find any of the supported frameworks, it will fall back to using a custom `AssertFailedException` exception class. +If, for some unknown reason, Fluent Assertions fails to find the assembly, and you're running under .NET 4.7 or a .NET 6.0 project, try specifying the framework explicitly using a configuration setting in the project’s app.config. If it cannot find any of the supported frameworks, it will fall back to using a custom `AssertFailedException` exception class. ```xml diff --git a/docs/_pages/releases.md b/docs/_pages/releases.md index 0dfd14a7b6..898c5100d2 100644 --- a/docs/_pages/releases.md +++ b/docs/_pages/releases.md @@ -31,6 +31,7 @@ sidebar: * `BeGreaterOrEqualTo`: Use `BeGreaterThanOrEqualTo` * `BeLessOrEqualTo`: Use `BeLessThanOrEqualTo` * Removed the `DefaultValueFormatter.SpacesPerIndentionLevel` property which was added during the development of v6, but wasn't removed before the release of v6 - [#2281](https://github.com/fluentassertions/fluentassertions/pull/2281) +* Dropped support for .NET Core - [#9999](https://github.com/fluentassertions/fluentassertions/pull/9999) ### Breaking Changes (for extensions) diff --git a/docs/index.html b/docs/index.html index e0c0266f11..dd790a02ae 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,7 +29,7 @@ [ Buy us a coffee](https://ko-fi.com/dennisdoomen){: .btn .btn--paypal}
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.' + BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET 6, .NET Standard 2.0 and 2.1.' feature_row: - title: "Intention-Revealing Unit Tests" image_path: /assets/images/binoculars.svg @@ -53,7 +53,7 @@ - title: "Feature Complete" image_path: /assets/images/checklist.svg excerpt: ' -Targets .NET 4.7, .NET Core 2.1, .Net Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. +Targets .NET 4.7, .NET 6, .NET Standard 2.0 and 2.1. Supports MSTest2, xUnit2, NUnit3, MSpec and NSpec3. ' - title: "Great Support"