devlooped / moq

The most popular and friendly mocking framework for .NET
Other
5.94k stars 802 forks source link

Should allow null references as constructor parameters. #1416

Open WalkerCodeRanger opened 1 year ago

WalkerCodeRanger commented 1 year ago

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

stakx commented 1 year ago

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.

github-actions[bot] commented 2 months ago

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.