Exemplo n.º 1
0
 private void Apply(VariantWeightScheduleApplied e)
 {
     foreach (var variantWeight in e.VariantWeightSchedule)
     {
         _variants[variantWeight.Key].weight = variantWeight.Value;
     }
 }
Exemplo n.º 2
0
        public void SetVariantWeightSchedule(Dictionary<string, int> variantWeightSchedule)
        {
            //TODO: Check all variants exist

            if (variantWeightSchedule.Values.Sum() != 100)
            {
                //Duff weighting
                throw new ArgumentException("Variant Weighting don't add up to 100", "variantWeightSchedule");
            }

            var @event = new VariantWeightScheduleApplied()
            {
                TestId = this.Id,
                VariantWeightSchedule = variantWeightSchedule
            };

            ApplyChange(@event);
        }