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

        var diagnostic1 = new DefaultRazorDiagnostic(descriptor, span, new object[0]);
        var diagnostic2 = new DefaultRazorDiagnostic(descriptor, span, new object[0]);

        // Act
        var result = diagnostic1.Equals(diagnostic2);

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

        var diagnostic1 = new DefaultRazorDiagnostic(descriptor, span1, new object[0]);
        var diagnostic2 = new DefaultRazorDiagnostic(descriptor, span2, new object[0]);

        // Act
        var result = diagnostic1.Equals(diagnostic2);

        // Assert
        Assert.False(result);
    }