I ran into a rather hairy problem. This may be a simple solution, but I cannot find it!
I have a custom HttpHandler that I want to process the request, register certain information, and then enter the data into the database. I use NUnit and Castle Windsor.
So, I have two interfaces; one for registering another for data entry, which is entered by the constructor. I quickly discovered that there was no way to invoke the constructor, because instead of it, the constructor without parameters was always called.
So I thought I would use Setter injection and let Castle Windsor figure it out. This really works when I use container.Resolve<CustomHttpHandler>(); I can check that the logger is not null. (In Application_Start in Global.asax.cs)
The problem is that Castle Windsor can create an instance that the http application isnโt using ???? I think?
Basically, this whole reason was to test the data logger and data repository code in isolation by mocking and unit testing.
Any ideas how I can solve this problem?
Thanks!
Matt
source share