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 d62bacf
Show file tree
Hide file tree
Showing 24 changed files with 65 additions and 115 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
10 changes: 5 additions & 5 deletions Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -208,20 +208,20 @@ 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")
)
), 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(
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
4 changes: 2 additions & 2 deletions Src/FluentAssertions/Streams/BufferedStreamAssertions.cs
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
/// <summary>
/// Asserts that the current <see cref="BufferedStream"/> has the <paramref name="expected"/> buffer size.
/// </summary>
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</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
29 changes: 1 addition & 28 deletions Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net47;net6.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net47;net6.0</TargetFrameworks>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\Src\FluentAssertions\FluentAssertions.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn),IDE0052,1573,1591,1712,CS8002</NoWarn>
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0' ">
<Compile Remove="Events\*.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net47'">
<!--
(SRCU = System.Runtime.CompilerServices.Unsafe)
Expand All @@ -28,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
Loading

0 comments on commit d62bacf

Please sign in to comment.