Пример #1
0
        public override bool Match(Key key, Dictionary <string, object> attributes = null, ISplitClient splitClient = null)
        {
            if (splitClient == null)
            {
                return(false);
            }

            string treatment = splitClient.GetTreatment(key, split, attributes, false, false);

            return(treatments.Contains(treatment));
        }
Пример #2
0
        public bool IsFeatureEnabled(string feature, User user)
        {
            var treatment = _splitClient.GetTreatment("123456", feature, user.GetAttributes());

            //_splitClient.Destroy();
            if (treatment == "on")
            {
                return(true);
            }
            else if (treatment == "off")
            {
                return(false);
            }
            else
            {
                throw new Exception("An error occured, make sure that the api key is valid...");
            }
        }
Пример #3
0
        public bool GetFeatureFlag(string feature)
        {
            var key        = BuildKey();
            var attributes = BuildAttributes();

            var treatment = _client.GetTreatment(key.ToString(), feature, attributes);

            switch (treatment)
            {
            case "on":
                return(true);

            case "off":
                return(false);

            default:
                _logger.LogError($"Could not map feature={feature}; treatment={treatment}");
                return(false);
            }
        }