2017-01-25 12:30:56 -08: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 FluentAssertions ;
using Microsoft.DotNet.TestFramework ;
using Microsoft.DotNet.Tools.Test.Utilities ;
using System.IO ;
using System.IO.Compression ;
using System.Linq ;
using System.Xml.Linq ;
using Xunit ;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantToMigrateDeprecatedProjects : TestBase
{
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedPackOptionsWarningsArePrinted ( )
2017-01-25 12:30:56 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedPack" )
2017-01-25 12:30:56 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'repository' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'projectUrl' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'licenseUrl' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'iconUrl' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'owners' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'tags' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'releaseNotes' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'requireLicenseAcceptance' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'summary' option in the root is deprecated. Use it in 'packOptions' instead." ) ;
2017-01-25 17:28:57 -08:00
cmd . StdOut . Should ( ) . Contain (
"The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead." ) ;
2017-01-25 12:30:56 -08:00
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigrateDeprecatedPack ( )
2017-01-25 12:30:56 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedPack" )
2017-01-25 12:30:56 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 12:53:29 -08:00
. Execute ( "build -c Debug" )
2017-01-25 12:30:56 -08:00
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 12:53:29 -08:00
. Execute ( "pack -c Debug" )
2017-01-25 12:30:56 -08:00
. Should ( ) . Pass ( ) ;
var outputDir = projectDirectory . GetDirectory ( "bin" , "Debug" ) ;
outputDir . Should ( ) . Exist ( )
2017-01-28 15:14:17 -10:00
. And . HaveFile ( "PJDeprecatedPack.1.0.0.nupkg" ) ;
2017-01-25 12:30:56 -08:00
2017-01-28 15:14:17 -10:00
var outputPackage = outputDir . GetFile ( "PJDeprecatedPack.1.0.0.nupkg" ) ;
2017-01-25 12:30:56 -08:00
var zip = ZipFile . Open ( outputPackage . FullName , ZipArchiveMode . Read ) ;
2017-01-28 15:14:17 -10:00
zip . Entries . Should ( ) . Contain ( e = > e . FullName = = "PJDeprecatedPack.nuspec" )
2017-01-25 17:28:57 -08:00
. And . Contain ( e = > e . FullName = = "content/Content1.txt" )
. And . Contain ( e = > e . FullName = = "content/Content2.txt" ) ;
2017-01-25 12:30:56 -08:00
var manifestReader = new StreamReader (
2017-01-28 15:14:17 -10:00
zip . Entries . First ( e = > e . FullName = = "PJDeprecatedPack.nuspec" ) . Open ( ) ) ;
2017-01-25 12:30:56 -08:00
// NOTE: Commented out those that are not migrated.
// https://microsoft.sharepoint.com/teams/netfx/corefx/_layouts/15/WopiFrame.aspx?sourcedoc=%7B0cfbc196-0645-4781-84c6-5dffabd76bee%7D&action=edit&wd=target%28Planning%2FMSBuild%20CLI%20integration%2Eone%7C41D470DD-CF44-4595-8E05-0CE238864B55%2FProject%2Ejson%20Migration%7CA553D979-EBC6-484B-A12E-036E0730864A%2F%29
var nuspecXml = XDocument . Parse ( manifestReader . ReadToEnd ( ) ) ;
nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "projectUrl" ) . Value
. Should ( ) . Be ( "http://projecturl/" ) ;
nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "licenseUrl" ) . Value
. Should ( ) . Be ( "http://licenseurl/" ) ;
nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "iconUrl" ) . Value
. Should ( ) . Be ( "http://iconurl/" ) ;
//nuspecXml.Descendants().Single(e => e.Name.LocalName == "owners").Value
// .Should().Be("owner1,owner2");
nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "tags" ) . Value
. Should ( ) . Be ( "tag1 tag2" ) ;
nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "releaseNotes" ) . Value
. Should ( ) . Be ( "releaseNotes" ) ;
nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "requireLicenseAcceptance" ) . Value
. Should ( ) . Be ( "true" ) ;
//nuspecXml.Descendants().Single(e => e.Name.LocalName == "summary").Value
// .Should().Be("summary");
var repositoryNode = nuspecXml . Descendants ( ) . Single ( e = > e . Name . LocalName = = "repository" ) ;
repositoryNode . Attributes ( "type" ) . Single ( ) . Value . Should ( ) . Be ( "git" ) ;
repositoryNode . Attributes ( "url" ) . Single ( ) . Value . Should ( ) . Be ( "http://url/" ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedCompilationOptionsWarningsArePrinted ( )
2017-01-25 12:30:56 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompilation" )
2017-01-25 12:30:56 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'compilerName' option in the root is deprecated. Use it in 'buildOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'compilationOptions' option is deprecated. Use 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedCompilation ( )
2017-01-25 12:30:56 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompilation" )
2017-01-25 12:30:56 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 14:32:41 -08:00
. Execute ( "build -c Debug" )
2017-01-25 12:30:56 -08:00
. Should ( ) . Pass ( ) ;
}
2017-01-25 17:28:57 -08:00
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedContentOptionsWarningsArePrinted ( )
2017-01-25 17:28:57 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedContent" )
2017-01-25 17:28:57 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'content' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'contentExclude' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'contentFiles' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'contentBuiltIn' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedContent ( )
2017-01-25 17:28:57 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedContent" )
2017-01-25 17:28:57 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 12:53:29 -08:00
. Execute ( "build -c Debug" )
2017-01-25 17:28:57 -08:00
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 12:53:29 -08:00
. Execute ( "publish -c Debug" )
2017-01-25 17:28:57 -08:00
. Should ( ) . Pass ( ) ;
2017-03-09 21:17:10 -08:00
var outputDir = projectDirectory . GetDirectory ( "bin" , "Debug" , "netcoreapp1.1" ) ;
2017-01-25 17:28:57 -08:00
outputDir . Should ( ) . Exist ( )
. And . HaveFiles ( new [ ]
{
2017-02-23 22:55:35 -08:00
"ContentFile1.txt1" ,
"ContentFile2.txt1" ,
"ContentFileBuiltIn1.txt1" ,
"ContentFileBuiltIn2.txt1" ,
2017-01-26 09:55:09 -08:00
"IncludeThis.txt" ,
2017-01-25 17:28:57 -08:00
} ) ;
2017-01-26 09:55:09 -08:00
Directory . Exists ( Path . Combine ( outputDir . FullName , "ExcludeThis1.txt" ) ) . Should ( ) . BeFalse ( ) ;
Directory . Exists ( Path . Combine ( outputDir . FullName , "ExcludeThis2.txt" ) ) . Should ( ) . BeFalse ( ) ;
2017-01-25 17:28:57 -08:00
2017-03-09 21:17:10 -08:00
var publishDir = projectDirectory . GetDirectory ( "bin" , "Debug" , "netcoreapp1.1" , "publish" ) ;
2017-01-25 17:28:57 -08:00
publishDir . Should ( ) . Exist ( )
. And . HaveFiles ( new [ ]
{
2017-02-23 22:55:35 -08:00
"ContentFile1.txt1" ,
"ContentFile2.txt1" ,
"ContentFileBuiltIn1.txt1" ,
"ContentFileBuiltIn2.txt1" ,
2017-01-26 09:55:09 -08:00
"IncludeThis.txt" ,
2017-01-25 17:28:57 -08:00
} ) ;
2017-01-26 09:55:09 -08:00
Directory . Exists ( Path . Combine ( publishDir . FullName , "ExcludeThis1.txt" ) ) . Should ( ) . BeFalse ( ) ;
Directory . Exists ( Path . Combine ( publishDir . FullName , "ExcludeThis2.txt" ) ) . Should ( ) . BeFalse ( ) ;
2017-01-25 17:28:57 -08:00
}
2017-01-26 08:34:36 -08:00
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedCompileOptionsWarningsArePrinted ( )
2017-01-26 08:34:36 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompile" )
2017-01-26 08:34:36 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'compile' option is deprecated. Use 'compile' in 'buildOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'compileFiles' option is deprecated. Use 'compile' in 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedCompile ( )
2017-01-26 08:34:36 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompile" )
2017-01-26 08:34:36 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 14:32:41 -08:00
. Execute ( "build -c Debug" )
2017-01-26 08:34:36 -08:00
. Should ( ) . Pass ( ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedCompileBuiltInOptionsWarningsArePrinted ( )
2017-01-26 08:34:36 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompileBuiltIn" )
2017-01-26 08:34:36 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'compileBuiltIn' option is deprecated. Use 'compile' in 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedCompileBuiltIn ( )
2017-01-26 08:34:36 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompileBuiltIn" )
2017-01-26 08:34:36 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
//Issue: https://github.com/dotnet/cli/issues/5467
//new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
2017-01-26 14:32:41 -08:00
// .Execute("build -c Debug")
2017-01-26 08:34:36 -08:00
// .Should().Pass();
}
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedCompileExcludeOptionsWarningsArePrinted ( )
2017-01-26 08:34:36 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompileExclude" )
2017-01-26 08:34:36 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'compileExclude' option is deprecated. Use 'compile' in 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedCompileExclude ( )
2017-01-26 08:34:36 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedCompileExclude" )
2017-01-26 08:34:36 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
2017-01-28 15:14:17 -10:00
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "build -c Debug" )
. Should ( ) . Pass ( ) ;
2017-01-26 08:34:36 -08:00
}
2017-01-26 09:15:30 -08:00
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedResourceOptionsWarningsArePrinted ( )
2017-01-26 09:15:30 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedResource" )
2017-01-26 09:15:30 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'resource' option is deprecated. Use 'embed' in 'buildOptions' instead." ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'resourceFiles' option is deprecated. Use 'embed' in 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedResource ( )
2017-01-26 09:15:30 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedResource" )
2017-01-26 09:15:30 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 14:32:41 -08:00
. Execute ( "build -c Debug" )
2017-01-26 09:15:30 -08:00
. Should ( ) . Pass ( ) ;
2017-03-09 21:17:10 -08:00
if ( ! EnvironmentInfo . HasSharedFramework ( "netcoreapp1.1" ) )
2017-02-20 10:01:29 -06:00
{
2017-03-09 21:17:10 -08:00
// running the app requires netcoreapp1.1
2017-02-20 10:01:29 -06:00
return ;
}
2017-01-26 09:15:30 -08:00
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 14:32:41 -08:00
. ExecuteWithCapturedOutput ( "run -c Debug" ) ;
2017-01-26 09:15:30 -08:00
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain ( "3 Resources Found:" ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedResourceBuiltInOptionsWarningsArePrinted ( )
2017-01-26 09:15:30 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedResourceBuiltIn" )
2017-01-26 09:15:30 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'resourceBuiltIn' option is deprecated. Use 'embed' in 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedResourceBuiltIn ( )
2017-01-26 09:15:30 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedResourceBuiltIn" )
2017-01-26 09:15:30 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root
. GetDirectory ( "project" ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 14:32:41 -08:00
. Execute ( "build -c Debug" )
2017-01-26 09:15:30 -08:00
. Should ( ) . Pass ( ) ;
2017-03-09 21:17:10 -08:00
if ( ! EnvironmentInfo . HasSharedFramework ( "netcoreapp1.1" ) )
2017-02-20 10:01:29 -06:00
{
2017-03-09 21:17:10 -08:00
// running the app requires netcoreapp1.1
2017-02-20 10:01:29 -06:00
return ;
}
2017-01-26 09:15:30 -08:00
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
2017-01-26 14:32:41 -08:00
. ExecuteWithCapturedOutput ( "run -c Debug" ) ;
2017-01-26 09:15:30 -08:00
cmd . Should ( ) . Pass ( ) ;
// Issue: https://github.com/dotnet/cli/issues/5467
//cmd.StdOut.Should().Contain("2 Resources Found:");
}
[Fact]
2017-01-28 15:14:17 -10:00
public void WhenMigratingDeprecatedResourceExcludeOptionsWarningsArePrinted ( )
2017-01-26 09:15:30 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedResourceExclude" )
2017-01-26 09:15:30 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "migrate" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain (
"The 'resourceExclude' option is deprecated. Use 'embed' in 'buildOptions' instead." ) ;
}
[Fact]
2017-01-28 15:14:17 -10:00
public void MigratingDeprecatedResourceExclude ( )
2017-01-26 09:15:30 -08:00
{
var projectDirectory = TestAssets
2017-01-28 15:14:17 -10:00
. GetProjectJson ( TestAssetKinds . NonRestoredTestProjects , "PJDeprecatedResourceExclude" )
2017-01-26 09:15:30 -08:00
. CreateInstance ( )
. WithSourceFiles ( )
. Root ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "migrate" )
. Should ( ) . Pass ( ) ;
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "restore" )
. Should ( ) . Pass ( ) ;
2017-01-28 15:14:17 -10:00
new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. Execute ( "build -c Debug" )
. Should ( ) . Pass ( ) ;
2017-01-26 09:15:30 -08:00
2017-03-09 21:17:10 -08:00
if ( ! EnvironmentInfo . HasSharedFramework ( "netcoreapp1.1" ) )
2017-02-20 10:01:29 -06:00
{
2017-03-09 21:17:10 -08:00
// running the app requires netcoreapp1.1
2017-02-20 10:01:29 -06:00
return ;
}
2017-01-28 15:14:17 -10:00
var cmd = new DotnetCommand ( )
. WithWorkingDirectory ( projectDirectory )
. ExecuteWithCapturedOutput ( "run -c Debug" ) ;
cmd . Should ( ) . Pass ( ) ;
cmd . StdOut . Should ( ) . Contain ( "0 Resources Found:" ) ;
2017-01-26 09:15:30 -08:00
}
2017-01-25 12:30:56 -08:00
}
}