示例#1
0
    public void DefaultRazorDiagnostic_GetMessage_WithArgs_FormatProvider()
    {
        // Arrange
        var descriptor = new RazorDiagnosticDescriptor("RZ0000", () => "this is an {0}", RazorDiagnosticSeverity.Error);
        var span       = new SourceSpan("test.cs", 15, 1, 8, 5);

        var diagnostic = new DefaultRazorDiagnostic(descriptor, span, new object[] { 1.3m });

        // Act
        var result = diagnostic.GetMessage(new CultureInfo("fr-FR"));

        // Assert
        Assert.Equal("this is an 1,3", result);
    }
示例#2
0
    public void DefaultRazorDiagnostic_GetMessage_WithArgs()
    {
        // Arrange
        var descriptor = new RazorDiagnosticDescriptor("RZ0000", () => "this is an {0}", RazorDiagnosticSeverity.Error);
        var span       = new SourceSpan("test.cs", 15, 1, 8, 5);

        var diagnostic = new DefaultRazorDiagnostic(descriptor, span, new[] { "error" });

        // Act
        var result = diagnostic.GetMessage(CultureInfo.CurrentCulture);

        // Assert
        Assert.Equal("this is an error", result);
    }