From 1b7a09e2549ba019470d0966720dff3d24fd086e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Wed, 8 Dec 2021 15:03:52 +0200 Subject: [PATCH 1/9] Added .Net6 target framework --- Directory.Build.props | 2 +- src/NSubstitute/NSubstitute.csproj | 12 ++++++------ .../NSubstitute.Acceptance.Specs.csproj | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index ad3c08ee0..17b46b7aa 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,7 +6,7 @@ true - true + true latest diff --git a/src/NSubstitute/NSubstitute.csproj b/src/NSubstitute/NSubstitute.csproj index 0d3184201..7db28fd8b 100644 --- a/src/NSubstitute/NSubstitute.csproj +++ b/src/NSubstitute/NSubstitute.csproj @@ -1,4 +1,4 @@ - + NSubstitute is a friendly substitute for .NET mocking libraries. It has a simple, succinct syntax to help developers write clearer tests. NSubstitute is designed for Arrange-Act-Assert (AAA) testing and with Test Driven Development (TDD) in mind. @@ -16,7 +16,7 @@ - netstandard1.3;netstandard2.0;net45;net46;net5.0 + netstandard1.3;netstandard2.0;net45;net46;net5.0;net6.0 @@ -34,16 +34,16 @@ - enable + enable - $(NoWarn);CS8632 + $(NoWarn);CS8632 + Condition="'$(TargetIsNet5OrNewer)' != 'true'" /> @@ -55,7 +55,7 @@ $(DefineConstants);SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY - + $(DefineConstants);SYSTEM_DIAGNOSTICS_CODEANALYSIS_NULLABILITY diff --git a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj index 6147cab8b..5621c038f 100644 --- a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj +++ b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;netcoreapp1.1;net46;net45;net5.0 + netcoreapp2.0;netcoreapp1.1;net46;net45;net5.0;net6.0 From aff322d21a133f118a1aef39244791218a38b53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Wed, 8 Dec 2021 23:29:33 +0200 Subject: [PATCH 2/9] Update travis yml to .net6 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7aadd0ebd..e06ca9090 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: csharp dist: xenial -dotnet: 5.0.100 +dotnet: 6.0.100 mono: none -env: CONFIGURATION=Release FRAMEWORK=net5.0 +env: CONFIGURATION=Release FRAMEWORK=net6.0 before_script: - dotnet --info From 4177a63f48f33e23d0a2ae8b30d53ea050d7c16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Wed, 8 Dec 2021 23:30:30 +0200 Subject: [PATCH 3/9] Update appveyor image --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4f039068e..6ce6a48ed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -os: Visual Studio 2019 +os: Visual Studio 2022 build: off environment: From 5616c4c4175f5c1027f2074380cd87df2c0bbae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Wed, 8 Dec 2021 23:43:17 +0200 Subject: [PATCH 4/9] Update NSubstitute.Acceptance.Specs.csproj --- .../NSubstitute.Acceptance.Specs.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj index 5621c038f..376072366 100644 --- a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj +++ b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj @@ -5,9 +5,9 @@ - - - + + + From 382aa4813cfa6c2a723a139186b95ebf4d1d84ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Thu, 9 Dec 2021 08:37:11 +0200 Subject: [PATCH 5/9] Removed netcoreapp1.1 from NSubstitute test project because its not supported in latest unit test framework --- .../NSubstitute.Acceptance.Specs.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj index 376072366..d0a32e61a 100644 --- a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj +++ b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;netcoreapp1.1;net46;net45;net5.0;net6.0 + netcoreapp2.0;net46;net45;net5.0;net6.0 From 19063df2cc142e4d266e88e0929b5b03a66e8603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Thu, 9 Dec 2021 17:19:03 +0200 Subject: [PATCH 6/9] Drop netstandard 1.3 target framework to allow updating package references --- src/NSubstitute/NSubstitute.csproj | 14 ++------------ .../Handlers/ReturnFromAndConfigureDynamicCall.cs | 6 ++---- .../NSubstitute.Acceptance.Specs.csproj | 2 +- .../NSubstitute.Benchmarks/ActivationBenchmark.cs | 1 - .../ArgumentSpecificationUsageBenchmark.cs | 1 - .../DispatchConfiguredMatchingCallBenchmark.cs | 2 -- .../DispatchConfiguredNonMatchingCallBenchmark.cs | 2 -- .../DispatchNonConfiguredCallBenchmark.cs | 1 - .../NSubstitute.Benchmarks.csproj | 5 +++-- .../ToStringCallBenchmark.cs | 1 - .../VerifyReceivedCallBenchmark.cs | 1 - 11 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/NSubstitute/NSubstitute.csproj b/src/NSubstitute/NSubstitute.csproj index 7db28fd8b..f5c1218db 100644 --- a/src/NSubstitute/NSubstitute.csproj +++ b/src/NSubstitute/NSubstitute.csproj @@ -16,7 +16,7 @@ - netstandard1.3;netstandard2.0;net45;net46;net5.0;net6.0 + netstandard2.0;net45;net46;net5.0;net6.0 @@ -42,19 +42,9 @@ - + - - - - - - - $(DefineConstants);SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY - - $(DefineConstants);SYSTEM_DIAGNOSTICS_CODEANALYSIS_NULLABILITY diff --git a/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs b/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs index e4fadd2c4..0576f9563 100644 --- a/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs +++ b/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs @@ -39,12 +39,10 @@ private bool ReturnsDynamic(ICall call) } bool isDynamic; -#if SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY - isDynamic = returnParameter.GetCustomAttributes(DynamicAttributeType, inherit: false).Length != 0; -#else + var customAttributes = returnParameter.GetCustomAttributes(DynamicAttributeType, inherit: false); isDynamic = customAttributes != null && customAttributes.Any(); -#endif + return isDynamic; } diff --git a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj index d0a32e61a..ea49a0968 100644 --- a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj +++ b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;net46;net45;net5.0;net6.0 + net46;net45;net5.0;net6.0 diff --git a/tests/NSubstitute.Benchmarks/ActivationBenchmark.cs b/tests/NSubstitute.Benchmarks/ActivationBenchmark.cs index 27b5a5f29..9f591bb10 100644 --- a/tests/NSubstitute.Benchmarks/ActivationBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/ActivationBenchmark.cs @@ -1,5 +1,4 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; namespace NSubstitute.Benchmarks diff --git a/tests/NSubstitute.Benchmarks/ArgumentSpecificationUsageBenchmark.cs b/tests/NSubstitute.Benchmarks/ArgumentSpecificationUsageBenchmark.cs index 9d257ac0e..233624777 100644 --- a/tests/NSubstitute.Benchmarks/ArgumentSpecificationUsageBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/ArgumentSpecificationUsageBenchmark.cs @@ -1,5 +1,4 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; namespace NSubstitute.Benchmarks diff --git a/tests/NSubstitute.Benchmarks/DispatchConfiguredMatchingCallBenchmark.cs b/tests/NSubstitute.Benchmarks/DispatchConfiguredMatchingCallBenchmark.cs index c282805dd..278d5a5d7 100644 --- a/tests/NSubstitute.Benchmarks/DispatchConfiguredMatchingCallBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/DispatchConfiguredMatchingCallBenchmark.cs @@ -1,7 +1,5 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; -using NSubstitute.Core; namespace NSubstitute.Benchmarks { diff --git a/tests/NSubstitute.Benchmarks/DispatchConfiguredNonMatchingCallBenchmark.cs b/tests/NSubstitute.Benchmarks/DispatchConfiguredNonMatchingCallBenchmark.cs index 430d6c950..7e063e763 100644 --- a/tests/NSubstitute.Benchmarks/DispatchConfiguredNonMatchingCallBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/DispatchConfiguredNonMatchingCallBenchmark.cs @@ -1,7 +1,5 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; -using NSubstitute.Core; namespace NSubstitute.Benchmarks { diff --git a/tests/NSubstitute.Benchmarks/DispatchNonConfiguredCallBenchmark.cs b/tests/NSubstitute.Benchmarks/DispatchNonConfiguredCallBenchmark.cs index 1d6ef0aac..f9d442d94 100644 --- a/tests/NSubstitute.Benchmarks/DispatchNonConfiguredCallBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/DispatchNonConfiguredCallBenchmark.cs @@ -1,5 +1,4 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; namespace NSubstitute.Benchmarks diff --git a/tests/NSubstitute.Benchmarks/NSubstitute.Benchmarks.csproj b/tests/NSubstitute.Benchmarks/NSubstitute.Benchmarks.csproj index 7ab715831..5234c04e5 100644 --- a/tests/NSubstitute.Benchmarks/NSubstitute.Benchmarks.csproj +++ b/tests/NSubstitute.Benchmarks/NSubstitute.Benchmarks.csproj @@ -1,7 +1,8 @@  Exe - net462;netcoreapp2.1 + net6.0 + NSubstitute.Benchmarks.Program @@ -11,7 +12,7 @@ - + diff --git a/tests/NSubstitute.Benchmarks/ToStringCallBenchmark.cs b/tests/NSubstitute.Benchmarks/ToStringCallBenchmark.cs index 67d84b1f6..dd6f29e03 100644 --- a/tests/NSubstitute.Benchmarks/ToStringCallBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/ToStringCallBenchmark.cs @@ -1,5 +1,4 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; namespace NSubstitute.Benchmarks diff --git a/tests/NSubstitute.Benchmarks/VerifyReceivedCallBenchmark.cs b/tests/NSubstitute.Benchmarks/VerifyReceivedCallBenchmark.cs index c3e875d68..e334c0ed9 100644 --- a/tests/NSubstitute.Benchmarks/VerifyReceivedCallBenchmark.cs +++ b/tests/NSubstitute.Benchmarks/VerifyReceivedCallBenchmark.cs @@ -1,5 +1,4 @@ using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Attributes.Jobs; using NSubstitute.Benchmarks.TestTypes; namespace NSubstitute.Benchmarks From b41b23e5aabfa5a23babe03bcee0684405b7a4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Wed, 15 Dec 2021 20:49:49 +0200 Subject: [PATCH 7/9] Added back netstandard 1.3 target framework --- src/NSubstitute/NSubstitute.csproj | 12 +++++++++++- .../Handlers/ReturnFromAndConfigureDynamicCall.cs | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/NSubstitute/NSubstitute.csproj b/src/NSubstitute/NSubstitute.csproj index f5c1218db..5970fbd25 100644 --- a/src/NSubstitute/NSubstitute.csproj +++ b/src/NSubstitute/NSubstitute.csproj @@ -16,9 +16,19 @@ - netstandard2.0;net45;net46;net5.0;net6.0 + netstandard1.3;netstandard2.0;net45;net46;net5.0;net6.0 + + + + + + + $(DefineConstants);SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY + + + true diff --git a/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs b/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs index 0576f9563..e4fadd2c4 100644 --- a/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs +++ b/src/NSubstitute/Routing/Handlers/ReturnFromAndConfigureDynamicCall.cs @@ -39,10 +39,12 @@ private bool ReturnsDynamic(ICall call) } bool isDynamic; - +#if SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY + isDynamic = returnParameter.GetCustomAttributes(DynamicAttributeType, inherit: false).Length != 0; +#else var customAttributes = returnParameter.GetCustomAttributes(DynamicAttributeType, inherit: false); isDynamic = customAttributes != null && customAttributes.Any(); - +#endif return isDynamic; } From 6a5d1cc2dd8e4714467bc2b057086975232ee430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Sun, 26 Dec 2021 12:05:45 +0200 Subject: [PATCH 8/9] Update NSubstitute.csproj Revert package version update --- src/NSubstitute/NSubstitute.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NSubstitute/NSubstitute.csproj b/src/NSubstitute/NSubstitute.csproj index 5970fbd25..e0ad29718 100644 --- a/src/NSubstitute/NSubstitute.csproj +++ b/src/NSubstitute/NSubstitute.csproj @@ -21,7 +21,7 @@ - + @@ -52,7 +52,7 @@ - + From f3577d4219368c39ba3a2c1fbf1095d64381f242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Mon, 27 Dec 2021 08:55:46 +0200 Subject: [PATCH 9/9] Added netcoreapp2.1 to tests --- .../NSubstitute.Acceptance.Specs.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj index ea49a0968..189d1c4e5 100644 --- a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj +++ b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj @@ -1,7 +1,7 @@  - net46;net45;net5.0;net6.0 + netcoreapp2.1;net46;net45;net5.0;net6.0