Add a ProjectModel test
This commit is contained in:
parent
501570f46a
commit
c2e5b0f24d
6 changed files with 100 additions and 7 deletions
|
@ -75,6 +75,7 @@ EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestProjectToProjectDependencies", "TestAssets\TestProjects\TestProjectToProjectDependencies\TestProjectToProjectDependencies.xproj", "{947DD232-8D9B-4B78-9C6A-94F807D22222}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestProjectToProjectDependencies", "TestAssets\TestProjects\TestProjectToProjectDependencies\TestProjectToProjectDependencies.xproj", "{947DD232-8D9B-4B78-9C6A-94F807D22222}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.InternalAbstractions", "src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.xproj", "{BD4F0750-4E81-4AD2-90B5-E470881792C3}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.InternalAbstractions", "src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.xproj", "{BD4F0750-4E81-4AD2-90B5-E470881792C3}"
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Tests", "test\Microsoft.DotNet.ProjectModel.Tests\Microsoft.DotNet.ProjectModel.Tests.xproj", "{0745410A-6629-47EB-AAB5-08D6288CAD72}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -520,6 +521,22 @@ Global
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -553,5 +570,6 @@ Global
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
{947DD232-8D9B-4B78-9C6A-94F807D2DD58} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
{947DD232-8D9B-4B78-9C6A-94F807D22222} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
"dotnet-resgen.Tests",
|
"dotnet-resgen.Tests",
|
||||||
"Microsoft.DotNet.Cli.Utils.Tests",
|
"Microsoft.DotNet.Cli.Utils.Tests",
|
||||||
"Microsoft.DotNet.Compiler.Common.Tests",
|
"Microsoft.DotNet.Compiler.Common.Tests",
|
||||||
|
"Microsoft.DotNet.ProjectModel.Tests",
|
||||||
"Microsoft.Extensions.DependencyModel.Tests",
|
"Microsoft.Extensions.DependencyModel.Tests",
|
||||||
"ArgumentForwardingTests"
|
"ArgumentForwardingTests"
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.ProjectModel.Tests
|
||||||
|
{
|
||||||
|
public class LibraryExporterTests : TestBase
|
||||||
|
{
|
||||||
|
private readonly string _testProjectsRoot;
|
||||||
|
|
||||||
|
public LibraryExporterTests()
|
||||||
|
{
|
||||||
|
_testProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void GetLibraryExportsWithoutLockFile()
|
||||||
|
{
|
||||||
|
var root = Temp.CreateDirectory().CopyDirectory(Path.Combine(_testProjectsRoot, "TestAppWithLibrary"));
|
||||||
|
|
||||||
|
foreach (var lockfile in Directory.GetFiles(root.Path, "project.lock.json"))
|
||||||
|
{
|
||||||
|
File.Delete(lockfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
var builder = new ProjectContextBuilder().WithProjectDirectory(Path.Combine(root.Path, "TestApp"));
|
||||||
|
|
||||||
|
foreach (var context in builder.BuildAllTargets())
|
||||||
|
{
|
||||||
|
var exporter = context.CreateExporter("Debug");
|
||||||
|
var exports = exporter.GetAllExports();
|
||||||
|
Assert.NotEmpty(exports);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0.24720" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.24720</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>0745410a-6629-47eb-aab5-08d6288cad72</ProjectGuid>
|
||||||
|
<RootNamespace>Microsoft.DotNet.ProjectModel.Tests</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
19
test/Microsoft.DotNet.ProjectModel.Tests/project.json
Normal file
19
test/Microsoft.DotNet.ProjectModel.Tests/project.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
|
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||||
|
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
|
||||||
|
"xunit": "2.1.0",
|
||||||
|
"dotnet-test-xunit": "1.0.0-dev-48273-16"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": {
|
||||||
|
"imports": "portable-net45+win8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"content": [
|
||||||
|
"../../TestAssets/TestProjects/TestAppWithLibrary/**"
|
||||||
|
],
|
||||||
|
"testRunner": "xunit"
|
||||||
|
}
|
|
@ -1,16 +1,15 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
"dotnet": { "target": "project" },
|
||||||
"dotnet": "1.0.0-*",
|
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||||
"Newtonsoft.Json": "7.0.1",
|
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
|
||||||
"xunit.runner.aspnet": "2.0.0-aspnet-rc2-16068"
|
"xunit": "2.1.0",
|
||||||
|
"dotnet-test-xunit": "1.0.0-dev-48273-16"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnxcore50": {
|
"dnxcore50": {
|
||||||
"imports": "portable-net45+win8"
|
"imports": "portable-net45+win8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commands": {
|
"testRunner": "xunit"
|
||||||
"test": "xunit.runner.aspnet"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue