Esempio n. 1
0
        public void reading_settings()
        {
            var channel = new ChannelSettings
            {
                Outbound = new Uri("channel://outbound"),
                Downstream = new Uri("channel://downstream")
            };

            var bus = new BusSettings
            {
                Outbound = new Uri("bus://outbound"),
                Downstream = new Uri("bus://downstream")
            };

            var services = new InMemoryServiceLocator();
            services.Add(channel);
            services.Add(bus);

            var graph = new ChannelGraph();
            graph.ChannelFor<ChannelSettings>(x => x.Outbound);
            graph.ChannelFor<ChannelSettings>(x => x.Downstream);
            graph.ChannelFor<BusSettings>(x => x.Outbound);
            graph.ChannelFor<BusSettings>(x => x.Downstream);

            graph.ReadSettings(services);

            graph.ChannelFor<ChannelSettings>(x => x.Outbound)
                 .Uri.ShouldBe(channel.Outbound);
            graph.ChannelFor<ChannelSettings>(x => x.Downstream)
                 .Uri.ShouldBe(channel.Downstream);
            graph.ChannelFor<BusSettings>(x => x.Outbound)
                .Uri.ShouldBe(bus.Outbound);
            graph.ChannelFor<BusSettings>(x => x.Downstream)
                .Uri.ShouldBe(bus.Downstream);
        }
Esempio n. 2
0
        public void reading_settings()
        {
            var channel = new ChannelSettings
            {
                Outbound   = new Uri("channel://outbound"),
                Downstream = new Uri("channel://downstream")
            };

            var bus = new BusSettings
            {
                Outbound   = new Uri("bus://outbound"),
                Downstream = new Uri("bus://downstream")
            };

            var services = new InMemoryServiceLocator();

            services.Add(channel);
            services.Add(bus);

            var graph = new ChannelGraph();

            graph.ChannelFor <ChannelSettings>(x => x.Outbound);
            graph.ChannelFor <ChannelSettings>(x => x.Downstream);
            graph.ChannelFor <BusSettings>(x => x.Outbound);
            graph.ChannelFor <BusSettings>(x => x.Downstream);

            graph.ReadSettings(services);

            graph.ChannelFor <ChannelSettings>(x => x.Outbound)
            .Uri.ShouldBe(channel.Outbound);
            graph.ChannelFor <ChannelSettings>(x => x.Downstream)
            .Uri.ShouldBe(channel.Downstream);
            graph.ChannelFor <BusSettings>(x => x.Outbound)
            .Uri.ShouldBe(bus.Outbound);
            graph.ChannelFor <BusSettings>(x => x.Downstream)
            .Uri.ShouldBe(bus.Downstream);
        }