Exemple #1
0
        public void FeatureflowManualTestWithFeatureDefaults()
        {
            /*FeatureflowConfig config = FeatureflowConfig.Create();
             * config.BaseUri = "http://app.featureflow.localdev";*/
            Console.WriteLine("Creating client");

            var client = FeatureflowClientFactory.Create("srv-env-685e066dea464f88be14effbf65cf69c", new List <Feature>
            {
                new Feature
                {
                    Key             = "unknown",
                    FailoverVariant = "unavailable"
                },
                new Feature
                {
                    Key             = "new-one",
                    FailoverVariant = "green"
                },
                new Feature
                {
                    Key             = "example-feature",
                    FailoverVariant = "off"
                }
            }, new FeatureflowConfig());
            var user = new User("1234");

            user.WithAttribute("region", "sydney");
            user.WithAttribute("days", new List <object> {
                11, 1, 4, 29
            });
            user.WithSessionAttribute("dayofweek", 11L);

            var result = client.Evaluate("example-feature", user).Value();

            if (client.Evaluate("example-feature", user).IsOn())
            {
                //do something
                Console.WriteLine("Example feature is on");
            }
            else
            {
                //do not do something
                Console.WriteLine("Example feature is off");
            }
            var result2 = client.Evaluate("unknown", user).Value();

            Console.WriteLine("example feature: " + result);
            Console.WriteLine("unknown feature: " + result2);

            Assert.Equal("off", result);
            Assert.Equal("unavailable", result2);
        }
Exemple #2
0
        //[Fact]
        public void FeatureflowManualTest()
        {
            /*FeatureflowConfig config = FeatureflowConfig.Create();
             * config.BaseUri = "http://app.featureflow.localdev";*/
            Console.WriteLine("Starting out");
            var client = FeatureflowClientFactory.Create("srv-env-685e066dea464f88be14effbf65cf69c");             //

            Console.WriteLine("Created client");
            User user = new User("1234");

            user.Attributes.Add("age", new List <object> {
                11
            });

            var result = client.Evaluate("example-feature", user).Value();

            Console.WriteLine(result);
        }
 public FeatureFlowFrameworkClient(FeatureFlagClientSettings settings)
 {
     this.settings   = settings;
     this.lazyClient = new Lazy <IFeatureflowClient>(() => FeatureflowClientFactory.Create(settings.ClientKey));
 }