Skip to content

Mock.Of<T>().Get(); #6

Answered by ashmind
jsk95 asked this question in Q&A
Discussion options

You must be logged in to vote

The main one is that you have to have specific types for Setup and Calls.
Those specific types cannot be returned from a generic, Of<T> can only return either T or X<T>, and there is no way for either to provide a custom surface.

However I found a better idea than Get (which might be more reusable too), so I am going to try it out.

It will look like this:

[assembly: MockTypesInAssemblyOf(typeof(IParser), ...)]

using ParserNamespace.Mocks;

var parser = new MockIParser();

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jsk95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3 on April 04, 2021 21:06.