Add MvcTemplate

This commit is contained in:
Mike Harder 2018-04-27 10:12:56 -07:00
parent 9ccf6501ef
commit f75eb0f0e9
4 changed files with 63 additions and 23 deletions

View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace AspNetCoreSdkTests.Templates
{
public class MvcTemplate : RazorBaseTemplate
{
public override string Name => "mvc";
protected override string RazorPath => "Views";
public override IEnumerable<string> ExpectedObjFilesAfterBuild => Enumerable.Concat(base.ExpectedObjFilesAfterBuild, new[]
{
Path.Combine("Razor", RazorPath, "Home", "About.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Home", "Contact.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Home", "Index.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Home", "Privacy.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Shared", "Error.g.cshtml.cs"),
}.Select(p => Path.Combine(OutputPath, p)));
}
}

View File

@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace AspNetCoreSdkTests.Templates
{
public abstract class RazorBaseTemplate : WebTemplate
{
protected abstract string RazorPath { get; }
public override IEnumerable<string> ExpectedObjFilesAfterBuild => Enumerable.Concat(base.ExpectedObjFilesAfterBuild, new[]
{
$"{Name}.RazorCoreGenerate.cache",
$"{Name}.RazorTargetAssemblyInfo.cs",
$"{Name}.TagHelpers.input.cache",
$"{Name}.TagHelpers.output.cache",
$"{Name}.Views.dll",
$"{Name}.Views.pdb",
Path.Combine("Razor", RazorPath, "_ViewImports.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "_ViewStart.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Shared", "_CookieConsentPartial.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Shared", "_Layout.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Shared", "_ValidationScriptsPartial.g.cshtml.cs"),
}.Select(p => Path.Combine(OutputPath, p)));
public override IEnumerable<string> ExpectedBinFilesAfterBuild => Enumerable.Concat(base.ExpectedBinFilesAfterBuild, new[]
{
$"{Name}.Views.dll",
$"{Name}.Views.pdb",
}.Select(p => Path.Combine(OutputPath, p)));
}
}

View File

@ -4,34 +4,19 @@ using System.Linq;
namespace AspNetCoreSdkTests.Templates
{
public class RazorTemplate : WebTemplate
public class RazorTemplate : RazorBaseTemplate
{
public override string Name => "razor";
protected override string RazorPath => "Pages";
public override IEnumerable<string> ExpectedObjFilesAfterBuild => Enumerable.Concat(base.ExpectedObjFilesAfterBuild, new[]
{
$"{Name}.RazorCoreGenerate.cache",
$"{Name}.RazorTargetAssemblyInfo.cs",
$"{Name}.TagHelpers.input.cache",
$"{Name}.TagHelpers.output.cache",
$"{Name}.Views.dll",
$"{Name}.Views.pdb",
Path.Combine("Razor", "Pages", "_ViewImports.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "_ViewStart.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "About.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Contact.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Error.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Index.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Privacy.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Shared", "_CookieConsentPartial.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Shared", "_Layout.g.cshtml.cs"),
Path.Combine("Razor", "Pages", "Shared", "_ValidationScriptsPartial.g.cshtml.cs"),
}.Select(p => Path.Combine(OutputPath, p)));
public override IEnumerable<string> ExpectedBinFilesAfterBuild => Enumerable.Concat(base.ExpectedBinFilesAfterBuild, new[]
{
$"{Name}.Views.dll",
$"{Name}.Views.pdb",
Path.Combine("Razor", RazorPath, "About.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Contact.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Error.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Index.g.cshtml.cs"),
Path.Combine("Razor", RazorPath, "Privacy.g.cshtml.cs"),
}.Select(p => Path.Combine(OutputPath, p)));
}
}

View File

@ -10,6 +10,7 @@ namespace AspNetCoreSdkTests.Templates
new ConsoleApplicationTemplate(),
new WebTemplate(),
new RazorTemplate(),
new MvcTemplate(),
};
}
}