private void Apply(VariantWeightScheduleApplied e) { foreach (var variantWeight in e.VariantWeightSchedule) { _variants[variantWeight.Key].weight = variantWeight.Value; } }
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); }