You can use a IHandlerSelector to override specific registrations (see
http://kozmic.net/2009/12/07/overriding-generic-componentrsquos-resolution-in-castle-windsor/
for an example of using a selector, yours would be different of course)

As a side comment - testing the configuration is a novel idea. I am not
sure that a unit test is were you would best test something that is an
integration by nature, especially when you are mucking about with the thing
under test itself (the container registry). Leave that to integration or
system testing.



Ken Egozi.
http://kenegozi.com/ <http://kenegozi.com/blog>

On Thu, Sep 7, 2017 at 1:32 AM, Xi Shen <davidshe...@gmail.com> wrote:

> Hi Ken,
>
> My scenario is, I want to use DI in my unit test, and I need to override
> some dependency with mock instance.
>
> I know some people say we should not use DI in unit test. But I think unit
> test can also be used to verify if the DIs are configured correctly.
>
>
> I would also like to learn a better way to very DI configuration in real
> product scenario.
>
>
> Thanks,
> David
>
>
> On Thu, Sep 7, 2017 at 2:01 PM Ken Egozi <egoz...@gmail.com> wrote:
>
>> So much time since I last touched child containers...
>>
>>
>> Once resolution went up to the parent container it would not go back to
>> resolve from the child as the direction is one way.
>>
>> The right question to be answered is "what is your scenario?" Experience
>> shows that more often than not, a conceptually simpler solution can be had
>> that does not involve child containers.
>>
>> On Sep 6, 2017 8:01 PM, "Xi Shen" <davidshe...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Is Child container still in use in Windsor 4.0? I had some issue using
>>> child container, and opened an ticket https://github.com/
>>> castleproject/Windsor/issues/323, but nobody replies...I wonder if I am
>>> using some obsolete technique that nobody cares.
>>>
>>> If child container is obsolete, what is the modern replacement?
>>>
>>>
>>> Thanks,
>>> David
>>>
>>> --
>>>
>> You received this message because you are subscribed to the Google Groups
>>> "Castle Project Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to castle-project-users+unsubscr...@googlegroups.com.
>>
>>
>>> To post to this group, send email to castle-project-users@
>>> googlegroups.com.
>>> Visit this group at https://groups.google.com/group/castle-project-users
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Castle Project Users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/castle-project-users/RH28ZoTfwxQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> castle-project-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to castle-project-users@
>> googlegroups.com.
>> Visit this group at https://groups.google.com/group/castle-project-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to