Adding an E2E test for pack with content during migration.

This commit is contained in:
Livar Cunha 2017-02-23 23:07:38 -08:00
parent 6d9137cf11
commit a6165feec5
3 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1 @@
Random content.

View file

@ -17,5 +17,13 @@
}, },
"frameworks": { "frameworks": {
"netstandard1.5": {} "netstandard1.5": {}
},
"packOptions": {
"files": {
"include": ["contentitem.txt"],
"mappings": {
"dir/contentitem.txt": "contentitem.txt"
}
}
} }
} }

View file

@ -0,0 +1,62 @@
// 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.Build.Construction;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using FluentAssertions;
using System.IO;
using System.IO.Compression;
using Microsoft.DotNet.Tools.Migrate;
using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand;
using System.Runtime.Loader;
using Newtonsoft.Json.Linq;
using MigrateCommand = Microsoft.DotNet.Tools.Migrate.MigrateCommand;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantMigratedAppsToPackContent : TestBase
{
[Fact]
public void ItPacksContentForLibraries()
{
var projectDirectory = TestAssets
.GetProjectJson("PJTestLibraryWithConfiguration")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PackCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
using (var archive = ZipFile.OpenRead(
Path.Combine(projectDirectory.FullName, "bin", "debug", "PJTestLibraryWithConfiguration.1.0.0.nupkg")))
{
archive.Entries.Select(e => e.FullName).Should().Contain("dir/contentitem.txt");
}
}
}
}