Skip to content

[Bug]: Mocking of interfaces using parameters called @event fails #5083

Closed

Description

@Kununa

Description

When trying to mock an interface with Mock.Of<Interface> and any method contains @event as a parameter name, the mocking fails. The problem probably also appears when using other keywords that are escaped with @

Expected Behavior

Successful compilation

Actual Behavior

Compiler Errors

Steps to Reproduce

Try to mock this interface:

public interface ITest
{
    void Test(string @event);
}

TUnit Version

1.18.21-beta

.NET Version

.NET 10.0

Operating System

Windows

IDE / Test Runner

JetBrains Rider

Error Output / Stack Trace

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Activity

  1. added a commit that references this issue on Mar 6, 2026
    255e639
  2. added a commit that references this issue on Mar 6, 2026
    028ff85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions