Skip to content

Commit

Permalink
Adding .NET Core unit tests that integrate .NET Standard Libraries (#803
Browse files Browse the repository at this point in the history
)

* Initial add of unit tests of .NET Standard libraries in .NET Core framework
- Adding unit tests for .NET Standard libraries in the .NET Core
framework. These include Microsoft.Spatial and Microsoft.OData.Edm
- Making some changes to the unit test code due to breaking changes in
.NET Core framework

* Update Edm and Spatial tests
- All 787 enabled tests pass (1 test skipped per prior configuration)

* Adding Microsoft.OData.Core unit tests on .NET Core
- Creating new Microsoft.OData.Core unit test .NET Core .xproj to test
integration with .NET Standard libraries
- Assume any modifications made to the test files are due to APIs absent
from .NET Core and were in .NET Framework. Other modifications are made
due to changes in the test dependencies (which were also caused by their
migrations to .NET Core)

* Removing E2E tests from .NET Standard test solution as the tests are currently not runnable.

* Updating nuspec files to correct path for QueryTokenKind.cs
  • Loading branch information
AlanWong-MS authored and robward-ms committed May 3, 2017
1 parent 0b54111 commit 6673874
Show file tree
Hide file tree
Showing 102 changed files with 44,817 additions and 857 deletions.
54 changes: 51 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ $FXCOP = $FXCOPDIR + "\FxCopCmd.exe"
$BUILDLOG = $LOGDIR + "\msbuild.log"
$TESTLOG = $LOGDIR + "\mstest.log"
$TESTDIR = $ENLISTMENT_ROOT + "\bin\AnyCPU\$Configuration\Test\Desktop"
$NETCORETESTDIR = $ENLISTMENT_ROOT + "\bin\AnyCPU\$Configuration\Test\.NETPortable\netcoreapp1.0"
$PRODUCTDIR = $ENLISTMENT_ROOT + "\bin\AnyCPU\$Configuration\Product\Desktop"
$NUGETEXE = $ENLISTMENT_ROOT + "\sln\.nuget\NuGet.exe"
$NUGETPACK = $ENLISTMENT_ROOT + "\sln\packages"
$XUNITADAPTER = "/TestAdapterPath:" + $NUGETPACK + "\xunit.runner.visualstudio.2.1.0\build\_common"

$NugetRestoreSolutions = "Microsoft.OData.DotNetStandard.sln"

$ProductDlls = "Microsoft.OData.Client.dll",
"Microsoft.OData.Core.dll",
"Microsoft.OData.Edm.dll",
Expand Down Expand Up @@ -91,12 +95,23 @@ $RollingTestDlls = "Microsoft.OData.Core.Tests.dll",
"RegressionUnitTests.dll",
"Microsoft.Test.OData.PluggableFormat.Tests.dll"

$NetCoreUnitTestDlls = "Microsoft.OData.Core.Tests.dll",
"Microsoft.OData.Edm.Tests.dll",
"Microsoft.Spatial.Tests.dll"

$RollingTestSuite = @()
ForEach($dll in $RollingTestDlls)
{
$RollingTestSuite += $TESTDIR + "\" + $dll
}

ForEach($dll in $NetCoreUnitTestDlls)
{
# Turn on once we migrate to VS 2017 as there are some technical difficulties
# with running .NET Core tests through script for VS 2015
# $RollingTestSuite += $NETCORETESTDIR + "\" + $dll
}

$AdditionalNightlyTestDlls = "Microsoft.Data.MetadataObjectModel.UnitTests.dll",
"AstoriaUnitTests.dll",
"AstoriaClientUnitTests.dll",
Expand Down Expand Up @@ -430,6 +445,33 @@ Function RunTest($title, $testdir)
}
}

Function NugetRestoreSolution
{
Write-Host '**********Pull NuGet Packages*********'
foreach($solution in $NugetRestoreSolutions)
{
& $NUGETEXE "restore" ($ENLISTMENT_ROOT + "\sln\" + $solution)
}
}

# Copy any xproj output to the appropriate bin folder. We use this workaround instead of doing it in the
# xproj file due to xproj appending additional directory paths in its OutputPath parameter.
# See https://github.com/aspnet/Tooling/issues/383
Function CopyNetCoreOutput
{
Write-Host '**********Copying NetCore Output Binaries*********'

$NETCOREUNITTESTROOT = $ENLISTMENT_ROOT + "\test\FunctionalTests\"
$UNITTESTFOLDERS = "Microsoft.OData.Core.Tests",
"Microsoft.OData.Edm.Tests",
"Microsoft.Spatial.Tests"

ForEach($TEST in $UNITTESTFOLDERS)
{
Copy-Item ($NETCOREUNITTESTROOT + $TEST + "\bin\$Configuration\*") ($ENLISTMENT_ROOT + "\bin\AnyCPU\$Configuration\Test\.NETPortable") -Recurse -Force
}
}

Function BuildProcess
{
Write-Host '**********Start To Build The Project*********'
Expand Down Expand Up @@ -516,21 +558,27 @@ if (! (Test-Path $LOGDIR))

if ($TestType -eq 'SkipStrongName')
{
CleanBeforeScorch
CleanBeforeScorch
NugetRestoreSolution
BuildProcess
CopyNetCoreOutput
SkipStrongName
Exit
}
elseif ($TestType -eq 'DisableSkipStrongName')
{
CleanBeforeScorch
CleanBeforeScorch
NugetRestoreSolution
BuildProcess
CopyNetCoreOutput
DisableSkipStrongName
Exit
}

CleanBeforeScorch
CleanBeforeScorch
NugetRestoreSolution
BuildProcess
CopyNetCoreOutput
SkipStrongName
TestProcess
FxCopProcess
Expand Down
21 changes: 16 additions & 5 deletions sln/.nuget/packages.config
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="5.0.0"/>
<package id="FluentAssertions" version="2.0.0.1" />
<package id="ApprovalTests" version="1.6" />
<package id="Microsoft.MadMan" version="3.1.112712.0" />
<package id="EntityFramework" version="4.3.1" />
<package id="StyleCop.MSBuild" version="4.7.49" />
<package id="EntityFramework" version="5.0.0"/>
<package id="FluentAssertions" version="2.0.0.1" />
<package id="FluentAssertions" version="4.19.2" />
<package id="Microsoft.Extensions.DependencyInjection" version="1.0.0" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.0.0" />
<package id="Microsoft.Hadoop.Avro" version="1.4.0.0" />
<package id="Newtonsoft.Json" version="6.0.5" />
<package id="Microsoft.MadMan" version="3.1.112712.0" />
<package id="Microsoft.OData.StyleCop" version="1.0.0" />
<package id="Newtonsoft.Json" version="6.0.5" />
<package id="System.Text.Encoding.Extensions" version="4.0.11" />
<package id="StyleCop.MSBuild" version="4.7.49" />
<package id="xunit" version="2.1.0" />
<package id="xunit.abstractions" version="2.0.0" />
<package id="xunit.assert" version="2.1.0" />
<package id="xunit.core" version="2.1.0" />
<package id="xunit.extensibility.core" version="2.1.0" />
<package id="xunit.extensibility.execution" version="2.1.0" />
<package id="xunit.runner.visualstudio" version="2.1.0" />
</packages>
2 changes: 1 addition & 1 deletion sln/Microsoft.OData.E2E.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.Servic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.PluggableFormat", "..\test\FunctionalTests\Tests\DataOData\Tests\OData.PluggableFormat\Microsoft.Test.OData.PluggableFormat.csproj", "{1D872F31-6100-4C76-999E-ED948E2CD248}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.DependencyInjection", "..\test\Common\Microsoft.Test.OData.DependencyInjection\Microsoft.Test.OData.DependencyInjection.csproj", "{50AA23B2-56EF-4C51-A270-8D5BD0C899B6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.DependencyInjection", "..\test\Common\Microsoft.Test.OData.DependencyInjection\Build.NetFramework\Microsoft.Test.OData.DependencyInjection.csproj", "{50AA23B2-56EF-4C51-A270-8D5BD0C899B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion sln/Microsoft.OData.Full.sln
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.Plugga
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.PluggableFormat.Tests", "..\test\FunctionalTests\Tests\DataOData\Tests\OData.PluggableFormat.Tests\Microsoft.Test.OData.PluggableFormat.Tests.csproj", "{1D872F31-6100-4C76-999E-ED948E2CD249}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.DependencyInjection", "..\test\Common\Microsoft.Test.OData.DependencyInjection\Microsoft.Test.OData.DependencyInjection.csproj", "{50AA23B2-56EF-4C51-A270-8D5BD0C899B6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.DependencyInjection", "..\test\Common\Microsoft.Test.OData.DependencyInjection\Build.NetFramework\Microsoft.Test.OData.DependencyInjection.csproj", "{50AA23B2-56EF-4C51-A270-8D5BD0C899B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
10 changes: 5 additions & 5 deletions sln/Microsoft.OData.Lite.sln
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.Plugga
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.PluggableFormat.Tests", "..\test\FunctionalTests\Tests\DataOData\Tests\OData.PluggableFormat.Tests\Microsoft.Test.OData.PluggableFormat.Tests.csproj", "{1D872F31-6100-4C76-999E-ED948E2CD249}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.TestCommon", "..\test\FunctionalTests\Microsoft.OData.TestCommon\Microsoft.OData.TestCommon.csproj", "{9037FF4A-4636-41AA-BFA2-0930EF1563EE}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.TestCommon", "..\test\FunctionalTests\Microsoft.OData.TestCommon\Build.NetFramework\Microsoft.OData.TestCommon.csproj", "{9037FF4A-4636-41AA-BFA2-0930EF1563EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.Edm.Tests", "..\test\FunctionalTests\Microsoft.OData.Edm.Tests\Microsoft.OData.Edm.Tests.csproj", "{419F42FA-3313-46A7-B519-B2ED042B0F5C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.Edm.Tests", "..\test\FunctionalTests\Microsoft.OData.Edm.Tests\Build.NetFramework\Microsoft.OData.Edm.Tests.csproj", "{419F42FA-3313-46A7-B519-B2ED042B0F5C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.Core.Tests", "..\test\FunctionalTests\Microsoft.OData.Core.Tests\Microsoft.OData.Core.Tests.csproj", "{C6547B28-DC0C-414B-A1D7-488FC8EA7B6C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.Core.Tests", "..\test\FunctionalTests\Microsoft.OData.Core.Tests\Build.NetFramework\Microsoft.OData.Core.Tests.csproj", "{C6547B28-DC0C-414B-A1D7-488FC8EA7B6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Spatial.Tests", "..\test\FunctionalTests\Microsoft.Spatial.Tests\Microsoft.Spatial.Tests.csproj", "{68C25902-0FBD-4694-9EE9-47F2219CE039}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Spatial.Tests", "..\test\FunctionalTests\Microsoft.Spatial.Tests\Build.NetFramework\Microsoft.Spatial.Tests.csproj", "{68C25902-0FBD-4694-9EE9-47F2219CE039}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OData.Client.Tests", "..\test\FunctionalTests\Microsoft.OData.Client.Tests\Microsoft.OData.Client.Tests.csproj", "{9F0AB290-8164-4885-BFCA-A6F87AB81740}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.DependencyInjection", "..\test\Common\Microsoft.Test.OData.DependencyInjection\Microsoft.Test.OData.DependencyInjection.csproj", "{50AA23B2-56EF-4C51-A270-8D5BD0C899B6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Test.OData.DependencyInjection", "..\test\Common\Microsoft.Test.OData.DependencyInjection\Build.NetFramework\Microsoft.Test.OData.DependencyInjection.csproj", "{50AA23B2-56EF-4C51-A270-8D5BD0C899B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Loading

0 comments on commit 6673874

Please sign in to comment.