From be1400663b39d4df30ff725dd6728cb5bffa901f Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Sun, 18 Feb 2018 23:54:12 +0000 Subject: [PATCH] Unit test to show the Razor compiler passes through any C# compilation errors --- .../RazorCompilerTest.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/RazorCompilerTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/RazorCompilerTest.cs index d042857d72..8fc9adab43 100644 --- a/test/Microsoft.AspNetCore.Blazor.Build.Test/RazorCompilerTest.cs +++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/RazorCompilerTest.cs @@ -421,6 +421,21 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test frame => AssertFrame.Text(frame, "Hello")); } + [Fact] + public void SurfacesCSharpCompilationErrors() + { + // Arrange/Act + var result = CompileToAssembly( + GetArbitraryPlatformValidDirectoryPath(), + "file.cshtml", + "@invalidVar", + "Test.Base"); + + // Assert + Assert.Collection(result.Diagnostics, + diagnostic => Assert.Contains("'invalidVar'", diagnostic.GetMessage())); + } + private static RenderTreeFrame[] GetRenderTree(IComponent component) { var renderer = new TestRenderer();