Skip to content

Commit

Permalink
-Changed tests to run in .NET Core 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Aug 18, 2017
1 parent c0f7661 commit 5c2695e
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 75 deletions.
9 changes: 6 additions & 3 deletions Build/build.ps1
Expand Up @@ -11,7 +11,8 @@
$buildNuGet = $false
$treatWarningsAsErrors = $false
$workingName = if ($workingName) {$workingName} else {"Working"}
$netCliVersion = "1.0.4"
$netCliChannel = "2.0"
$netCliVersion = "2.0.0"
$nugetUrl = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe"

$baseDir = resolve-path ..
Expand All @@ -30,7 +31,7 @@
$nunitConsolePath = "$buildDir\Temp\NUnit.ConsoleRunner.$nunitConsoleVersion"

$builds = @(
@{Framework = "netstandard1.3"; TestsFunction = "NetCliTests"; TestFramework = "netcoreapp1.1"; Enabled=$true},
@{Framework = "netstandard1.3"; TestsFunction = "NetCliTests"; TestFramework = "netcoreapp2.0"; Enabled=$true},
@{Framework = "netstandard1.0"; TestsFunction = "NetCliTests"; TestFramework = "netcoreapp1.0"; Enabled=$true},
@{Framework = "net45"; TestsFunction = "NUnitTests"; TestFramework = "net46"; NUnitFramework="net-4.0"; Enabled=$true},
@{Framework = "net40"; TestsFunction = "NUnitTests"; NUnitFramework="net-4.0"; Enabled=$true},
Expand Down Expand Up @@ -216,7 +217,7 @@ function NetCliTests($build)
$location = "$workingSourceDir\Newtonsoft.Json.Tests"
$testDir = if ($build.TestFramework -ne $null) { $build.TestFramework } else { $build.Framework }

exec { .\Tools\Dotnet\dotnet-install.ps1 -Version $netCliVersion | Out-Default }
exec { .\Tools\Dotnet\dotnet-install.ps1 -Channel $netCliChannel -Version $netCliVersion | Out-Default }

try
{
Expand All @@ -225,6 +226,8 @@ function NetCliTests($build)
exec { dotnet --version | Out-Default }

Write-Host -ForegroundColor Green "Running tests for $testDir"
Write-Host "Location: $location"
Write-Host "Project path: $projectPath"
Write-Host

exec { dotnet test $projectPath -f $testDir -c Release -l trx --no-build | Out-Default }
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net46;netcoreapp1.1</TargetFrameworks>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<RootNamespace>Newtonsoft.Json.TestConsole</RootNamespace>
<AssemblyName>Newtonsoft.Json.TestConsole</AssemblyName>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
Expand Up @@ -6,7 +6,7 @@
</ItemGroup>
</Target>
<PropertyGroup>
<TargetFrameworks Condition="'$(TestFrameworks)'==''">net46;net451;net452;net40;net35;net20;netcoreapp1.1;netcoreapp1.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TestFrameworks)'==''">net46;net451;net452;net40;net35;net20;netcoreapp2.0;netcoreapp1.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TestFrameworks)'!=''">$(TestFrameworks)</TargetFrameworks>
<VersionPrefix>1.0</VersionPrefix>
<Authors>James Newton-King</Authors>
Expand Down Expand Up @@ -154,7 +154,7 @@
<DefineConstants>NET20;$(AdditionalConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
<PackageReference Include="BenchmarkDotNet" Version="0.10.5" />
<PackageReference Include="FSharp.Core" Version="4.1.2" />
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
Expand All @@ -167,7 +167,7 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
<AssemblyTitle>Json.NET Tests .NET Standard 1.3</AssemblyTitle>
<ReferringTargetFrameworkForProjectReferences>.NETStandard,Version=v1.3</ReferringTargetFrameworkForProjectReferences>
<DefineConstants>NETSTANDARD1_3;DNXCORE50;PORTABLE;HAVE_BENCHMARKS;$(AdditionalConstants)</DefineConstants>
Expand Down

0 comments on commit 5c2695e

Please sign in to comment.