In my model project, I have a service interface IMyService and default implementation DefaultMyService. This service is used by my entities. In my unit tests, I would like to create a different implementation (TestMyService), and my entities should use that implementation during the unit tests. How can I instruct the IoC container to return TestMyService in my unit tests? |
Hello Ara, For now, there is no any option to set a service implementation as default one. But there is a solution that will definitely work. As you know, in domain configuration you can register an assembly or a part of an assembly, limited by a namespace, or two, or many. So, I'd recommend you to move each of these two services into separate namespaces and register required namespace depending on the environment you are using (production, testing). Hope that helps. I'll post on how to configure services through app.config soon. Hi Dmitri, any update on this? Making a sample for you... Ara, I've uploaded the sample about manual service registration to our new sample repository. Hope that helps. |
Currently, we are investigating the case. It might take a while.