diff --git a/AspNetCoreSdkTests/TemplateTests.cs b/AspNetCoreSdkTests/TemplateTests.cs index b8e7690676..815673d45d 100644 --- a/AspNetCoreSdkTests/TemplateTests.cs +++ b/AspNetCoreSdkTests/TemplateTests.cs @@ -62,6 +62,20 @@ namespace AspNetCoreSdkTests } } + [Test] + [TestCaseSource(typeof(TemplateData), nameof(TemplateData.Current))] + public void Publish(Template template, NuGetConfig nuGetConfig) + { + using (var context = new DotNetContext()) + { + context.New(template); + context.Restore(nuGetConfig); + context.Publish(); + + CollectionAssert.AreEquivalent(template.ExpectedFilesAfterPublish, context.GetPublishFiles()); + } + } + private HttpResponseMessage GetAsync(Uri requestUri) { while (true) diff --git a/AspNetCoreSdkTests/Templates/AngularTemplate.cs b/AspNetCoreSdkTests/Templates/AngularTemplate.cs index 5dca4d586f..9b03800cee 100644 --- a/AspNetCoreSdkTests/Templates/AngularTemplate.cs +++ b/AspNetCoreSdkTests/Templates/AngularTemplate.cs @@ -1,4 +1,8 @@ -namespace AspNetCoreSdkTests.Templates +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace AspNetCoreSdkTests.Templates { public class AngularTemplate : SpaBaseTemplate { @@ -7,5 +11,21 @@ protected AngularTemplate() { } public override string Name => "angular"; + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + Path.Combine("wwwroot", "favicon.ico"), + Path.Combine("ClientApp", "dist", "3rdpartylicenses.txt"), + Path.Combine("ClientApp", "dist", "glyphicons-halflings-regular.448c34a56d699c29117a.woff2"), + Path.Combine("ClientApp", "dist", "glyphicons-halflings-regular.89889688147bd7575d63.svg"), + Path.Combine("ClientApp", "dist", "glyphicons-halflings-regular.e18bbf611f2a2e43afc0.ttf"), + Path.Combine("ClientApp", "dist", "glyphicons-halflings-regular.f4769f9bdb7466be6508.eot"), + Path.Combine("ClientApp", "dist", "glyphicons-halflings-regular.fa2772327f55d8198301.woff"), + Path.Combine("ClientApp", "dist", "index.html"), + Path.Combine("ClientApp", "dist", "inline.318b50c57b4eba3d437b.bundle.js"), + Path.Combine("ClientApp", "dist", "main.d2eed1593a6df639e365.bundle.js"), + Path.Combine("ClientApp", "dist", "polyfills.bf95165a1d5098766b92.bundle.js"), + Path.Combine("ClientApp", "dist", "styles.2727681ffee5a66f9fe6.bundle.css"), + }); } } diff --git a/AspNetCoreSdkTests/Templates/ClassLibraryTemplate.cs b/AspNetCoreSdkTests/Templates/ClassLibraryTemplate.cs index 70f968defd..e9c702b56a 100644 --- a/AspNetCoreSdkTests/Templates/ClassLibraryTemplate.cs +++ b/AspNetCoreSdkTests/Templates/ClassLibraryTemplate.cs @@ -34,5 +34,12 @@ namespace AspNetCoreSdkTests.Templates $"{Name}.dll", $"{Name}.pdb", }.Select(p => Path.Combine(OutputPath, p)); + + public override IEnumerable ExpectedFilesAfterPublish => new[] + { + $"{Name}.deps.json", + $"{Name}.dll", + $"{Name}.pdb", + }; } } diff --git a/AspNetCoreSdkTests/Templates/ConsoleApplicationTemplate.cs b/AspNetCoreSdkTests/Templates/ConsoleApplicationTemplate.cs index e96fbe5776..682ede5d3b 100644 --- a/AspNetCoreSdkTests/Templates/ConsoleApplicationTemplate.cs +++ b/AspNetCoreSdkTests/Templates/ConsoleApplicationTemplate.cs @@ -22,5 +22,10 @@ namespace AspNetCoreSdkTests.Templates $"{Name}.runtimeconfig.dev.json", $"{Name}.runtimeconfig.json", }.Select(p => Path.Combine(OutputPath, p))); + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + $"{Name}.runtimeconfig.json", + }); } } diff --git a/AspNetCoreSdkTests/Templates/MvcTemplate.cs b/AspNetCoreSdkTests/Templates/MvcTemplate.cs index dae7851d13..0ce15a0f13 100644 --- a/AspNetCoreSdkTests/Templates/MvcTemplate.cs +++ b/AspNetCoreSdkTests/Templates/MvcTemplate.cs @@ -4,7 +4,7 @@ using System.Linq; namespace AspNetCoreSdkTests.Templates { - public class MvcTemplate : RazorApplicationBaseTemplate + public class MvcTemplate : RazorBootstrapJQueryTemplate { public new static MvcTemplate Instance { get; } = new MvcTemplate(); diff --git a/AspNetCoreSdkTests/Templates/RazorApplicationBaseTemplate.cs b/AspNetCoreSdkTests/Templates/RazorApplicationBaseTemplate.cs index 2511cd9d99..dae2095a35 100644 --- a/AspNetCoreSdkTests/Templates/RazorApplicationBaseTemplate.cs +++ b/AspNetCoreSdkTests/Templates/RazorApplicationBaseTemplate.cs @@ -22,5 +22,13 @@ namespace AspNetCoreSdkTests.Templates $"{Name}.runtimeconfig.dev.json", $"{Name}.runtimeconfig.json", }.Select(p => Path.Combine(OutputPath, p))); + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + "appsettings.Development.json", + "appsettings.json", + $"{Name}.runtimeconfig.json", + "web.config", + }); } } diff --git a/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs b/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs index e5de3449c1..7485958551 100644 --- a/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs +++ b/AspNetCoreSdkTests/Templates/RazorBaseTemplate.cs @@ -24,5 +24,11 @@ namespace AspNetCoreSdkTests.Templates $"{Name}.Views.dll", $"{Name}.Views.pdb", }.Select(p => Path.Combine(OutputPath, p))); + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + $"{Name}.Views.dll", + $"{Name}.Views.pdb", + }); } } diff --git a/AspNetCoreSdkTests/Templates/RazorBootstrapJQueryTemplate.cs b/AspNetCoreSdkTests/Templates/RazorBootstrapJQueryTemplate.cs new file mode 100644 index 0000000000..9091939f4a --- /dev/null +++ b/AspNetCoreSdkTests/Templates/RazorBootstrapJQueryTemplate.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace AspNetCoreSdkTests.Templates +{ + public abstract class RazorBootstrapJQueryTemplate : RazorApplicationBaseTemplate + { + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + Path.Combine("wwwroot", "favicon.ico"), + Path.Combine("wwwroot", "css", "site.css"), + Path.Combine("wwwroot", "css", "site.min.css"), + Path.Combine("wwwroot", "images", "banner1.svg"), + Path.Combine("wwwroot", "images", "banner2.svg"), + Path.Combine("wwwroot", "images", "banner3.svg"), + Path.Combine("wwwroot", "js", "site.js"), + Path.Combine("wwwroot", "js", "site.min.js"), + Path.Combine("wwwroot", "lib", "bootstrap", ".bower.json"), + Path.Combine("wwwroot", "lib", "bootstrap", "LICENSE"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap-theme.css"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap-theme.css.map"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap-theme.min.css"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap-theme.min.css.map"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap.css"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap.css.map"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap.min.css"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "css", "bootstrap.min.css.map"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "fonts", "glyphicons-halflings-regular.eot"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "fonts", "glyphicons-halflings-regular.svg"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "fonts", "glyphicons-halflings-regular.ttf"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "fonts", "glyphicons-halflings-regular.woff"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "fonts", "glyphicons-halflings-regular.woff2"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "js", "bootstrap.js"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "js", "bootstrap.min.js"), + Path.Combine("wwwroot", "lib", "bootstrap", "dist", "js", "npm.js"), + Path.Combine("wwwroot", "lib", "jquery", ".bower.json"), + Path.Combine("wwwroot", "lib", "jquery", "LICENSE.txt"), + Path.Combine("wwwroot", "lib", "jquery", "dist", "jquery.js"), + Path.Combine("wwwroot", "lib", "jquery", "dist", "jquery.min.js"), + Path.Combine("wwwroot", "lib", "jquery", "dist", "jquery.min.map"), + Path.Combine("wwwroot", "lib", "jquery-validation", ".bower.json"), + Path.Combine("wwwroot", "lib", "jquery-validation", "LICENSE.md"), + Path.Combine("wwwroot", "lib", "jquery-validation", "dist", "additional-methods.js"), + Path.Combine("wwwroot", "lib", "jquery-validation", "dist", "additional-methods.min.js"), + Path.Combine("wwwroot", "lib", "jquery-validation", "dist", "jquery.validate.js"), + Path.Combine("wwwroot", "lib", "jquery-validation", "dist", "jquery.validate.min.js"), + Path.Combine("wwwroot", "lib", "jquery-validation-unobtrusive", ".bower.json"), + Path.Combine("wwwroot", "lib", "jquery-validation-unobtrusive", "jquery.validate.unobtrusive.js"), + Path.Combine("wwwroot", "lib", "jquery-validation-unobtrusive", "jquery.validate.unobtrusive.min.js"), + Path.Combine("wwwroot", "lib", "jquery-validation-unobtrusive", "LICENSE.txt"), + }); + } +} diff --git a/AspNetCoreSdkTests/Templates/RazorClassLibraryTemplate.cs b/AspNetCoreSdkTests/Templates/RazorClassLibraryTemplate.cs index b252e38ffb..feef3c5bea 100644 --- a/AspNetCoreSdkTests/Templates/RazorClassLibraryTemplate.cs +++ b/AspNetCoreSdkTests/Templates/RazorClassLibraryTemplate.cs @@ -137,5 +137,150 @@ namespace AspNetCoreSdkTests.Templates Path.Combine("refs", "System.Xml.XPath.dll"), Path.Combine("refs", "System.Xml.XPath.XDocument.dll"), }.Select(p => Path.Combine(OutputPath, p))); + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + "Microsoft.AspNetCore.Antiforgery.dll", + "Microsoft.AspNetCore.Authentication.Abstractions.dll", + "Microsoft.AspNetCore.Authentication.Core.dll", + "Microsoft.AspNetCore.Authorization.dll", + "Microsoft.AspNetCore.Authorization.Policy.dll", + "Microsoft.AspNetCore.Cors.dll", + "Microsoft.AspNetCore.Cryptography.Internal.dll", + "Microsoft.AspNetCore.DataProtection.Abstractions.dll", + "Microsoft.AspNetCore.DataProtection.dll", + "Microsoft.AspNetCore.Diagnostics.Abstractions.dll", + "Microsoft.AspNetCore.Hosting.Abstractions.dll", + "Microsoft.AspNetCore.Hosting.Server.Abstractions.dll", + "Microsoft.AspNetCore.Html.Abstractions.dll", + "Microsoft.AspNetCore.Http.Abstractions.dll", + "Microsoft.AspNetCore.Http.dll", + "Microsoft.AspNetCore.Http.Extensions.dll", + "Microsoft.AspNetCore.Http.Features.dll", + "Microsoft.AspNetCore.JsonPatch.dll", + "Microsoft.AspNetCore.Localization.dll", + "Microsoft.AspNetCore.Mvc.Abstractions.dll", + "Microsoft.AspNetCore.Mvc.ApiExplorer.dll", + "Microsoft.AspNetCore.Mvc.Core.dll", + "Microsoft.AspNetCore.Mvc.Cors.dll", + "Microsoft.AspNetCore.Mvc.DataAnnotations.dll", + "Microsoft.AspNetCore.Mvc.dll", + "Microsoft.AspNetCore.Mvc.Formatters.Json.dll", + "Microsoft.AspNetCore.Mvc.Localization.dll", + "Microsoft.AspNetCore.Mvc.Razor.dll", + "Microsoft.AspNetCore.Mvc.Razor.Extensions.dll", + "Microsoft.AspNetCore.Mvc.RazorPages.dll", + "Microsoft.AspNetCore.Mvc.TagHelpers.dll", + "Microsoft.AspNetCore.Mvc.ViewFeatures.dll", + "Microsoft.AspNetCore.Razor.dll", + "Microsoft.AspNetCore.Razor.Language.dll", + "Microsoft.AspNetCore.Razor.Runtime.dll", + "Microsoft.AspNetCore.ResponseCaching.Abstractions.dll", + "Microsoft.AspNetCore.Routing.Abstractions.dll", + "Microsoft.AspNetCore.Routing.dll", + "Microsoft.AspNetCore.WebUtilities.dll", + "Microsoft.CodeAnalysis.CSharp.dll", + "Microsoft.CodeAnalysis.dll", + "Microsoft.CodeAnalysis.Razor.dll", + "Microsoft.CSharp.dll", + "Microsoft.DotNet.PlatformAbstractions.dll", + "Microsoft.Extensions.Caching.Abstractions.dll", + "Microsoft.Extensions.Caching.Memory.dll", + "Microsoft.Extensions.Configuration.Abstractions.dll", + "Microsoft.Extensions.DependencyInjection.Abstractions.dll", + "Microsoft.Extensions.DependencyInjection.dll", + "Microsoft.Extensions.DependencyModel.dll", + "Microsoft.Extensions.FileProviders.Abstractions.dll", + "Microsoft.Extensions.FileProviders.Composite.dll", + "Microsoft.Extensions.FileSystemGlobbing.dll", + "Microsoft.Extensions.Hosting.Abstractions.dll", + "Microsoft.Extensions.Localization.Abstractions.dll", + "Microsoft.Extensions.Localization.dll", + "Microsoft.Extensions.Logging.Abstractions.dll", + "Microsoft.Extensions.ObjectPool.dll", + "Microsoft.Extensions.Options.dll", + "Microsoft.Extensions.Primitives.dll", + "Microsoft.Extensions.WebEncoders.dll", + "Microsoft.Net.Http.Headers.dll", + "Microsoft.Win32.Registry.dll", + "Newtonsoft.Json.Bson.dll", + "Newtonsoft.Json.dll", + Path.Combine("runtimes", "debian.8-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "fedora.23-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "fedora.24-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "opensuse.13.2-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "opensuse.42.1-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "osx", "lib", "netstandard1.6", "System.Security.Cryptography.Algorithms.dll"), + Path.Combine("runtimes", "osx.10.10-x64", "native", "System.Security.Cryptography.Native.Apple.dylib"), + Path.Combine("runtimes", "osx.10.10-x64", "native", "System.Security.Cryptography.Native.OpenSsl.dylib"), + Path.Combine("runtimes", "rhel.7-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "ubuntu.14.04-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "ubuntu.16.04-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "ubuntu.16.10-x64", "native", "System.Security.Cryptography.Native.OpenSsl.so"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.1", "System.Runtime.InteropServices.RuntimeInformation.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.3", "System.Diagnostics.FileVersionInfo.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.3", "System.IO.Compression.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.3", "System.Security.Cryptography.Csp.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.3", "System.Security.Cryptography.Encoding.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.3", "System.Text.Encoding.CodePages.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.6", "System.Security.Cryptography.Algorithms.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.6", "System.Security.Cryptography.OpenSsl.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard1.6", "System.Security.Cryptography.X509Certificates.dll"), + Path.Combine("runtimes", "unix", "lib", "netstandard2.0", "Microsoft.Win32.Registry.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.1", "System.Runtime.InteropServices.RuntimeInformation.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.Diagnostics.FileVersionInfo.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.IO.Compression.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.Security.AccessControl.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.Security.Cryptography.Csp.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.Security.Cryptography.Encoding.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.Security.Principal.Windows.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.3", "System.Text.Encoding.CodePages.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.6", "System.Security.Cryptography.Algorithms.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.6", "System.Security.Cryptography.Cng.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard1.6", "System.Security.Cryptography.X509Certificates.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard2.0", "Microsoft.Win32.Registry.dll"), + Path.Combine("runtimes", "win", "lib", "netstandard2.0", "System.Security.Cryptography.Pkcs.dll"), + "System.AppContext.dll", + "System.Buffers.dll", + "System.Collections.Concurrent.dll", + "System.Collections.Immutable.dll", + "System.ComponentModel.Annotations.dll", + "System.Diagnostics.DiagnosticSource.dll", + "System.Diagnostics.StackTrace.dll", + "System.Dynamic.Runtime.dll", + "System.IO.FileSystem.Primitives.dll", + "System.Linq.dll", + "System.Linq.Expressions.dll", + "System.Memory.dll", + "System.Numerics.Vectors.dll", + "System.ObjectModel.dll", + "System.Reflection.Emit.dll", + "System.Reflection.Emit.ILGeneration.dll", + "System.Reflection.Emit.Lightweight.dll", + "System.Reflection.Metadata.dll", + "System.Reflection.TypeExtensions.dll", + "System.Runtime.CompilerServices.Unsafe.dll", + "System.Runtime.Numerics.dll", + "System.Security.AccessControl.dll", + "System.Security.Cryptography.Cng.dll", + "System.Security.Cryptography.OpenSsl.dll", + "System.Security.Cryptography.Pkcs.dll", + "System.Security.Cryptography.Primitives.dll", + "System.Security.Cryptography.Xml.dll", + "System.Security.Permissions.dll", + "System.Security.Principal.Windows.dll", + "System.Text.Encodings.Web.dll", + "System.Text.RegularExpressions.dll", + "System.Threading.dll", + "System.Threading.Tasks.Extensions.dll", + "System.Threading.Tasks.Parallel.dll", + "System.Threading.Thread.dll", + "System.ValueTuple.dll", + "System.Xml.ReaderWriter.dll", + "System.Xml.XDocument.dll", + "System.Xml.XmlDocument.dll", + "System.Xml.XPath.dll", + "System.Xml.XPath.XDocument.dll", + }); } } diff --git a/AspNetCoreSdkTests/Templates/RazorTemplate.cs b/AspNetCoreSdkTests/Templates/RazorTemplate.cs index afb798924a..497f560878 100644 --- a/AspNetCoreSdkTests/Templates/RazorTemplate.cs +++ b/AspNetCoreSdkTests/Templates/RazorTemplate.cs @@ -4,7 +4,7 @@ using System.Linq; namespace AspNetCoreSdkTests.Templates { - public class RazorTemplate : RazorApplicationBaseTemplate + public class RazorTemplate : RazorBootstrapJQueryTemplate { public new static RazorTemplate Instance { get; } = new RazorTemplate(); diff --git a/AspNetCoreSdkTests/Templates/ReactReduxTemplate.cs b/AspNetCoreSdkTests/Templates/ReactReduxTemplate.cs index cae30beb03..4741a5449d 100644 --- a/AspNetCoreSdkTests/Templates/ReactReduxTemplate.cs +++ b/AspNetCoreSdkTests/Templates/ReactReduxTemplate.cs @@ -1,4 +1,7 @@ -namespace AspNetCoreSdkTests.Templates +using System.Collections.Generic; +using System.Linq; + +namespace AspNetCoreSdkTests.Templates { public class ReactReduxTemplate : ReactTemplate { @@ -7,5 +10,9 @@ protected ReactReduxTemplate() { } public override string Name => "reactredux"; + + public override IEnumerable ExpectedFilesAfterPublish => + from f in base.ExpectedFilesAfterPublish + select f.Replace("main.31eb739b.js", "main.485d93fa.js"); } } diff --git a/AspNetCoreSdkTests/Templates/ReactTemplate.cs b/AspNetCoreSdkTests/Templates/ReactTemplate.cs index 207a31e624..79dd2b2180 100644 --- a/AspNetCoreSdkTests/Templates/ReactTemplate.cs +++ b/AspNetCoreSdkTests/Templates/ReactTemplate.cs @@ -1,4 +1,8 @@ -namespace AspNetCoreSdkTests.Templates +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace AspNetCoreSdkTests.Templates { public class ReactTemplate : SpaBaseTemplate { @@ -7,5 +11,23 @@ protected ReactTemplate() { } public override string Name => "react"; + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + Path.Combine("ClientApp", "build", "asset-manifest.json"), + Path.Combine("ClientApp", "build", "favicon.ico"), + Path.Combine("ClientApp", "build", "index.html"), + Path.Combine("ClientApp", "build", "manifest.json"), + Path.Combine("ClientApp", "build", "service-worker.js"), + Path.Combine("ClientApp", "build", "static", "css", "main.8302bbea.css"), + Path.Combine("ClientApp", "build", "static", "css", "main.8302bbea.css.map"), + Path.Combine("ClientApp", "build", "static", "js", "main.31eb739b.js"), + Path.Combine("ClientApp", "build", "static", "js", "main.31eb739b.js.map"), + Path.Combine("ClientApp", "build", "static", "media", "glyphicons-halflings-regular.448c34a5.woff2"), + Path.Combine("ClientApp", "build", "static", "media", "glyphicons-halflings-regular.89889688.svg"), + Path.Combine("ClientApp", "build", "static", "media", "glyphicons-halflings-regular.e18bbf61.ttf"), + Path.Combine("ClientApp", "build", "static", "media", "glyphicons-halflings-regular.f4769f9b.eot"), + Path.Combine("ClientApp", "build", "static", "media", "glyphicons-halflings-regular.fa277232.woff"), + }); } } diff --git a/AspNetCoreSdkTests/Templates/SpaBaseTemplate.cs b/AspNetCoreSdkTests/Templates/SpaBaseTemplate.cs index 6086264103..5745f3effc 100644 --- a/AspNetCoreSdkTests/Templates/SpaBaseTemplate.cs +++ b/AspNetCoreSdkTests/Templates/SpaBaseTemplate.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; namespace AspNetCoreSdkTests.Templates { diff --git a/AspNetCoreSdkTests/Templates/Template.cs b/AspNetCoreSdkTests/Templates/Template.cs index 07a6adc954..cb255cdf17 100644 --- a/AspNetCoreSdkTests/Templates/Template.cs +++ b/AspNetCoreSdkTests/Templates/Template.cs @@ -20,6 +20,8 @@ namespace AspNetCoreSdkTests.Templates public abstract IEnumerable ExpectedBinFilesAfterBuild { get; } + public abstract IEnumerable ExpectedFilesAfterPublish { get; } + public override string ToString() => Name; } } diff --git a/AspNetCoreSdkTests/Templates/WebApiTemplate.cs b/AspNetCoreSdkTests/Templates/WebApiTemplate.cs index 21d98d9f71..cd17786c4a 100644 --- a/AspNetCoreSdkTests/Templates/WebApiTemplate.cs +++ b/AspNetCoreSdkTests/Templates/WebApiTemplate.cs @@ -1,4 +1,7 @@ -namespace AspNetCoreSdkTests.Templates +using System.Collections.Generic; +using System.Linq; + +namespace AspNetCoreSdkTests.Templates { public class WebApiTemplate : WebTemplate { @@ -9,5 +12,11 @@ public override string Name => "webapi"; public override string RelativeUrl => "/api/values"; + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + "appsettings.Development.json", + "appsettings.json", + }); } } diff --git a/AspNetCoreSdkTests/Templates/WebTemplate.cs b/AspNetCoreSdkTests/Templates/WebTemplate.cs index fb91b68953..72e1233121 100644 --- a/AspNetCoreSdkTests/Templates/WebTemplate.cs +++ b/AspNetCoreSdkTests/Templates/WebTemplate.cs @@ -20,5 +20,10 @@ namespace AspNetCoreSdkTests.Templates $"{Name}.RazorAssemblyInfo.cs", $"{Name}.RazorTargetAssemblyInfo.cache", }.Select(p => Path.Combine(OutputPath, p))); + + public override IEnumerable ExpectedFilesAfterPublish => Enumerable.Concat(base.ExpectedFilesAfterPublish, new[] + { + "web.config", + }); } } diff --git a/AspNetCoreSdkTests/Util/DotNetContext.cs b/AspNetCoreSdkTests/Util/DotNetContext.cs index f1eb24b044..faed3ed1ea 100644 --- a/AspNetCoreSdkTests/Util/DotNetContext.cs +++ b/AspNetCoreSdkTests/Util/DotNetContext.cs @@ -49,6 +49,11 @@ namespace AspNetCoreSdkTests.Util } } + public string Publish() + { + return DotNetUtil.Publish(Path); + } + public IEnumerable GetObjFiles() { return IOUtil.GetFiles(System.IO.Path.Combine(Path, "obj")); @@ -59,6 +64,11 @@ namespace AspNetCoreSdkTests.Util return IOUtil.GetFiles(System.IO.Path.Combine(Path, "bin")); } + public IEnumerable GetPublishFiles() + { + return IOUtil.GetFiles(System.IO.Path.Combine(Path, DotNetUtil.PublishOutput)); + } + public override void Dispose() { // Must stop process to release filehandles before calling base.Dispose() which deletes app dir diff --git a/AspNetCoreSdkTests/Util/DotNetUtil.cs b/AspNetCoreSdkTests/Util/DotNetUtil.cs index eba8e00efc..ffe59f3385 100644 --- a/AspNetCoreSdkTests/Util/DotNetUtil.cs +++ b/AspNetCoreSdkTests/Util/DotNetUtil.cs @@ -9,6 +9,8 @@ namespace AspNetCoreSdkTests.Util { internal static class DotNetUtil { + public static string PublishOutput => "pub"; + private static IEnumerable> GetEnvironment(string workingDirectory) { // Set NUGET_PACKAGES to an empty folder to ensure all packages are loaded from either NuGetFallbackFolder or configured sources, @@ -38,6 +40,11 @@ namespace AspNetCoreSdkTests.Util return StartDotNet("run --no-restore --urls http://127.0.0.1:0;https://127.0.0.1:0", workingDirectory, GetEnvironment(workingDirectory)); } + public static string Publish(string workingDirectory) + { + return RunDotNet($"publish --no-restore -o {PublishOutput}", workingDirectory, GetEnvironment(workingDirectory)); + } + private static string RunDotNet(string arguments, string workingDirectory, IEnumerable> environment = null, bool throwOnError = true) {