Skip to content
New issue

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

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

Already on GitHub? # to your account

Could we add Verify methods to IMock<T>? #1538

Open
drdamour opened this issue Feb 26, 2025 · 0 comments
Open

Could we add Verify methods to IMock<T>? #1538

drdamour opened this issue Feb 26, 2025 · 0 comments

Comments

@drdamour
Copy link

drdamour commented Feb 26, 2025

ignoring the opinion we shouldn't verify loggers...we do... ILogger<X> implements ILogger and IMock<ILogger<X>> can be cast to IMock<ILogger> since T is covariant in IMock<T> but the helper extension methods we have for IMock<ILogger> use Verify methods...which are not on IMock<T> just Mock<T>.

As such we've had to dupe all our helper methods one set for Mock<ILogger> and a 2nd for Mock<ILogger<T>> which i mean...who cares but wondering if we can go a little DRYer in the implementation.

So wondering if there's a reason the Verify methods aren't on IMock<T>

initial glance all the Verify signatures look ok for IMock, but since this wasn't done i'm guessing there was a reason...but i didn't stumble upon it with an hour of searching so either i suck at searching or it's not mentioned as to why it was skipped or i'm really the first to consider it (most unlikely).

If it's about other implementations of IMock not wanted to support verify would u consider an IVerifiableMock<T> in the hierarchy, or would that be too much to maintain. totally get that.

looking forward to insights, thanks!

Back this issue
Back this issue

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant