lundi 22 février 2016

Cannot isolate code with MS Fakes - UT

I have question, I cannot isolate private constructor. It's of course singleton.

class Car : ICar {}
class CarMock : ICar {}

In my unit test I use my mocked class - CarMock, followed by unfortunatly I have to isolate my singleton - Car.Instance, so I'd like to use shim:

ShimCar.InstanceGet = () => new CarMock { InstanceBehaviors = ShimBehaviors.DefaultValue }

As you can guess, it is refactoring from Moles to Fakes. I can't understand, why my isolate don't work. The part of code which I'd like to isolate is completly overlooked during debugging. By the way, on msdn I can't find any information about that or about 'DefaultValue'. I know that Moles != Fakes, but I suppose the Fakes lost any module in his engine. What's going on ? Is it any bug in runtime ?? Thanks for any help.

VS2013, update 5.

Aucun commentaire:

Enregistrer un commentaire