public static MessageHandlersOrderConfiguration FromConfiguration() { var section = ConfigurationManager.GetSection("MessageOrderConfigurationSection") as MessageOrderConfigurationSection; if (section == null) return new MessageHandlersOrderConfiguration(); var conf = new MessageHandlersOrderConfiguration(); var orderList = new List<Order>(); foreach (MessageOrderElement orderElem in section.Orders) { var order = new Order { MessageType = Type.GetType(orderElem.MessageType) }; orderList.Add(order); order.HandlerOrders = orderElem .Handlers .OfType<MessageHandleElement>() .Select(elem => new MessageHandlerOrder { HandlerType = Type.GetType(elem.TypeName), SequenceNo = elem.Order }) .ToList(); } conf._orders.AddRange(orderList); return conf; }
public void Setup() { _messageHandlerOrderProvider.LoadConfiguration( MessageHandlersOrderConfiguration.FromCode( new Order { MessageType = typeof (StringMessage), HandlerOrders = new MessageHandlerOrder[0] })); _order = _messageHandlerOrderProvider.GetOrderFor(typeof (StringMessage)); }
public void Setup() { _order = _messageHandlerOrderProvider.GetOrderFor(typeof(MyMessage)); }