Update to template engine build 166 and updates to 2.0 templates

This commit is contained in:
Mike Lorbetske 2017-03-27 17:46:32 -07:00
parent 3634da519a
commit 9bb88734ea
6 changed files with 12 additions and 43 deletions

View file

@ -76,15 +76,7 @@ namespace Microsoft.DotNet.New.Tests
[InlineData("classlib", "NetStandardImplicitPackageVersion", "netstandard.library")]
public void NewProjectRestoresCorrectPackageVersion(string type, string propertyName, string packageName)
{
// These will fail when templates stop including explicit version.
// Collapse back to one method and remove the explicit version handling when that happens.
NewProjectRestoresCorrectPackageVersion(type, propertyName, packageName, deleteExplicitVersion: true);
NewProjectRestoresCorrectPackageVersion(type, propertyName, packageName, deleteExplicitVersion: false);
}
private void NewProjectRestoresCorrectPackageVersion(string type, string propertyName, string packageName, bool deleteExplicitVersion)
{
var rootPath = TestAssets.CreateTestDirectory(identifier: $"_{type}_{deleteExplicitVersion}").FullName;
var rootPath = TestAssets.CreateTestDirectory(identifier: $"_{type}").FullName;
var packagesDirectory = Path.Combine(rootPath, "packages");
var projectName = "Project";
var expectedVersion = GetFrameworkPackageVersion();
@ -94,8 +86,6 @@ namespace Microsoft.DotNet.New.Tests
.Execute($"{type} --name {projectName} -o .")
.Should().Pass();
ValidateAndRemoveExplicitVersion();
new RestoreCommand()
.WithWorkingDirectory(rootPath)
.Execute($"--packages {packagesDirectory}")
@ -130,28 +120,6 @@ namespace Microsoft.DotNet.New.Tests
return dependency.Version;
}
}
// Remove when templates stop putting an explicit version
void ValidateAndRemoveExplicitVersion()
{
var projectFileName = $"{projectName}.csproj";
var projectPath = Path.Combine(rootPath, projectFileName);
var projectDocument = XDocument.Load(projectPath);
var explicitVersionNode = projectDocument
.Elements("Project")
.Elements("PropertyGroup")
.Elements(propertyName)
.SingleOrDefault();
explicitVersionNode.Should().NotBeNull();
explicitVersionNode.Value.Should().Be(expectedVersion);
if (deleteExplicitVersion)
{
explicitVersionNode.Remove();
projectDocument.Save(projectPath);
}
}
}
}
}

View file

@ -20,9 +20,9 @@ namespace Microsoft.DotNet.New.Tests
[InlineData("C#", "classlib", false)]
[InlineData("C#", "mstest", false)]
[InlineData("C#", "xunit", false)]
[InlineData("C#", "web", true)]
[InlineData("C#", "mvc", true)]
[InlineData("C#", "webapi", true)]
[InlineData("C#", "web", false)]
[InlineData("C#", "mvc", false)]
[InlineData("C#", "webapi", false)]
// Uncomment the test below once https://github.com/dotnet/netcorecli-fsc/issues/92 is fixed.
//[InlineData("F#", "console", false)]
//[InlineData("F#", "classlib", false)]

View file

@ -16,7 +16,7 @@ namespace Microsoft.DotNet.New.Tests
cmd.ExitCode.Should().NotBe(0);
cmd.StdErr.Should().StartWith("No templates matched the input template name: [Web1.1]");
cmd.StdErr.Should().StartWith("No templates matched the input template name: Web1.1.");
}
[Fact]
@ -26,7 +26,7 @@ namespace Microsoft.DotNet.New.Tests
cmd.ExitCode.Should().NotBe(0);
cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: [c]");
cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: c.");
}
}
}