Csla 5 + DI + Testing #2779
-
Hello, Just wondering how to set up unit tests with dependency injection. Another thing, when using the business objects in an WPF project, where should I set up the services. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Have a look at the Csla.Tests project in the main branch of the repo for examples of how to do DI for tests. We don't really need samples when we have a test suite that uses the technique for real. You need DI less when using Csla 5, but that's not to say you don't need it. The principles are the same for both versions. WPF isn't my thing, but configuration will follow the conventions for whatever host you are running. It's a WPF question rather than a CSLA question, unless I'm missing the point. |
Beta Was this translation helpful? Give feedback.
-
But if i have this kind of fetc how do i make a test for it when the resourcedal needs to be injected?
The test method something like this:
The dal needs to be injected so the test method obviously doesn't work. |
Beta Was this translation helpful? Give feedback.
But if i have this kind of fetc how do i make a test for it when the resourcedal needs to be injected?
The test method something like this: