React to Razor changes

This commit is contained in:
Pranav K 2017-03-22 19:58:46 -07:00
parent 705c36921a
commit f3ee4064a2
1 changed files with 22 additions and 16 deletions

View File

@ -38,11 +38,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
Assert.Equal(viewPath, failure.SourceFilePath); Assert.Equal(viewPath, failure.SourceFilePath);
Assert.Collection(failure.Messages, Assert.Collection(failure.Messages,
message => Assert.StartsWith( message => Assert.StartsWith(
@"(1,22): Error RZ9999: Unterminated string literal.", @"Unterminated string literal.",
message.FormattedMessage), message.Message),
message => Assert.StartsWith( message => Assert.StartsWith(
@"(1,14): Error RZ9999: The explicit expression block is missing a closing "")"" character.", @"The explicit expression block is missing a closing "")"" character.",
message.FormattedMessage)); message.Message));
} }
[Fact] [Fact]
@ -141,21 +141,27 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
var compilationResult = compiler.GetCompilationFailedResult(codeDocument, csharpDocument.Diagnostics); var compilationResult = compiler.GetCompilationFailedResult(codeDocument, csharpDocument.Diagnostics);
// Assert // Assert
// This expectation is incorrect. https://github.com/aspnet/Razor/issues/1069 needs to be fixed, Assert.Collection(
// which should cause this test to fail. compilationResult.CompilationFailures,
var failure = Assert.Single(compilationResult.CompilationFailures); failure =>
Assert.Equal(viewPath, failure.SourceFilePath);
Assert.Collection(failure.Messages,
message =>
{ {
Assert.Equal(@"A space or line break was encountered after the ""@"" character. Only valid identifiers, keywords, comments, ""("" and ""{"" are valid at the start of a code block and they must occur immediately following ""@"" with no space in between.", Assert.Equal(viewPath, failure.SourceFilePath);
message.Message); Assert.Collection(failure.Messages,
message =>
{
Assert.Equal(@"A space or line break was encountered after the ""@"" character. Only valid identifiers, keywords, comments, ""("" and ""{"" are valid at the start of a code block and they must occur immediately following ""@"" with no space in between.",
message.Message);
});
}, },
message => failure =>
{ {
Assert.Equal(@"The explicit expression block is missing a closing "")"" character. Make sure you have a matching "")"" character for all the ""("" characters within this block, and that none of the "")"" characters are being interpreted as markup.", Assert.Equal(importsFilePath, failure.SourceFilePath);
message.Message); Assert.Collection(failure.Messages,
message =>
{
Assert.Equal(@"The explicit expression block is missing a closing "")"" character. Make sure you have a matching "")"" character for all the ""("" characters within this block, and that none of the "")"" characters are being interpreted as markup.",
message.Message);
});
}); });
} }