コード例 #1
0
        public void ManualPollGetValue()
        {
            IConfigCatClient manualPollClient = ConfigCatClientBuilder
                                                .Initialize(APIKEY)
                                                .WithManualPoll()
                                                .Create();

            manualPollClient.ForceRefresh();

            GetValueAndAssert(manualPollClient, "stringDefaultCat", "N/A", "Cat");
        }
コード例 #2
0
        public void GetVariationId()
        {
            IConfigCatClient manualPollClient = ConfigCatClientBuilder
                                                .Initialize(SDKKEY)
                                                .WithLogger(consoleLogger)
                                                .WithManualPoll()
                                                .Create();

            manualPollClient.ForceRefresh();
            var actual = manualPollClient.GetVariationId("stringDefaultCat", "default");

            Assert.AreEqual("7a0be518", actual);
        }
コード例 #3
0
        public void GetAllKeys()
        {
            IConfigCatClient manualPollClient = ConfigCatClientBuilder
                                                .Initialize(SDKKEY)
                                                .WithLogger(consoleLogger)
                                                .WithManualPoll()
                                                .Create();

            manualPollClient.ForceRefresh();
            var keys = manualPollClient.GetAllKeys().ToArray();

            Assert.AreEqual(16, keys.Count());
            Assert.IsTrue(keys.Contains("stringDefaultCat"));
        }
        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();
                }
            }
        }
コード例 #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();
                }
            }
        }
コード例 #6
0
        public void GetAllVariationId()
        {
            // Arrange

            const string expectedJsonString = "[\"7a0be518\",\"83372510\",\"2459598d\",\"ce564c3a\",\"44ab483a\",\"d227b334\",\"93f5a1c0\",\"bb66b1f3\",\"09513143\",\"489a16d2\",\"607147d5\",\"11634414\",\"faadbf54\",\"5af8acc7\",\"183ee713\",\"baff2362\"]";

            var expectedValue = Newtonsoft.Json.JsonConvert.DeserializeObject <string[]>(expectedJsonString);

            IConfigCatClient manualPollClient = ConfigCatClientBuilder
                                                .Initialize(SDKKEY)
                                                .WithLogger(consoleLogger)
                                                .WithManualPoll()
                                                .Create();

            manualPollClient.ForceRefresh();

            // Act

            var actual = manualPollClient.GetAllVariationId(new User("*****@*****.**"));

            // Assert
            Assert.AreEqual(16, expectedValue.Length);
            CollectionAssert.AreEquivalent(expectedValue, actual.ToArray());
        }
コード例 #7
0
        private bool GetValue(string toggleName)
        {
            _configCatClient.ForceRefresh();

            return(_configCatClient.GetValue(toggleName, false));
        }
コード例 #8
0
 public void InvalidateCache()
 {
     _configCatClient.ForceRefresh();
 }