Re: Windsor - Dependency Resolution Question
Thanks Tuna - I'll check it out Sent from my iPhone On Sep 26, 2009, at 11:41 PM, Tuna Toksoz tehl...@gmail.com wrote: http://ayende.com/Blog/archive/2008/10/05/windsor- ihandlerselector.aspx Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Sun, Sep 27, 2009 at 12:36 AM, browns kelly.brownsber...@gmail.com wrote: Hey all - I'm trying to determine how to make Windsor resolve a specific implementation based on run-time state. Nothing in the core API is jumping out at me and I'm not sure which of the many extensibility points I should pursue. Does anyone have any advice on how to make these three tests pass? [TestFixture] public class Fixture { [RowTest] [Row(typeof(OneProcessor), Mode.One)] [Row(typeof(TwoProcessor), Mode.Two)] [Row(typeof(ThreeProcessor), Mode.Three)] public void Can_Resolve_Processor_By_Mode(Type type, Mode mode) { IWindsorContainer factory = new WindsorContainer(); factory.AddComponentIProcessor, OneProcessor(1); factory.AddComponentIProcessor, TwoProcessor(2); factory.AddComponentIProcessor, ThreeProcessor(3); factory.AddComponentController(controller); IDictionary dictionary = new Dictionarystring, object {{mode, mode}}; Controller controller = factory.ResolveController (dictionary); Assert.IsInstanceOfType(type, controller.Processor, The processor didn't resolve to the expected type); Assert.AreEqual(mode, controller.Mode, The mode was not injected into the controller as expected); } public enum Mode { One, Two, Three } public class Controller { private readonly IProcessor _processor; private readonly Mode _mode; public Controller(Mode mode, IProcessor processor) { _mode = mode; _processor = processor; } public IProcessor Processor { get { return _processor; } } public Mode Mode { get { return _mode; } } } public interface IProcessor { } public class OneProcessor : IProcessor {} public class TwoProcessor : IProcessor {} public class ThreeProcessor : IProcessor { } } --~--~-~--~~~---~--~~ 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-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---
Windsor - Dependency Resolution Question
Hey all - I'm trying to determine how to make Windsor resolve a specific implementation based on run-time state. Nothing in the core API is jumping out at me and I'm not sure which of the many extensibility points I should pursue. Does anyone have any advice on how to make these three tests pass? [TestFixture] public class Fixture { [RowTest] [Row(typeof(OneProcessor), Mode.One)] [Row(typeof(TwoProcessor), Mode.Two)] [Row(typeof(ThreeProcessor), Mode.Three)] public void Can_Resolve_Processor_By_Mode(Type type, Mode mode) { IWindsorContainer factory = new WindsorContainer(); factory.AddComponentIProcessor, OneProcessor(1); factory.AddComponentIProcessor, TwoProcessor(2); factory.AddComponentIProcessor, ThreeProcessor(3); factory.AddComponentController(controller); IDictionary dictionary = new Dictionarystring, object {{mode, mode}}; Controller controller = factory.ResolveController (dictionary); Assert.IsInstanceOfType(type, controller.Processor, The processor didn't resolve to the expected type); Assert.AreEqual(mode, controller.Mode, The mode was not injected into the controller as expected); } public enum Mode { One, Two, Three } public class Controller { private readonly IProcessor _processor; private readonly Mode _mode; public Controller(Mode mode, IProcessor processor) { _mode = mode; _processor = processor; } public IProcessor Processor { get { return _processor; } } public Mode Mode { get { return _mode; } } } public interface IProcessor { } public class OneProcessor : IProcessor {} public class TwoProcessor : IProcessor {} public class ThreeProcessor : IProcessor { } } --~--~-~--~~~---~--~~ 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-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---
Re: Windsor - Dependency Resolution Question
IHandlerSelector? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Sun, Sep 27, 2009 at 12:36 AM, browns kelly.brownsber...@gmail.comwrote: Hey all - I'm trying to determine how to make Windsor resolve a specific implementation based on run-time state. Nothing in the core API is jumping out at me and I'm not sure which of the many extensibility points I should pursue. Does anyone have any advice on how to make these three tests pass? [TestFixture] public class Fixture { [RowTest] [Row(typeof(OneProcessor), Mode.One)] [Row(typeof(TwoProcessor), Mode.Two)] [Row(typeof(ThreeProcessor), Mode.Three)] public void Can_Resolve_Processor_By_Mode(Type type, Mode mode) { IWindsorContainer factory = new WindsorContainer(); factory.AddComponentIProcessor, OneProcessor(1); factory.AddComponentIProcessor, TwoProcessor(2); factory.AddComponentIProcessor, ThreeProcessor(3); factory.AddComponentController(controller); IDictionary dictionary = new Dictionarystring, object {{mode, mode}}; Controller controller = factory.ResolveController (dictionary); Assert.IsInstanceOfType(type, controller.Processor, The processor didn't resolve to the expected type); Assert.AreEqual(mode, controller.Mode, The mode was not injected into the controller as expected); } public enum Mode { One, Two, Three } public class Controller { private readonly IProcessor _processor; private readonly Mode _mode; public Controller(Mode mode, IProcessor processor) { _mode = mode; _processor = processor; } public IProcessor Processor { get { return _processor; } } public Mode Mode { get { return _mode; } } } public interface IProcessor { } public class OneProcessor : IProcessor {} public class TwoProcessor : IProcessor {} public class ThreeProcessor : IProcessor { } } --~--~-~--~~~---~--~~ 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-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---
Re: Windsor - Dependency Resolution Question
http://ayende.com/Blog/archive/2008/10/05/windsor-ihandlerselector.aspx Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Sun, Sep 27, 2009 at 12:36 AM, browns kelly.brownsber...@gmail.comwrote: Hey all - I'm trying to determine how to make Windsor resolve a specific implementation based on run-time state. Nothing in the core API is jumping out at me and I'm not sure which of the many extensibility points I should pursue. Does anyone have any advice on how to make these three tests pass? [TestFixture] public class Fixture { [RowTest] [Row(typeof(OneProcessor), Mode.One)] [Row(typeof(TwoProcessor), Mode.Two)] [Row(typeof(ThreeProcessor), Mode.Three)] public void Can_Resolve_Processor_By_Mode(Type type, Mode mode) { IWindsorContainer factory = new WindsorContainer(); factory.AddComponentIProcessor, OneProcessor(1); factory.AddComponentIProcessor, TwoProcessor(2); factory.AddComponentIProcessor, ThreeProcessor(3); factory.AddComponentController(controller); IDictionary dictionary = new Dictionarystring, object {{mode, mode}}; Controller controller = factory.ResolveController (dictionary); Assert.IsInstanceOfType(type, controller.Processor, The processor didn't resolve to the expected type); Assert.AreEqual(mode, controller.Mode, The mode was not injected into the controller as expected); } public enum Mode { One, Two, Three } public class Controller { private readonly IProcessor _processor; private readonly Mode _mode; public Controller(Mode mode, IProcessor processor) { _mode = mode; _processor = processor; } public IProcessor Processor { get { return _processor; } } public Mode Mode { get { return _mode; } } } public interface IProcessor { } public class OneProcessor : IProcessor {} public class TwoProcessor : IProcessor {} public class ThreeProcessor : IProcessor { } } --~--~-~--~~~---~--~~ 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-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~--~~~~--~~--~--~---