public RoundRobinVisitContextFactory(Test test, bool distributeEvenlyForSubGroups = true) { DistributeEvenlyForSubGroups = distributeEvenlyForSubGroups; Test = test; _counters = new Dictionary<long, RoundRobinCounter>(); _rules = Test.Experiences.SelectMany(e => e.Levels.Keys.OfType<PersonalizationRule>()).Distinct().ToArray(); }
public static Test FromFactors(params ExperienceFactor[] factors) { var test = new Test(factors); test.Experiences = new RoundRobinCounter(factors.Select(f => f.Levels.Length).ToArray(), false).All .Select((combination, i) => new Experience { Test = test, Number = i + 1, Levels = combination.ToDictionary((level, j) => factors[j], (level, j) => level) }).ToList(); return test; }