public bool IsEnabled(Dictionary <string, string> parameters, UnleashContext context = null)
        {
            if (!parameters.TryGetValue(Percentage, out var value))
            {
                return(false);
            }

            var percentage   = StrategyUtils.GetPercentage(value);
            var randomNumber = random.Next(100) + 1;

            return(percentage >= randomNumber);
        }
        public bool IsEnabled(Dictionary <string, string> parameters, UnleashContext context = null)
        {
            var sessionId = context?.SessionId;

            if (sessionId == null || sessionId == string.Empty)
            {
                return(false);
            }

            if (!(parameters.ContainsKey(Percentage) && parameters.ContainsKey(GroupId)))
            {
                return(false);
            }

            var percentageString = parameters[Percentage];
            var percentage       = StrategyUtils.GetPercentage(percentageString);
            var groupId          = parameters[GroupId] ?? string.Empty;

            var normalizedSessionId = StrategyUtils.GetNormalizedNumber(sessionId, groupId);

            return(percentage > 0 && normalizedSessionId <= percentage);
        }
        public bool IsEnabled(Dictionary <string, string> parameters, UnleashContext context)
        {
            var stickiness   = GetStickiness(parameters);
            var stickinessId = ResolveStickiness(stickiness, context);
            var percentage   = StrategyUtils.GetPercentage(parameters.TryGetValue(Percentage, out var percentageString) ? percentageString : null);

            parameters.TryGetValue(GroupId, out var groupId);

            if (string.IsNullOrEmpty(groupId))
            {
                groupId = "";
            }

            if (!string.IsNullOrEmpty(stickinessId))
            {
                var normalizedUserId = StrategyUtils.GetNormalizedNumber(stickinessId, groupId);
                return(percentage > 0 && normalizedUserId <= percentage);
            }
            else
            {
                return(false);
            }
        }
 public bool IsEnabled(Dictionary <string, string> parameters, UnleashContext context, List <Constraint> constraints)
 {
     return(StrategyUtils.IsEnabled(this, parameters, context, constraints));
 }