Unit test to show the Razor compiler passes through any C# compilation errors

This commit is contained in:
Steve Sanderson 2018-02-18 23:54:12 +00:00
parent 782ca0137d
commit be1400663b
1 changed files with 15 additions and 0 deletions

View File

@ -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();