moq icon indicating copy to clipboard operation
moq copied to clipboard

Should allow null references as constructor parameters.

Open WalkerCodeRanger opened this issue 2 years ago • 2 comments

The overloads of new Mock<T>() that take params object[] args to pass on to the constructor of the class ought to allow null arguments (e.g. object?[] args).

Back this issue Back this issue

WalkerCodeRanger avatar Sep 03 '23 18:09 WalkerCodeRanger

null is definitely allowed, see e.g. here:

https://github.com/moq/moq/blob/06d88ec526b2d879fa3520e4daed3abcd451953e/src/Moq/Mock%601.cs#L305-L308

What is missing, however, are nullable reference type annotations in all of Moq's public API. It would be nice to add those sometime.

P.S.: regarding these annotations, I've opened a separate issue for them; see #1418.

stakx avatar Sep 04 '23 11:09 stakx

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

github-actions[bot] avatar Aug 24 '24 20:08 github-actions[bot]

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

github-actions[bot] avatar Apr 05 '25 01:04 github-actions[bot]

This issue will now be closed since it has been labeled 'stale' without activity for 30 days.

github-actions[bot] avatar May 05 '25 01:05 github-actions[bot]