private void AssertValue(string keyName, string expected, User user)
        {
            var k = keyName.ToLowerInvariant();

            if (k.StartsWith("bool"))
            {
                var actual = client.GetValue(keyName, false, user);

                Assert.AreEqual(bool.Parse(expected), actual, $"keyName: {keyName} | userId: {user?.Identifier}");
            }
            else if (k.StartsWith("double"))
            {
                var actual = client.GetValue(keyName, double.NaN, user);

                Assert.AreEqual(double.Parse(expected, CultureInfo.InvariantCulture), actual, $"keyName: {keyName} | userId: {user?.Identifier}");
            }
            else if (k.StartsWith("integer"))
            {
                var actual = client.GetValue(keyName, int.MaxValue, user);

                Assert.AreEqual(int.Parse(expected), actual, $"keyName: {keyName} | userId: {user?.Identifier}");
            }
            else
            {
                var actual = client.GetValue(keyName, string.Empty, user);

                Assert.AreEqual(expected, actual, $"keyName: {keyName} | userId: {user?.Identifier}");
            }
        }
        private static void GetValueAndAssert(IConfigCatClient client, string key, string defaultValue, string expectedValue)
        {
            var actual = client.GetValue(key, defaultValue);

            Assert.AreEqual(expectedValue, actual);
            Assert.AreNotEqual(defaultValue, actual);
        }
Example #3
0
 void Handle_Clicked(object sender, System.EventArgs e)
 {
     //client.ForceRefresh();
     if (client.GetValue("isAwesomeFeatureEnabled", false))
     {
         LblResult.Text      = "ON";
         LblResult.TextColor = Color.GreenYellow;
     }
     else
     {
         LblResult.Text      = "OFF";
         LblResult.TextColor = Color.Red;
     }
 }
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            IConfigCatClient configCatClient = context.HttpContext.RequestServices.GetService(typeof(IConfigCatClient)) as IConfigCatClient;


            if (configCatClient != null)
            {
                configCatClient.ForceRefresh();

                if (!configCatClient.GetValue(ApplicationConstants.FeatureToggle.ACAO_EXCLUIR, false))
                {
                    context.Result = new NotFoundResult();
                }
            }
        }
Example #5
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            IConfigCatClient configCatClient = context.HttpContext.RequestServices.GetService(typeof(IConfigCatClient)) as IConfigCatClient;


            if (configCatClient != null)
            {
                configCatClient.ForceRefresh();

                if (!configCatClient.GetValue(_toggleName, false))
                {
                    context.Result = new NotFoundResult();
                }
            }
        }
        private bool GetValue(string toggleName)
        {
            _configCatClient.ForceRefresh();

            return(_configCatClient.GetValue(toggleName, false));
        }
Example #7
0
 public bool IsFeatureEnabled(string featureFlagName)
 {
     return(_configCatClient.GetValue(featureFlagName, false));
 }
Example #8
0
 public IActionResult Index()
 {
     ViewBag.Env           = _environment.EnvironmentName;
     ViewBag.PesquisarRepo = _client.GetValue(ApplicationConstants.FeatureToggle.PESQUISAR_REPOSITORIOS, false);
     return(View());
 }