Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arg.Any<Arg.AnyType>() does not match arguments passed by reference #787

Open
GianvitoDifilippo opened this issue Mar 13, 2024 · 0 comments

Comments

@GianvitoDifilippo
Copy link

Describe the bug
Arg.Any<Arg.AnyType>() does not match arguments passed by reference

To Reproduce

IMyService service = Substitute.For<IMyService>();
MyArgument arg = new();
service.MyMethod(ref arg);

// The following line throws.
service.Received().MyMethod(ref Arg.Any<Arg.AnyType>());

public interface IMyService
{
  void MyMethod<T>(ref T argument);
}

private class MyArgument { }

Expected behaviour
Arg.Any<Arg.AnyType>() should match arguments passed by reference

Environment:

  • NSubstitute version: 5.1.0
  • NSubstitute.Analyzers version: 1.0.17
  • Platform: net8.0 on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant