From f75eb0f0e9ad6d4c814f424492b9cf5034ad2ca5 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 27 Apr 2018 10:12:56 -0700 Subject: [PATCH] Add MvcTemplate --- AspNetCoreSdkTests/Templates/MvcTemplate.cs | 22 +++++++++++++ .../Templates/RazorBaseTemplate.cs | 32 +++++++++++++++++++ AspNetCoreSdkTests/Templates/RazorTemplate.cs | 31 +++++------------- AspNetCoreSdkTests/Templates/TemplateData.cs | 1 + 4 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 AspNetCoreSdkTests/Templates/MvcTemplate.cs create mode 100644 AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs diff --git a/AspNetCoreSdkTests/Templates/MvcTemplate.cs b/AspNetCoreSdkTests/Templates/MvcTemplate.cs new file mode 100644 index 0000000000..13bdcc24bc --- /dev/null +++ b/AspNetCoreSdkTests/Templates/MvcTemplate.cs @@ -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 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))); + } +} diff --git a/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs b/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs new file mode 100644 index 0000000000..416eb9150d --- /dev/null +++ b/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs @@ -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 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 ExpectedBinFilesAfterBuild => Enumerable.Concat(base.ExpectedBinFilesAfterBuild, new[] + { + $"{Name}.Views.dll", + $"{Name}.Views.pdb", + }.Select(p => Path.Combine(OutputPath, p))); + } +} diff --git a/AspNetCoreSdkTests/Templates/RazorTemplate.cs b/AspNetCoreSdkTests/Templates/RazorTemplate.cs index 109f662dea..48b4814379 100644 --- a/AspNetCoreSdkTests/Templates/RazorTemplate.cs +++ b/AspNetCoreSdkTests/Templates/RazorTemplate.cs @@ -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 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 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))); } } diff --git a/AspNetCoreSdkTests/Templates/TemplateData.cs b/AspNetCoreSdkTests/Templates/TemplateData.cs index a134c5707e..3be196c422 100644 --- a/AspNetCoreSdkTests/Templates/TemplateData.cs +++ b/AspNetCoreSdkTests/Templates/TemplateData.cs @@ -10,6 +10,7 @@ namespace AspNetCoreSdkTests.Templates new ConsoleApplicationTemplate(), new WebTemplate(), new RazorTemplate(), + new MvcTemplate(), }; } }