2016-03-02 01:42:44 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
|
|
|
using Xunit;
|
2016-03-29 23:06:10 +00:00
|
|
|
|
using Microsoft.DotNet.TestFramework;
|
2016-03-02 01:42:44 +00:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Builder.Tests
|
|
|
|
|
{
|
|
|
|
|
public class BuildPortableTests : TestBase
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void BuildingAPortableProjectProducesDepsFile()
|
|
|
|
|
{
|
2016-03-29 23:06:10 +00:00
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
|
2016-03-02 01:42:44 +00:00
|
|
|
|
|
2016-03-29 23:06:10 +00:00
|
|
|
|
var netstandardappOutput = Build(testInstance);
|
|
|
|
|
|
|
|
|
|
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.deps");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void BuildingAPortableProjectProducesDepsJsonFile()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var netstandardappOutput = Build(testInstance);
|
|
|
|
|
|
|
|
|
|
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.deps.json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void BuildingAPortableProjectProducesADllFile()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var netstandardappOutput = Build(testInstance);
|
|
|
|
|
|
|
|
|
|
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.dll");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void BuildingAPortableProjectProducesAPdbFile()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var netstandardappOutput = Build(testInstance);
|
|
|
|
|
|
|
|
|
|
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.pdb");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void BuildingAPortableProjectProducesARuntimeConfigJsonFile()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var netstandardappOutput = Build(testInstance);
|
|
|
|
|
|
|
|
|
|
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.runtimeconfig.json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void BuildingAPortableProjectProducesARuntimeConfigDevJsonFile()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests").WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var netstandardappOutput = Build(testInstance);
|
|
|
|
|
|
|
|
|
|
netstandardappOutput.Should().Exist().And.HaveFile("PortableApp.runtimeconfig.dev.json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DirectoryInfo Build(TestInstance testInstance)
|
|
|
|
|
{
|
2016-03-02 01:42:44 +00:00
|
|
|
|
var result = new BuildCommand(
|
2016-03-09 19:36:16 +00:00
|
|
|
|
projectPath: Path.Combine(testInstance.TestRoot, "PortableApp"))
|
2016-03-02 01:42:44 +00:00
|
|
|
|
.ExecuteWithCapturedOutput();
|
|
|
|
|
|
|
|
|
|
result.Should().Pass();
|
|
|
|
|
|
2016-03-09 19:36:16 +00:00
|
|
|
|
var outputBase = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "PortableApp", "bin", "Debug"));
|
2016-03-02 01:42:44 +00:00
|
|
|
|
|
2016-03-29 23:06:10 +00:00
|
|
|
|
return outputBase.Sub("netstandard1.5");
|
2016-03-02 01:42:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|