Asset refactoring and content files

This commit is contained in:
Pavel Krymets 2016-02-17 10:08:27 -08:00
parent 388bb7260c
commit a71112ce8f
34 changed files with 1301 additions and 173 deletions

View file

@ -3,7 +3,9 @@
using System;
using System.IO;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Test.Utilities;
using FluentAssertions;
using Xunit;
namespace Microsoft.DotNet.Tools.Compiler.Tests
@ -106,6 +108,44 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
buildCommand.Execute().Should().Pass();
}
[Fact]
public void ContentFilesAreCopied()
{
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithContentPackage")
.WithLockFiles();
var root = testInstance.TestRoot;
// run compile
var outputDir = Path.Combine(root, "bin");
var testProject = ProjectUtils.GetProjectJson(root, "TestAppWithContentPackage");
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
var result = buildCommand.ExecuteWithCapturedOutput();
result.Should().Pass();
result = Command.Create(Path.Combine(outputDir, buildCommand.GetOutputExecutableName()), new string [0])
.CaptureStdErr()
.CaptureStdOut()
.Execute();
result.Should().Pass();
// verify the output xml file
new DirectoryInfo(outputDir).Sub("scripts").Should()
.Exist()
.And.HaveFile("run.cmd");
new DirectoryInfo(outputDir).Should()
.HaveFile("config.xml");
// verify embedded resources
result.StdOut.Should().Contain("TestAppWithContentPackage.dnf.png");
result.StdOut.Should().Contain("TestAppWithContentPackage.ui.png");
// verify 'all' language files not included
result.StdOut.Should().NotContain("TestAppWithContentPackage.dnf_all.png");
result.StdOut.Should().NotContain("TestAppWithContentPackage.ui_all.png");
// verify classes
result.StdOut.Should().Contain("TestAppWithContentPackage.Foo");
result.StdOut.Should().Contain("MyNamespace.Util");
}
private void CopyProjectToTempDir(string projectDir, TempDirectory tempDir)
{
// copy all the files to temp dir