Skip to content

Commit

Permalink
Added .NET 8 to test platforms (#756)
Browse files Browse the repository at this point in the history
* Added .NET 8 to test platforms

* Fix some build warnings

* Update some test dependencies for docs
  • Loading branch information
Romfos authored Nov 19, 2023
1 parent a32dc4e commit 3ce2d66
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trim_trailing_whitespace = true
indent_size = 4
indent_style = space

[*.{sln,csproj,yml}]
[*.{sln,csproj,fsproj,yml}]
indent_size = 2
indent_style = space

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
framework: [net6.0, net7.0]
framework: [net6.0, net7.0, net8.0]
include:
- os: windows-latest
framework: net462
Expand All @@ -22,6 +22,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Build
run: dotnet build
Expand All @@ -43,6 +44,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
8.0.x
# used for documentation
- name: Setup Ruby
Expand Down
12 changes: 5 additions & 7 deletions NSubstitute.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSubstitute", "src\NSubstitute\NSubstitute.csproj", "{F59BF5FC-52D8-492E-BDE8-244C183B4C92}"
EndProject
Expand All @@ -11,11 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0E2B9095
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{A8AF7D01-6CE4-47B2-9E23-689A53991C3D}"
ProjectSection(SolutionItems) = preProject
build\build.fsx = build\build.fsx
build\build.sh = build\build.sh
build\ExtractDocs.fsx = build\ExtractDocs.fsx
build\packages.config = build\packages.config
build\build.cmd = build\build.cmd
build\build.fs = build\build.fs
build\build.sh = build\build.sh
build\ExtractDocs.fs = build\ExtractDocs.fs
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CA2DD4AA-8DCD-42FB-8081-243281AD2956}"
Expand Down
6 changes: 3 additions & 3 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ let initTargets() =
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\NSubstitute\NSubstitute.csproj" />
Expand Down
5 changes: 4 additions & 1 deletion build/build.fsproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<OutputPath>buildOutput</OutputPath>
</PropertyGroup>

<ItemGroup>
<None Include="build.cmd" />
<None Include="build.sh" />
<Compile Include="ExtractDocs.fs" />
<Compile Include="build.fs" />
</ItemGroup>
Expand All @@ -21,4 +23,5 @@
<PackageReference Include="Fake.Tools.Git" Version="6.0.0" />
<PackageReference Include="Fake.Core.Target" Version="6.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net462</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetIsNetFx)' == 'true'">
Expand Down
2 changes: 1 addition & 1 deletion tests/NSubstitute.Benchmarks/ActivationBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class ActivationBenchmark
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class ArgumentSpecificationUsageBenchmark
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class DispatchConfiguredMatchingCallBenchmark
{
Expand All @@ -17,26 +17,26 @@ public DispatchConfiguredMatchingCallBenchmark()
{
_interfaceProxy = Substitute.For<IInterfaceWithSingleMethod>();
_interfaceProxy.IntMethod("42").Returns(42);
_interfaceProxy.When(x => x.VoidMethod("42")).Do(delegate { });
_interfaceProxy.When(x => x.VoidMethod("42")).Do(delegate { });

_abstractClassProxy = Substitute.For<AbstractClassWithSingleMethod>();
_abstractClassProxy.IntMethod("42").Returns(42);
_abstractClassProxy.When(x => x.VoidMethod("42")).Do(delegate { });
_abstractClassProxy.When(x => x.VoidMethod("42")).Do(delegate { });

_classPartialProxy = Substitute.For<ClassWithSingleMethod>();
_classPartialProxy.IntMethod("42").Returns(42);
_classPartialProxy.When(x => x.VoidMethod("42")).Do(delegate { });
_classPartialProxy.When(x => x.VoidMethod("42")).Do(delegate { });

_intDelegateProxy = Substitute.For<IntDelegate>();
_intDelegateProxy.Invoke("42").Returns(42);

_voidDelegateProxy = Substitute.For<VoidDelegate>();
_voidDelegateProxy.When(x => x.Invoke("42")).Do(delegate { });
_voidDelegateProxy.When(x => x.Invoke("42")).Do(delegate { });
}

[Benchmark]
public int DispatchInterfaceProxyCall_Int() => _interfaceProxy.IntMethod("42");

[Benchmark]
public int DispatchAbstractClassProxyCall_Int() => _abstractClassProxy.IntMethod("42");

Expand All @@ -48,7 +48,7 @@ public DispatchConfiguredMatchingCallBenchmark()

[Benchmark]
public void DispatchInterfaceProxyCall_Void() => _interfaceProxy.VoidMethod("42");

[Benchmark]
public void DispatchAbstractClassProxyCall_Void() => _abstractClassProxy.VoidMethod("42");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class DispatchConfiguredNonMatchingCallBenchmark
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class DispatchNonConfiguredCallBenchmark
{
Expand All @@ -24,7 +24,7 @@ public DispatchNonConfiguredCallBenchmark()

[Benchmark]
public int DispatchInterfaceProxyCall_Int() => _interfaceProxy.IntMethod(null);

[Benchmark]
public int DispatchAbstractClassProxyCall_Int() => _abstractClassProxy.IntMethod(null);

Expand All @@ -36,7 +36,7 @@ public DispatchNonConfiguredCallBenchmark()

[Benchmark]
public void DispatchInterfaceProxyCall_Void() => _interfaceProxy.VoidMethod(null);

[Benchmark]
public void DispatchAbstractClassProxyCall_Void() => _abstractClassProxy.VoidMethod(null);

Expand Down
12 changes: 5 additions & 7 deletions tests/NSubstitute.Benchmarks/NSubstitute.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
<StartupObject>NSubstitute.Benchmarks.Program</StartupObject>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<Compile Remove="BenchmarkDotNet.Artifacts\**" />
<EmbeddedResource Remove="BenchmarkDotNet.Artifacts\**" />
<None Remove="BenchmarkDotNet.Artifacts\**" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.4" />
<ProjectReference Include="..\..\src\NSubstitute\NSubstitute.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/NSubstitute.Benchmarks/ToStringCallBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class ToStringCallBenchmark
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob]
[MemoryDiagnoser]
public class VerifyReceivedCallBenchmark
{
Expand Down

0 comments on commit 3ce2d66

Please sign in to comment.