Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using constant variable in [Argument()] fails to compile #3348

Copy link
Copy link

Description

@AlexandreBossard
Issue body actions

I've replied to a close ticket here #2764 (comment)

but here the issue:
Since 0.64.0.
This snippet fails to compile:

public class ServiceTests
{
    private const int BatchSize = 42;

    [Test]
    [Arguments(BatchSize)]
    public async Task TestMethod(decimal batchingSize)
    {
       // Test code
    }
}
error CS0103: The name 'BatchSizem' does not exist in the current context   # <- note the extra "m"
error CS0103: The name 'BatchSize' does not exist in the current context

The code generation fails to recognize this is a named constant a suffixes it with the decimal literal.

Reactions are currently unavailable

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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.