From 3953a85a63811f060d6f8849a3cf4170aeafc2e9 Mon Sep 17 00:00:00 2001 From: schellap Date: Mon, 23 May 2016 01:02:26 -0700 Subject: [PATCH] Add test for standalone resource dependency --- .../TestAppWithResourceDeps/Program.cs | 12 +++++++ .../TestAppWithResourceDeps/project.json | 33 +++++++++++++++++++ .../PublishStandaloneTests.cs | 26 +++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 TestAssets/TestProjects/TestAppWithResourceDeps/Program.cs create mode 100644 TestAssets/TestProjects/TestAppWithResourceDeps/project.json diff --git a/TestAssets/TestProjects/TestAppWithResourceDeps/Program.cs b/TestAssets/TestProjects/TestAppWithResourceDeps/Program.cs new file mode 100644 index 000000000..3acb67142 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithResourceDeps/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static int Main(string[] args) + { + return 0; + } + } +} diff --git a/TestAssets/TestProjects/TestAppWithResourceDeps/project.json b/TestAssets/TestProjects/TestAppWithResourceDeps/project.json new file mode 100644 index 000000000..c36b8a094 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithResourceDeps/project.json @@ -0,0 +1,33 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true + }, + "dependencies": { + "NETStandard.Library": "1.5.0-rc2-24027", + "Microsoft.CSharp": "4.0.1-rc2-24027", + "System.Dynamic.Runtime": "4.0.11-rc2-24027", + "System.Reflection.Metadata": "1.3.0-rc2-24027", + "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24027", + "System.Xml.XmlSerializer": "4.0.11-rc2-24027", + "WindowsAzure.Storage": "6.2.2-preview" + }, + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dnxcore50", + "portable-net45+win8" + ] + } + }, + "runtimes": { + "win7-x64": {}, + "win7-x86": {}, + "osx.10.10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.14.04-x64": {}, + "centos.7-x64": {}, + "rhel.7.2-x64": {}, + "debian.8-x64": {} + } +} diff --git a/test/dotnet-publish.Tests/PublishStandaloneTests.cs b/test/dotnet-publish.Tests/PublishStandaloneTests.cs index 6e097de07..e139fb924 100644 --- a/test/dotnet-publish.Tests/PublishStandaloneTests.cs +++ b/test/dotnet-publish.Tests/PublishStandaloneTests.cs @@ -21,6 +21,32 @@ namespace Microsoft.DotNet.Tools.Publish.Tests publishDir.Should().NotHaveFile("StandaloneApp.runtimeconfig.dev.json"); } + [Fact] + public void StandaloneAppHasResourceDependency() + { + // WindowsAzure.Services brings in en, zh etc. resource DLLs. + // The host has to be able to find these assemblies from the deps file + // from the standalone app base under the ietf tag directory. + + var testName = "TestAppWithResourceDeps"; + TestInstance instance = + TestAssetsManager + .CreateTestInstance(testName) + .WithLockFiles() + .WithBuildArtifacts(); + + var publishCommand = new PublishCommand(instance.TestRoot); + publishCommand.Execute().Should().Pass(); + + var publishedDir = publishCommand.GetOutputDirectory(); + var extension = publishCommand.GetExecutableExtension(); + var outputExe = testName + extension; + publishedDir.Should().HaveFiles(new[] { $"{testName}.dll", outputExe }); + + var command = new TestCommand(Path.Combine(publishedDir.FullName, outputExe)); + command.Execute("").Should().ExitWith(0); + } + private DirectoryInfo Publish(TestInstance testInstance) { var publishCommand = new PublishCommand(Path.Combine(testInstance.TestRoot, "StandaloneApp"));