2016-04-13 21:24:37 +00:00
|
|
|
|
// 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 System.IO;
|
|
|
|
|
using Microsoft.DotNet.TestFramework;
|
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Publish.Tests
|
|
|
|
|
{
|
|
|
|
|
public class PublishAppWithDependencies : TestBase
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PublishTestAppWithContentPackage()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithContentPackage")
|
|
|
|
|
.WithLockFiles();
|
|
|
|
|
|
2016-04-13 23:38:15 +00:00
|
|
|
|
var publishCommand = new PublishCommand(testInstance.TestRoot);
|
|
|
|
|
var publishResult = publishCommand.Execute();
|
|
|
|
|
|
|
|
|
|
publishResult.Should().Pass();
|
|
|
|
|
|
|
|
|
|
var publishDir = publishCommand.GetOutputDirectory(portable: false);
|
2016-04-13 21:24:37 +00:00
|
|
|
|
|
|
|
|
|
publishDir.Should().HaveFiles(new[]
|
|
|
|
|
{
|
2016-04-13 23:38:15 +00:00
|
|
|
|
$"AppWithContentPackage{publishCommand.GetExecutableExtension()}",
|
|
|
|
|
"AppWithContentPackage.dll",
|
|
|
|
|
"AppWithContentPackage.deps.json"
|
2016-04-13 21:24:37 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// these files come from the contentFiles of the SharedContentA dependency
|
|
|
|
|
publishDir
|
|
|
|
|
.Sub("scripts")
|
|
|
|
|
.Should()
|
|
|
|
|
.Exist()
|
|
|
|
|
.And
|
|
|
|
|
.HaveFile("run.cmd");
|
|
|
|
|
|
|
|
|
|
publishDir
|
|
|
|
|
.Should()
|
|
|
|
|
.HaveFile("config.xml");
|
|
|
|
|
}
|
2016-04-15 21:45:51 +00:00
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PublishTestAppWithReferencesToResources()
|
|
|
|
|
{
|
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("ResourcesTests")
|
|
|
|
|
.WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var projectRoot = Path.Combine(testInstance.TestRoot, "TestApp");
|
|
|
|
|
|
|
|
|
|
var publishCommand = new PublishCommand(projectRoot);
|
|
|
|
|
var publishResult = publishCommand.Execute();
|
|
|
|
|
|
|
|
|
|
publishResult.Should().Pass();
|
|
|
|
|
|
|
|
|
|
var publishDir = publishCommand.GetOutputDirectory(portable: true);
|
|
|
|
|
|
|
|
|
|
publishDir.Should().HaveFiles(new[]
|
|
|
|
|
{
|
|
|
|
|
"TestApp.dll",
|
|
|
|
|
"TestApp.deps.json"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
foreach (var culture in new[] { "de", "es", "fr", "it", "ja", "ko", "ru", "zh-Hans", "zh-Hant" })
|
|
|
|
|
{
|
|
|
|
|
var cultureDir = publishDir.Sub(culture);
|
|
|
|
|
|
|
|
|
|
// Provided by packages
|
|
|
|
|
cultureDir.Should().HaveFiles(new[] {
|
|
|
|
|
"Microsoft.Data.Edm.resources.dll",
|
|
|
|
|
"Microsoft.Data.OData.resources.dll",
|
|
|
|
|
"System.Spatial.resources.dll"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Check for the project-to-project one
|
|
|
|
|
if (culture == "fr")
|
|
|
|
|
{
|
|
|
|
|
cultureDir.Should().HaveFile("TestLibraryWithResources.resources.dll");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-04-13 21:24:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|