protected override void EstablishContext() { container = new WindsorContainer(); // Add the facility, capturing a reference so we can "Finalize" it ChainOfResponsibilityFacility facility = null; container.AddFacility <ChainOfResponsibilityFacility>(f => facility = f); // Perform all registrations of links in the chain using the standard approach container.Register( Classes.FromThisAssembly() .BasedOn <ISomethingProvider>() .WithService .FromInterface()); // Finalize all Chain of Responsibility chains (registering the proxy last, required prior to Castle 3.x) facility.FinalizeChains(); anotherProvider = mocks.Stub <IAnotherProvider>(); container.Register( Component.For <IAnotherProvider>() .Instance(anotherProvider)); }
// Constructor required for Castle to wire up chain behavior public FirstSomethingProvider(ISomethingProvider next, IAnotherProvider anotherProvider) : base(next) { this.anotherProvider = anotherProvider; }