Skip to content

False positive on NUnit2050 #901

@dfev77

Description

@dfev77

We are using a helper like the one below, and we get an NUnit2050 error (NUnit 4 no longer supports string.Format specification for Assert)
As you see we are just setting some predefined timeout&retry interval on Assert.That
Wonder if the analyzer could be enhanced to not treat such cases as a violation on NUnit2050.

    public static Desk AssertThat<TWindow>(
        this Desk desk,
        Func<TWindow, object> valueProvider,
        IConstraint expression,
        NUnitString message = default,
        [CallerArgumentExpression(nameof(valueProvider))] string actualExpression = "",
        [CallerArgumentExpression(nameof(expression))] string constraintExpression = ""
        ) where TWindow : DeskWindow
    {
        var window = desk.Capture<TWindow>();

        Assert.That(
            (ActualValueDelegate<object>)(() => valueProvider.Invoke(window)),
            new DelayedConstraint(expression, 3000, 300,
            message, actualExpression, constraintExpression);

        return desk;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions