Skip to content

Compile error when test argument is nullable #3170

@robertcoltheart

Description

@robertcoltheart

The following test fails to compile:

public class Class1
{
    [Test]
    [Arguments(1, 1)]
    [Arguments(1, null)]
    public async Task TestCase(decimal v1, decimal? v2)
    {
        await Assert.That(v1).IsEqualTo(v2.GetValueOrDefault());
    }
}

Compile error is:

Class1_TestCase_f103a4933a624f96920902ad73ebaaa7.g.cs(37,63,37,65): error CS0103: The name 'nm' does not exist in the current context

This is a regression, since this test works fine in 0.59.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions