A technique to mock "static interfaces" (e.g. isInputRange)

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Thu May 26 02:44:05 PDT 2016


On Thursday, 26 May 2016 at 08:08:01 UTC, Gary Willoughby wrote:
> On Wednesday, 25 May 2016 at 21:38:23 UTC, Atila Neves wrote:
>> There was talk in the forum of making it easier to come up 
>> instantiations of say, an input range for testing purposes. 
>> That got me thinking of how mocking frameworks make it easy to 
>> pass in dependencies without having to write a whole new "test 
>> double" type oneself. How would one do that for what I've 
>> started calling "static interfaces"? How would one mock an 
>> input range?
>
> I have a mocking framework here:
>
> https://github.com/nomad-software/dunit
>
> Maybe that is useful? The only problem with mine is that it 
> needs to be injected inside an interface. Like this:

That's a showstopper for me.

Atila


More information about the Digitalmars-d mailing list