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

Should allow null references as constructor parameters. #1416

Open
WalkerCodeRanger opened this issue Sep 3, 2023 · 2 comments
Open

Should allow null references as constructor parameters. #1416

WalkerCodeRanger opened this issue Sep 3, 2023 · 2 comments

Comments

@WalkerCodeRanger
Copy link

WalkerCodeRanger commented Sep 3, 2023

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
Copy link
Contributor

stakx commented Sep 4, 2023

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.

Copy link

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 github-actions bot added the stale label Aug 24, 2024
@github-actions github-actions bot removed the stale label Sep 3, 2024
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

2 participants