Skip to content

NUnit1001 - false positive for arguments with nullable enum parameters #939

@maksim-sovkov

Description

@maksim-sovkov
public class Tests
{
    public enum TestEnum { A, B, C }

    [TestCase(null)]
    public void Test1(TestEnum? e)
    {
        Assert.Pass();
    }

    [TestCase(TestEnum.A)]
    public void Test2(TestEnum? e)
    {
        Assert.Pass();
    }
}
error NUnit1001: The value of the argument at position '0' of type <null> cannot be assigned to the parameter 'e' of type TestProject1.Tests.TestEnum? (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit1001.md)
error NUnit1001: The value of the argument at position '0' of type TestProject1.Tests.TestEnum cannot be assigned to the parameter 'e' of type TestProject1.Tests.TestEnum? (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit1001.md)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions