From dc32f8ae33bbbb824d11aa6822800f99454b0a3c Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 27 Oct 2015 16:27:44 -0700 Subject: [PATCH] PR comments: Restore most of `PrecompilationTest.PrecompiledView_RendersCorrectly()` --- .../HtmlGenerationTest.cs | 1 - .../PrecompilationTest.cs | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/HtmlGenerationTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/HtmlGenerationTest.cs index 3d7da9b686..b84c43cdea 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/HtmlGenerationTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/HtmlGenerationTest.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/PrecompilationTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/PrecompilationTest.cs index 0f5a9e14f1..deaaacd734 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/PrecompilationTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/PrecompilationTest.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Net; using System.Net.Http; using System.Reflection; using System.Threading.Tasks; @@ -22,6 +23,27 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests public HttpClient Client { get; } + [ConditionalFact] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + public async Task PrecompiledView_RendersCorrectly() + { + // Arrange + // We will render a view that writes the fully qualified name of the Assembly containing the type of + // the view. If the view is precompiled, this assembly will be PrecompilationWebsite. + var assemblyNamePrefix = GetAssemblyNamePrefix(); + + // Act + var response = await Client.GetAsync("http://localhost/Home/Index"); + var responseContent = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + var parsedResponse1 = new ParsedResponse(responseContent); + Assert.StartsWith(assemblyNamePrefix, parsedResponse1.ViewStart); + Assert.StartsWith(assemblyNamePrefix, parsedResponse1.Layout); + Assert.StartsWith(assemblyNamePrefix, parsedResponse1.Index); + } + [Fact] public async Task PrecompiledView_UsesCompilationOptionsFromApplication() {