Add more tests
This commit is contained in:
parent
b8d4010d85
commit
150e3c4313
14 changed files with 293 additions and 227 deletions
|
@ -0,0 +1 @@
|
|||
Test content file that should be included.
|
|
@ -0,0 +1 @@
|
|||
Test content file that should be included.
|
|
@ -0,0 +1 @@
|
|||
Test content file that should be included.
|
|
@ -0,0 +1 @@
|
|||
Test content file that should be included.
|
|
@ -0,0 +1 @@
|
|||
Test content file that should be excluded.
|
|
@ -0,0 +1 @@
|
|||
Test content file that should be included.
|
|
@ -0,0 +1 @@
|
|||
Test content file that should be included.
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"content": "*.txt",
|
||||
"contentExclude": "ExcludeThis.txt",
|
||||
"contentFiles": [ "../ContentFile1.txt", "../ContentFile2.txt" ],
|
||||
"contentBuiltIn": [ "../ContentFileBuiltIn1.txt", "../ContentFileBuiltIn2.txt" ],
|
||||
"publishExclude": "IncludeThis2.txt",
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Test pack content file.
|
|
@ -0,0 +1 @@
|
|||
Test pack content file.
|
|
@ -12,6 +12,7 @@
|
|||
"type": "git",
|
||||
"url": "http://url/"
|
||||
},
|
||||
"packInclude": [ "Content1.txt", "Content2.txt" ],
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
"emitEntryPoint": true
|
||||
|
|
|
@ -165,7 +165,8 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
|||
|
||||
// Project files
|
||||
project.Files = new ProjectFilesCollection(rawProject, project.ProjectDirectory, project.ProjectFilePath);
|
||||
AddProjectFilesCollectionDiagnostics(rawProject, project);
|
||||
AddProjectFilesDeprecationDiagnostics(rawProject, project);
|
||||
ConvertDeprecatedToSupportedFormat(rawProject);
|
||||
|
||||
var commands = rawProject.Value<JToken>("commands") as JObject;
|
||||
if (commands != null)
|
||||
|
@ -758,10 +759,14 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
|||
|
||||
if (rawPackOptions != null)
|
||||
{
|
||||
var packOptionValue = rawPackOptions.Value<T>(option);
|
||||
if (packOptionValue != null)
|
||||
var hasOption = rawPackOptions.Value<JToken>(option) != null;
|
||||
if (hasOption)
|
||||
{
|
||||
return packOptionValue;
|
||||
var packOptionValue = rawPackOptions.Value<T>(option);
|
||||
if (packOptionValue != null)
|
||||
{
|
||||
return packOptionValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -807,244 +812,173 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
|||
return File.Exists(projectPath);
|
||||
}
|
||||
|
||||
private static void AddProjectFilesCollectionDiagnostics(JObject rawProject, Project project)
|
||||
{
|
||||
ConvertDeprecatedCompileOptions(rawProject, project);
|
||||
ConvertDeprecatedContentOptions(rawProject, project);
|
||||
ConvertDeprecatedResourceOptions(rawProject, project);
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
"'files' in 'packOptions'",
|
||||
"packInclude",
|
||||
new string[] { "packOptions" },
|
||||
"files");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
"'publishOptions'",
|
||||
"publishExclude",
|
||||
new string[] { "publishOptions" },
|
||||
"excludeFiles");
|
||||
}
|
||||
|
||||
private static void ConvertDeprecatedCompileOptions(JObject rawProject, Project project)
|
||||
private static void AddProjectFilesDeprecationDiagnostics(JObject rawProject, Project project)
|
||||
{
|
||||
var compileWarning = "'compile' in 'buildOptions'";
|
||||
var compileObjectHierarchy = new string[] { "buildOptions", "compile" };
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "compile", compileWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "compileExclude", compileWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "compileFiles", compileWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "compileBuiltIn", compileWarning);
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
compileWarning,
|
||||
"compile",
|
||||
compileObjectHierarchy,
|
||||
"includeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
compileWarning,
|
||||
"compileExclude",
|
||||
compileObjectHierarchy,
|
||||
"excludeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
compileWarning,
|
||||
"compileFiles",
|
||||
compileObjectHierarchy,
|
||||
"includeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
compileWarning,
|
||||
"compileBuiltIn",
|
||||
compileObjectHierarchy,
|
||||
"builtIns");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
compileWarning,
|
||||
"exclude",
|
||||
compileObjectHierarchy,
|
||||
"exclude");
|
||||
}
|
||||
|
||||
private static void ConvertDeprecatedContentOptions(JObject rawProject, Project project)
|
||||
{
|
||||
var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output";
|
||||
var copyToOutputObjectHierarchy = new string[] { "buildOptions", "copyToOutput" };
|
||||
var publishObjectHierarchy = new string[] { "publishOptions" };
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"content",
|
||||
copyToOutputObjectHierarchy,
|
||||
"includeFiles");
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"content",
|
||||
publishObjectHierarchy,
|
||||
"includeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"contentExclude",
|
||||
copyToOutputObjectHierarchy,
|
||||
"excludeFiles");
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"contentExclude",
|
||||
publishObjectHierarchy,
|
||||
"excludeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"contentFiles",
|
||||
copyToOutputObjectHierarchy,
|
||||
"includeFiles");
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"contentFiles",
|
||||
publishObjectHierarchy,
|
||||
"includeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"contentFiles",
|
||||
copyToOutputObjectHierarchy,
|
||||
"contentBuiltIn");
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
contentWarning,
|
||||
"contentBuiltIn",
|
||||
publishObjectHierarchy,
|
||||
"builtIns");
|
||||
}
|
||||
|
||||
private static void ConvertDeprecatedResourceOptions(JObject rawProject, Project project)
|
||||
{
|
||||
var resourceWarning = "'embed' in 'buildOptions'";
|
||||
var embedObjectHierarchy = new string[] { "buildOptions", "embed" };
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "resource", resourceWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "resourceExclude", resourceWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "resourceFiles", resourceWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "resourceBuiltIn", resourceWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "namedResource", resourceWarning);
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
resourceWarning,
|
||||
"resource",
|
||||
embedObjectHierarchy,
|
||||
"includeFiles");
|
||||
var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output";
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "content", contentWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "contentExclude", contentWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "contentFiles", contentWarning);
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "contentBuiltIn", contentWarning);
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
resourceWarning,
|
||||
"resourceExclude",
|
||||
embedObjectHierarchy,
|
||||
"excludeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
resourceWarning,
|
||||
"resourceFiles",
|
||||
embedObjectHierarchy,
|
||||
"includeFiles");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
resourceWarning,
|
||||
"resourceBuiltIn",
|
||||
embedObjectHierarchy,
|
||||
"builtIns");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
resourceWarning,
|
||||
"namedResource",
|
||||
embedObjectHierarchy,
|
||||
"mappings");
|
||||
|
||||
ConvertFromDeprecatedFormat(
|
||||
rawProject,
|
||||
project,
|
||||
resourceWarning,
|
||||
"exclude",
|
||||
embedObjectHierarchy,
|
||||
"exclude");
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "packInclude", "'files' in 'packOptions'");
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "publishExclude", "'publishOptions'");
|
||||
AddDeprecatedDiagnosticMessage(rawProject, project, "exclude", "'exclude' within 'compile' or 'embed'");
|
||||
}
|
||||
|
||||
private static void ConvertFromDeprecatedFormat(
|
||||
private static void AddDeprecatedDiagnosticMessage(
|
||||
JObject rawProject,
|
||||
Project project,
|
||||
string message,
|
||||
string option,
|
||||
string message)
|
||||
{
|
||||
var lineInfo = rawProject.Value<IJsonLineInfo>(option);
|
||||
if (lineInfo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
project.Diagnostics.Add(
|
||||
new DiagnosticMessage(
|
||||
ErrorCodes.DOTNET1015,
|
||||
$"The '{option}' option is deprecated. Use {message} instead.",
|
||||
project.ProjectFilePath,
|
||||
DiagnosticMessageSeverity.Warning,
|
||||
lineInfo.LineNumber,
|
||||
lineInfo.LinePosition));
|
||||
}
|
||||
|
||||
private static void ConvertDeprecatedToSupportedFormat(JObject rawProject)
|
||||
{
|
||||
ConvertToBuildOptionsCompile(rawProject);
|
||||
ConvertToBuildOptionsEmbed(rawProject);
|
||||
ConvertToBuildOptionsCopyToOutput(rawProject);
|
||||
ConvertToPackOptions(rawProject);
|
||||
ConvertToPublishOptions(rawProject);
|
||||
}
|
||||
|
||||
private static void ConvertToBuildOptionsCompile(JObject rawProject)
|
||||
{
|
||||
var jpath = "buildOptions.compile";
|
||||
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "compile", "include");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "compileExclude", "excludeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "compileFiles", "includeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "compileBuiltIn", "include");
|
||||
}
|
||||
|
||||
private static void ConvertToBuildOptionsEmbed(JObject rawProject)
|
||||
{
|
||||
var jpath = "buildOptions.embed";
|
||||
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "resource", "include");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "resourceExclude", "excludeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "resourceFiles", "includeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "namedResource", "mappings");
|
||||
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "resourceBuiltIn", "include");
|
||||
}
|
||||
|
||||
private static void ConvertToBuildOptionsCopyToOutput(JObject rawProject)
|
||||
{
|
||||
var jpath = "buildOptions.copyToOutput";
|
||||
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "content", "include");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "contentExclude", "excludeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "contentFiles", "includeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "contentBuiltIn", "include");
|
||||
}
|
||||
|
||||
private static void ConvertToPackOptions(JObject rawProject)
|
||||
{
|
||||
var jpath = "packOptions";
|
||||
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.files", "packInclude", "include");
|
||||
}
|
||||
|
||||
private static void ConvertToPublishOptions(JObject rawProject)
|
||||
{
|
||||
var jpath = "publishOptions";
|
||||
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "content", "include");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "publishExclude", "exclude");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "contentExclude", "excludeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, jpath, "contentFiles", "includeFiles");
|
||||
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "contentBuiltIn", "include");
|
||||
}
|
||||
|
||||
private static bool AreDeprecatedOptionsIgnored(JObject rawProject, string jpathToNewFormatObject)
|
||||
{
|
||||
// If the node already exists this means that the project.json file contained both the old and
|
||||
// new format. In these cases the project.json build ignores the deprecated format and just uses
|
||||
// the new format.
|
||||
return (rawProject.SelectToken(jpathToNewFormatObject) != null);
|
||||
}
|
||||
|
||||
private static JObject GetOrCreateObjectHierarchy(JObject rawProject, string jpath)
|
||||
{
|
||||
var currentObject = rawProject as JObject;
|
||||
|
||||
var objectHierarchy = jpath.Split('.');
|
||||
foreach (var name in objectHierarchy)
|
||||
{
|
||||
var childObject = currentObject.Value<JObject>(name);
|
||||
if (childObject == null)
|
||||
{
|
||||
childObject = new JObject();
|
||||
currentObject[name] = childObject;
|
||||
}
|
||||
currentObject = childObject;
|
||||
}
|
||||
|
||||
return currentObject;
|
||||
}
|
||||
|
||||
private static void ConvertFromDeprecatedFormat(
|
||||
JObject rawProject,
|
||||
string jpathToObject,
|
||||
string deprecatedKey,
|
||||
string[] newKeyObjectHierarchy,
|
||||
string newKey
|
||||
)
|
||||
{
|
||||
var deprecatedValue = rawProject.Value<IJsonLineInfo>(deprecatedKey);
|
||||
var deprecatedValue = rawProject.Value<JToken>(deprecatedKey);
|
||||
if (deprecatedValue != null)
|
||||
{
|
||||
var currentObject = rawProject;
|
||||
foreach (var key in newKeyObjectHierarchy)
|
||||
{
|
||||
var childObject = currentObject.Value<JToken>(key) as JObject;
|
||||
if (childObject == null)
|
||||
{
|
||||
childObject = new JObject();
|
||||
currentObject[key] = childObject;
|
||||
}
|
||||
|
||||
currentObject = childObject;
|
||||
}
|
||||
|
||||
if (deprecatedValue is JObject)
|
||||
{
|
||||
currentObject[newKey] = (deprecatedValue as JObject).DeepClone();
|
||||
//(currentObject[newKey] as JObject).Merge((deprecatedValue as JObject).DeepClone(), new JsonMergeSettings
|
||||
//{
|
||||
// // union array values together to avoid duplicates
|
||||
// MergeArrayHandling = MergeArrayHandling.Union
|
||||
//});
|
||||
}
|
||||
else if (deprecatedValue is JToken)
|
||||
{
|
||||
currentObject[newKey] = (deprecatedValue as JToken).DeepClone();
|
||||
//JToken.FromObject(x.Concat(x))
|
||||
}
|
||||
|
||||
project.Diagnostics.Add(
|
||||
new DiagnosticMessage(
|
||||
ErrorCodes.DOTNET1015,
|
||||
$"The '{deprecatedKey}' option is deprecated. Use {message} instead.",
|
||||
project.ProjectFilePath,
|
||||
DiagnosticMessageSeverity.Warning,
|
||||
deprecatedValue.LineNumber,
|
||||
deprecatedValue.LinePosition));
|
||||
var objectNode = GetOrCreateObjectHierarchy(rawProject, jpathToObject);
|
||||
objectNode[newKey] = deprecatedValue.DeepClone();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
"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.");
|
||||
cmd.StdOut.Should().Contain(
|
||||
"The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -85,7 +87,9 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
var outputPackage = outputDir.GetFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg");
|
||||
|
||||
var zip = ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read);
|
||||
zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec");
|
||||
zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec")
|
||||
.And.Contain(e => e.FullName == "content/Content1.txt")
|
||||
.And.Contain(e => e.FullName == "content/Content2.txt");
|
||||
|
||||
var manifestReader = new StreamReader(
|
||||
zip.Entries.First(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec").Open());
|
||||
|
@ -160,5 +164,87 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Execute("build")
|
||||
.Should().Pass();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenMigratingAProjectWithDeprecatedContentOptionsWarningsArePrinted()
|
||||
{
|
||||
var projectDirectory = TestAssets
|
||||
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions")
|
||||
.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]
|
||||
public void WhenMigratingAProjectWithDeprecatedContentOptionsItSucceeds()
|
||||
{
|
||||
var projectDirectory = TestAssets
|
||||
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions")
|
||||
.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)
|
||||
.Execute("build")
|
||||
.Should().Pass();
|
||||
|
||||
new DotnetCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute("publish")
|
||||
.Should().Pass();
|
||||
|
||||
var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0");
|
||||
outputDir.Should().Exist()
|
||||
.And.HaveFiles(new[]
|
||||
{
|
||||
"ContentFile1.txt",
|
||||
"ContentFile2.txt",
|
||||
"ContentFileBuiltIn1.txt",
|
||||
"ContentFileBuiltIn2.txt",
|
||||
"IncludeThis1.txt",
|
||||
});
|
||||
Directory.Exists(Path.Combine(outputDir.FullName, "IncludeThis2.txt")).Should().BeFalse();
|
||||
Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis.txt")).Should().BeFalse();
|
||||
|
||||
var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");
|
||||
publishDir.Should().Exist()
|
||||
.And.HaveFiles(new[]
|
||||
{
|
||||
"ContentFile1.txt",
|
||||
"ContentFile2.txt",
|
||||
"ContentFileBuiltIn1.txt",
|
||||
"ContentFileBuiltIn2.txt",
|
||||
"IncludeThis1.txt",
|
||||
});
|
||||
Directory.Exists(Path.Combine(publishDir.FullName, "IncludeThis2.txt")).Should().BeFalse();
|
||||
Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis.txt")).Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue