Describe alternatives you've considered
This idea came from a comment in my C# video from VSLive Las Vegas - https://www.youtube.com/watch?v=pEfHF9l98Ho. Basically, create an extension method on the type that we want to mock, and effectively "hide" the name of the expectation type:
var expectations = IPersonRepository.CreateExpectations();
I like this. It's no longer necessary to remember the name of the expectation type. Granted, this is really close to the currently generated name, but I think it reads better. And it lets me change the type of the expectations.
It's unfortunate that file scope can only be applied to a type, because I could make it where the expectations type can be seen by callers but can't be created. Maybe there's another way to do that.
Describe alternatives you've considered
This idea came from a comment in my C# video from VSLive Las Vegas - https://www.youtube.com/watch?v=pEfHF9l98Ho. Basically, create an extension method on the type that we want to mock, and effectively "hide" the name of the expectation type:
I like this. It's no longer necessary to remember the name of the expectation type. Granted, this is really close to the currently generated name, but I think it reads better. And it lets me change the type of the expectations.
It's unfortunate that
filescope can only be applied to a type, because I could make it where the expectations type can be seen by callers but can't be created. Maybe there's another way to do that.