Skip to content

Commit

Permalink
Drop support for .NET Core
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen committed Sep 17, 2023
1 parent bb50da5 commit 0c496fc
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Common/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
24 changes: 3 additions & 21 deletions Src/FluentAssertions/FluentAssertions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- To reduce build times, we only enable analyzers for the newest TFM -->
<PropertyGroup>
<TargetFrameworks>net47;net6.0;netcoreapp2.1;netcoreapp3.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net47;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>FluentAssertions.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -18,15 +18,15 @@
<Authors>Dennis Doomen;Jonas Nyrup</Authors>
<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 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.
</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;netcore;netstandard;uwp</PackageTags>
<PackageTags>MSTest2;xUnit;NUnit;MSpec;NSpec;TDD;BDD;Fluent;netstandard;uwp</PackageTags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageIcon>FluentAssertions.png</PackageIcon>
<PackageReleaseNotes>See https://fluentassertions.com/releases/</PackageReleaseNotes>
Expand Down Expand Up @@ -62,24 +62,6 @@
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<ItemGroup>
<Compile Remove="Common/NullConfigurationStore.cs" />
<Compile Remove="SystemExtensions.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<ItemGroup>
<Compile Remove="Common/NullConfigurationStore.cs" />
<Compile Remove="SystemExtensions.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
<ItemGroup>
<Compile Remove="Common/AppSettingsConfigurationStore.cs" />
Expand Down
11 changes: 8 additions & 3 deletions Tests/FluentAssertions.Equivalency.Specs/CollectionSpecs.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<int>?)ImmutableArray.Create(1, 2, 3) };
var subject = new { Values = (
System.Collections.Immutable.ImmutableArray<int>?)
System.Collections.Immutable.ImmutableArray.Create(1, 2, 3) };

// Act
Action act = () => subject.Should().BeEquivalentTo(new
{
Values = (ImmutableArray<int>?)ImmutableArray.Create(1, 2, 4)
Values = (
System.Collections.Immutable.ImmutableArray<int>?)
System.Collections.Immutable.ImmutableArray.Create(1, 2, 4)
});

// Assert
act.Should().Throw<XunitException>().WithMessage("Expected*Values[2]*to be 4, but found 3*");
}
#endif

[Fact]
public void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net47;net6.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net47;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\Src\FluentAssertions\FluentAssertions.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
Expand All @@ -24,29 +24,6 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<PackageReference Include="xunit.runner.visualstudio" Version="[2.4.1]">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="[17.3.2]" />
<PackageReference Include="xunit.runner.visualstudio" Version="[2.4.3]">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="[2.4.5]">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
#if NETFRAMEWORK || NET60_OR_GREATER
using System.Collections.Immutable;
#endif
using System.Linq;
using FluentAssertions.Execution;
using Xunit;
Expand Down Expand Up @@ -137,6 +139,8 @@ public void When_asserting_collections_to_be_equivalent_but_subject_collection_i
"Expected collection not to be <null>*");
}

#if NETFRAMEWORK || NET60_OR_GREATER

[Fact]
public void Default_immutable_arrays_should_be_equivalent()
{
Expand All @@ -158,6 +162,9 @@ public void Default_immutable_lists_should_be_equivalent()
// Act / Assert
collection.Should().BeEquivalentTo(collection1);
}

#endif

}

public class NotBeEquivalentTo
Expand Down Expand Up @@ -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 <null>.*");
}

#if NETFRAMEWORK || NET60_OR_GREATER
[Fact]
public void Default_immutable_array_should_not_be_equivalent_to_initialized_immutable_array()
{
Expand All @@ -336,5 +344,6 @@ public void Immutable_array_should_not_be_equivalent_to_default_immutable_array(
// Act / Assert
collection.Should().NotBeEquivalentTo(collection1);
}
#endif
}
}
2 changes: 1 addition & 1 deletion Tests/FluentAssertions.Specs/Common/TimeSpanExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace FluentAssertions.Specs.Common;

/// <summary>
/// Implements extensions to <see cref="TimeSpan"/> available in .NET Core 2+, but not in .NET Framework.
/// Implements extensions to <see cref="TimeSpan"/>
/// </summary>
public static class TimeSpanExtensions
{
Expand Down
15 changes: 10 additions & 5 deletions Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -1100,3 +1103,5 @@ public void RaiseEventWithSenderAndPropertyName(string propertyName)
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions Tests/FluentAssertions.Specs/Exceptions/NotThrowSpecs.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
25 changes: 1 addition & 24 deletions Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net47;net6.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net47;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\Src\FluentAssertions\FluentAssertions.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
Expand All @@ -28,29 +28,6 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<PackageReference Include="xunit.runner.visualstudio" Version="[2.4.1]">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="[17.3.2]" />
<PackageReference Include="xunit.runner.visualstudio" Version="[2.4.3]">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="[2.4.5]">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 6 additions & 0 deletions Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<int>).IsRecord().Should().BeFalse();
}

#endif

private static MethodInfo GetFakeConversionOperator(Type type, string name, BindingFlags bindingAttr, Type returnType)
{
MethodInfo[] methods = type.GetMethods(bindingAttr);
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions docs/_pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/_pages/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<configuration>
Expand Down
Loading

0 comments on commit 0c496fc

Please sign in to comment.