Skip to content

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

@drdamour

Description

@drdamour

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions