mardi 5 juillet 2016

WcfOperationLifestyle simple injector unit test

How can I unit test an injection for WcfOperationLifestyle container? I have in my MyBootstrapper class

container = new Container();    
container.Options.DefaultScopedLifestyle = new WcfOperationLifestyle();
...
container.Register<IService, Service>(Lifestyle.Scoped);

according to http://ift.tt/29MkoPT ,but when I unit test

var actual = MyBootstrapper.Container.GetInstance<IService>();

I get

The IService is registered as 'WCF Operation' lifestyle, but the instance is requested outside the context of a WCF Operation. which totally makes sense since the test run is not a WCF environment.

Aucun commentaire:

Enregistrer un commentaire