[Test]
public void Test()
{
var c = new WindsorContainer();
var myFacilty = new MyFacilty();
c.AddFacility("my", myFacilty);
c.Register(Component.For<A>());
Assert.AreEqual(HandlerState.WaitingDependency,
myFacilty.Handlers["Tests.A"].CurrentState);
c.Register(Component.For<B>().Instance(new B()));
Assert.AreEqual(HandlerState.Valid,
myFacilty.Handlers["Tests.A"].CurrentState);
var a = c.Resolve<A>();
Assert.IsTrue(myFacilty.OnHandlerStateChangedWasCalled,
"OnHandlerStateChanged was not raised");
}
//Classes used in test
namespace Tests
{
public class MyFacilty : AbstractFacility
{
public MyFacilty()
{
Handlers = new Dictionary<string, IHandler>();
}
protected override void Init()
{
Kernel.ComponentRegistered += KernelOnComponentRegistered;
}
private void KernelOnComponentRegistered(string key, IHandler
handler)
{
Handlers.Add(key, handler);
if (handler.CurrentState ==
HandlerState.WaitingDependency)
{
handler.OnHandlerStateChanged +=
onHandlerStateChanged;
}
}
private void onHandlerStateChanged(object source, EventArgs
args)
{
Console.WriteLine("onHandlerStateChanged");
}
public bool OnHandlerStateChangedWasCalled { get; set; }
public Dictionary<string, IHandler> Handlers { get; set; }
}
public struct B
{
}
public class A
{
public A(B b)
{
}
}
}
private void onHandlerStateChanged(object source, EventArgs args)
{
OnHandlerStateChangedWasCalled = true;
--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
On Mar 29, 4:29 pm, Michael Davis <nerei...@gmail.com> wrote:
> I suspect that this may be the same problem I posted about on March 4
> ("Strange behavior with StartableFacility"), IOC-ISSUE-195. If everything
> works as expected if you use c.AddComponent() to register your components
> instead of the c.Register() fluent interface, then it's definitely the same
> problem (and that can be a workaround you can use until it's fixed).
>
> I suggested a potential fix for the issue and offered to submit a patch, but
> I never heard back from anyone about what the preferred method for doing
> that would be since the code was moved to github.
>
> Michael Davis
>
> > castle-project-u...@googlegroups.com<castle-project-users%2Bun subs...@googlegroups.com>
Konstantin,
I will take a look at it this week. Thanks for the test case.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
We're still working on updating the website for Git usage:
http://groups.google.com/group/castle-project-devel/browse_thread/thread/b952d0d87bef02ba#
If there's anything you feel would be beneficial to add or clarify,
speak up ;)
Krzysztof
On 29 Mar, 15:55, Michael Davis <nerei...@gmail.com> wrote:
> I was just trying to find out if that was now the preferred method of
> submitting patches instead of attaching them to the case in Donjon. Thank
> you for clarifying that.
>
> 2010/3/29 Krzysztof Koźmic (2) <krzysz...@kozmic.pl>
> > > > > castle-project-u...@googlegroups.com<castle-project-users%2Bunsu...@googlegroups.com><castle-project-users%2Bun
> > subs...@googlegroups.com>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/castle-project-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Castle Project Users" group.
> > To post to this group, send email to castle-pro...@googlegroups.com
> > .
> > To unsubscribe from this group, send email to
> > castle-project-u...@googlegroups.com<castle-project-users%2Bunsu...@googlegroups.com>
tim
On Mar 29, 7:29 am, Michael Davis <nerei...@gmail.com> wrote:
> I suspect that this may be the same problem I posted about on March 4
> ("Strange behavior with StartableFacility"), IOC-ISSUE-195. If everything
> works as expected if you use c.AddComponent() to register your components
> instead of the c.Register() fluent interface, then it's definitely the same
> problem (and that can be a workaround you can use until it's fixed).
>
> I suggested a potential fix for the issue and offered to submit a patch, but
> I never heard back from anyone about what the preferred method for doing
> that would be since the code was moved to github.
>
> Michael Davis
>
> > castle-project-u...@googlegroups.com<castle-project-users%2Bun subs...@googlegroups.com>