Exemple #1
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();
        }
Exemple #2
0
        public void IsEnabled_WhenHostNameIsIpv4Address_ShouldReturnTrue()
        {
            var hostName = UnleashExtensions.GetLocalIpAddress();

            Environment.SetEnvironmentVariable("hostname", hostName);

            var context    = new UnleashContext.Builder().Build();
            var parameters = new Dictionary <string, string>
            {
                ["hostNames"] = $"MegaHost,{hostName},MiniHost, happyHost"
            };

            var isEnabled = Strategy.IsEnabled(parameters, context);

            Assert.True(isEnabled);
        }