Bullsh*! This case is not failing, my assertion is incorrect. Seems to be something more local to my mess here then ;)
2009/12/2 Jan Limpens <[email protected]> > here we go! that's mbunit, but you have this adapted to whatever framework > you use in 1 min > > using Castle.MicroKernel.Registration; > using System.Diagnostics; > using Castle.Windsor; > using MbUnit.Framework; > > namespace ProjectBase.Utils.Tests > { > public class TestContainerOrder > { > [Test] > public void > Services_should_keep_the_order_they_were_registered_when_retrieved_as_an_array() > { > var container = new WindsorContainer(); > container.Register( > > Component.For<IService>().ImplementedBy<Service1>().Named(typeof(Service1).Name), > > Component.For<IService>().ImplementedBy<Service2>().Named(typeof(Service2).Name), > > Component.For<IService>().ImplementedBy<Service3>().Named(typeof(Service3).Name), > > Component.For<IConsume>().ImplementedBy<Consumer>().ServiceOverrides(ServiceOverride > .ForKey("Services") > .Eq(new[] > { > typeof > (Service3).Name, > typeof (Service1).Name, > typeof (Service2).Name > })) > ); > var consumer = container.Resolve<IConsume>(); > consumer.DoIt(); > AssertEx.That(() => consumer.Services[1].GetType() == > typeof(Service3)); > AssertEx.That(() => consumer.Services[2].GetType() == > typeof(Service1)); > AssertEx.That(() => consumer.Services[3].GetType() == > typeof(Service2)); > } > } > > public interface IService { } > public class Service1 : IService { } > public class Service2 : IService { } > public class Service3 : IService { } > public class Consumer : IConsume > { > public IService[] Services { get; set; } > public void DoIt() > { > foreach (var service in Services) > { > Debug.Write(service.GetType().Name); > } > } > } > > public interface IConsume > { > IService[] Services { get; set; } > void DoIt(); > } > } > > 2009/12/1 Krzysztof Koźmic (2) <[email protected]> > > Jan, >> >> could you provide a complete, failing test case, so that we're both on >> the same page? >> >> Krzysztof >> >> On 1 Gru, 08:46, Krzysztof Koźmic (2) <[email protected]> wrote: >> > I see no reason why that works that way. >> > >> > I'll have a look into it, once I get home. >> > >> > On 30 Lis, 17:45, Jan Limpens <[email protected]> wrote: >> > >> > > I register some components like this: >> > >> > > Component.For<IRoutesSetup>() >> > > .ImplementedBy<RoutesSetup>() >> > > .LifeStyle.Transient >> > > .ServiceOverrides(ServiceOverride >> > > .ForKey("RoutingProviders") >> > > .Eq(new[] >> > > { >> > > typeof >> > > (CmsPagesRoutesProvider).Name, >> > > typeof >> > > (DomainRoutesProvider).Name, >> > > typeof >> > > (XmlRoutesProvider).Name >> > > })) >> > >> > > but upon resolving IRoutesSetup its RoutingProviders are in a >> different >> > > order. In xml I pass a list of service references (list/items style) >> and >> > > this does not seem to happen. Any way to do this fluently as well? >> > >> > > -- >> > > Jan >> > >> > >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> "Castle Project Users" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<castle-project-users%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/castle-project-users?hl=en. >> >> >> > > > -- > Jan > -- Jan -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
