[Design] Harden template package installer and fix name (#7624)

Harden template package installer and fix name
This commit is contained in:
Ryan Brandenburg 2019-02-19 14:41:59 -08:00 committed by GitHub
parent d1fac57734
commit 69abefa06f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -5,6 +5,7 @@ using System;
using System.IO;
using System.Linq;
using Microsoft.Extensions.CommandLineUtils;
using Xunit;
using Xunit.Abstractions;
namespace Templates.Test.Helpers
@ -95,21 +96,21 @@ namespace Templates.Test.Helpers
}
VerifyCannotFindTemplate(output, "web");
VerifyCannotFindTemplate(output, "razor");
VerifyCannotFindTemplate(output, "webapp");
VerifyCannotFindTemplate(output, "mvc");
VerifyCannotFindTemplate(output, "react");
VerifyCannotFindTemplate(output, "reactredux");
VerifyCannotFindTemplate(output, "angular");
var builtPackages = MondoHelpers.GetNupkgFiles();
foreach (var packagePath in builtPackages)
{
if (_templatePackages.Any(name => Path.GetFileName(packagePath).StartsWith(name, StringComparison.OrdinalIgnoreCase)))
var templatePackages = builtPackages.Where(b => _templatePackages.Any(t => Path.GetFileName(b).StartsWith(t, StringComparison.OrdinalIgnoreCase)));
Assert.Equal(4, templatePackages.Count());
foreach (var packagePath in templatePackages)
{
output.WriteLine($"Installing templates package {packagePath}...");
RunDotNetNew(output, $"--install \"{packagePath}\"", assertSuccess: true);
}
}
VerifyCanFindTemplate(output, "razor");
VerifyCanFindTemplate(output, "webapp");
VerifyCanFindTemplate(output, "web");
VerifyCanFindTemplate(output, "react");
}