Add dotnet msbuild
tests.
This commit is contained in:
parent
d6adea1af0
commit
5bd310bbd5
6 changed files with 152 additions and 0 deletions
|
@ -168,6 +168,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Test
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-vstest.Tests", "test\dotnet-vstest.Tests\dotnet-vstest.Tests.xproj", "{9F5AE280-A040-4160-9799-6504D907742D}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-msbuild.Tests", "test\dotnet-msbuild.Tests\dotnet-msbuild.Tests.xproj", "{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -964,6 +966,22 @@ Global
|
|||
{9F5AE280-A040-4160-9799-6504D907742D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{9F5AE280-A040-4160-9799-6504D907742D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{9F5AE280-A040-4160-9799-6504D907742D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1026,5 +1044,6 @@ Global
|
|||
{1F2EF070-AC5F-4078-AFB0-65745AC691B9} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{6D028154-5518-4A56-BAD6-938A90E5BCF6} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{9F5AE280-A040-4160-9799-6504D907742D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{2FFCBDF0-BA36-4393-8DDB-1AE04AEA3CD6} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<Target Name="SayHello">
|
||||
<Message Text="Hello, from MSBuild!" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SayGoodbye">
|
||||
<Message Text="Goodbye, from MSBuild. :'(" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SayThis">
|
||||
<Message Text="You want me to say '$(This)'" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public sealed class MSBuildCommand : TestCommand
|
||||
{
|
||||
public MSBuildCommand()
|
||||
: base("dotnet")
|
||||
{
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
args = $"msbuild {args}";
|
||||
return base.Execute(args);
|
||||
}
|
||||
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
args = $"msbuild {args}";
|
||||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build3.Tests
|
||||
{
|
||||
public class GivenDotnetMSBuildBuildsProjects : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ItRunsSpecifiedTargetsWithPropertiesCorrectly()
|
||||
{
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("MSBuildBareBonesProject");
|
||||
|
||||
var testProjectDirectory = testInstance.TestRoot;
|
||||
|
||||
new MSBuildCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("/t:SayHello")
|
||||
.Should()
|
||||
.Pass()
|
||||
.And
|
||||
.HaveStdOutContaining("Hello, from MSBuild!");
|
||||
|
||||
new MSBuildCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("/t:SayGoodbye")
|
||||
.Should()
|
||||
.Pass()
|
||||
.And
|
||||
.HaveStdOutContaining("Goodbye, from MSBuild. :'(");
|
||||
|
||||
new MSBuildCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("/t:SayThis /p:This=GreatScott")
|
||||
.Should()
|
||||
.Pass()
|
||||
.And
|
||||
.HaveStdOutContaining("You want me to say 'GreatScott'");
|
||||
}
|
||||
}
|
||||
}
|
21
test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.xproj
Normal file
21
test/dotnet-msbuild.Tests/dotnet-msbuild.Tests.xproj
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>2ffcbdf0-ba36-4393-8ddb-1ae04aea3cd6</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Cli.MSBuild.Tests</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
24
test/dotnet-msbuild.Tests/project.json
Normal file
24
test/dotnet-msbuild.Tests/project.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-350904-49"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dotnet5.4",
|
||||
"portable-net451+win8"
|
||||
]
|
||||
}
|
||||
},
|
||||
"testRunner": "xunit"
|
||||
}
|
Loading…
Reference in a new issue