public void Should_read_sites_and_their_keys_from_the_configSource()
        {
            var section = ConfigurationManager.GetSection(typeof(GatewayConfig).Name) as GatewayConfig;

            var router = new ConfigurationBasedSiteRouter(section.Sites.Cast <SiteConfig>().Select(site => new Site
            {
                Key     = site.Key,
                Channel = new Channel
                {
                    Type    = site.ChannelType,
                    Address = site.Address
                },
                LegacyMode = site.LegacyMode
            }).ToList());

            var headers = new Dictionary <string, string> {
                { Headers.DestinationSites, "SiteA" }
            };

            var sites = router.GetDestinationSitesFor(headers);

            Assert.AreEqual(new Channel {
                Address = "http://sitea.com", Type = "http"
            }, sites.First().Channel);
        }
Example #2
0
        public void Should_read_sites_and_their_keys_from_the_configSource()
        {
            var section = ConfigurationManager.GetSection(typeof(GatewayConfig).Name) as GatewayConfig;

            var router = new ConfigurationBasedSiteRouter(section.SitesAsDictionary());

            var headers = new Dictionary <string, string> {
                { Headers.DestinationSites, "SiteA" }
            };

            var sites = router.GetDestinationSitesFor(headers);

            Assert.AreEqual(new Channel {
                Address = "http://sitea.com", Type = "http"
            }, sites.First().Channel);
        }
        public void Should_read_sites_and_their_keys_from_the_configSource()
        {
          
            var section = ConfigurationManager.GetSection(typeof(GatewayConfig).Name) as GatewayConfig;
          
            var router = new ConfigurationBasedSiteRouter
            {
                Sites = section.SitesAsDictionary()
            };

     
            var message = new TransportMessage();

            message.Headers.Add(Headers.DestinationSites, "SiteA");

            var sites = router.GetDestinationSitesFor(message);

            Assert.AreEqual(new Channel{ Address = "http://sitea.com",Type = "http"},sites.First().Channel);
        }