Example #1
0
        public void should_be_disabled_if_hostname_not_in_list()
        {
            var strategy = new ApplicationHostnameStrategy();
            var parms    = new Dictionary <string, string>();

            parms.Add("hostNames", "MegaHost,MiniHost, happyHost");

            Assert.False(strategy.IsEnabled(parms));
        }
Example #2
0
        public void should_be_disabled_if_no_HostNames_in_parms()
        {
            var strategy = new ApplicationHostnameStrategy();
            var parms    = new Dictionary <string, string>();

            parms.Add("hostNames", null);

            Assert.False(strategy.IsEnabled(parms));
        }
Example #3
0
        public void should_be_disabled_if_no_HostNames_in_parameters()
        {
            var strategy   = new ApplicationHostnameStrategy();
            var parameters = new Dictionary <string, string>();

            parameters.Add("hostNames", null);

            strategy.IsEnabled(parameters).Should().BeFalse();
        }
Example #4
0
        public void should_be_enabled_for_InetAddress()
        {
            var hostName = UnleashExtensions.GetLocalIpAddress();

            Environment.SetEnvironmentVariable("hostname", hostName);

            var strategy = new ApplicationHostnameStrategy();

            var parameters = new Dictionary <string, string>();

            parameters.Add("hostNames", $"MegaHost,{hostName},MiniHost, happyHost");
            strategy.IsEnabled(parameters).Should().BeTrue();
        }
Example #5
0
        public void so_close_but_no_cigar()
        {
            string hostName = "my-super-host";

            Environment.SetEnvironmentVariable("hostname", hostName);

            var strategy = new ApplicationHostnameStrategy();

            var parameters = new Dictionary <string, string>();

            parameters.Add("hostNames", "MegaHost, MiniHost, SuperhostOne");
            strategy.IsEnabled(parameters).Should().BeFalse();
        }
Example #6
0
        public void should_handle_weird_casing()
        {
            string hostName = "my-super-host";

            Environment.SetEnvironmentVariable("hostname", hostName);

            var strategy = new ApplicationHostnameStrategy();

            var parameters = new Dictionary <string, string>();

            parameters.Add("hostNames", $"MegaHost,{hostName.ToUpperInvariant()},MiniHost, happyHost");

            strategy.IsEnabled(parameters).Should().BeTrue();
        }
Example #7
0
        public void should_be_enabled_for_hostName()
        {
            string hostName = "my-super-host";

            Environment.SetEnvironmentVariable("hostname", hostName);

            var strategy = new ApplicationHostnameStrategy();

            var parameters = new Dictionary <string, string>();

            parameters.Add("hostNames", "MegaHost," + hostName + ",MiniHost, happyHost");

            strategy.IsEnabled(parameters).Should().BeTrue();
        }
Example #8
0
        public void should_be_enabled_for_dashed_host()
        {
            var hostName = "super-wiEred-host";

            Environment.SetEnvironmentVariable("hostname", hostName);

            var strategy = new ApplicationHostnameStrategy();

            var parameters = new Dictionary <string, string>();

            parameters.Add("hostNames", $"MegaHost,{hostName},MiniHost, happyHost");

            strategy.IsEnabled(parameters).Should().BeTrue();
        }
Example #9
0
        public void null_test()
        {
            var strategy = new ApplicationHostnameStrategy();

            Assert.False(strategy.IsEnabled(new Dictionary <string, string>()));
        }
Example #10
0
        public void null_test()
        {
            var strategy = new ApplicationHostnameStrategy();

            strategy.IsEnabled(new Dictionary <string, string>()).Should().BeFalse();
        }