コード例 #1
0
ファイル: MVTestAR.cs プロジェクト: MattCollinge/Spikes
 private void Apply(VariantWeightScheduleApplied e)
 {
     foreach (var variantWeight in e.VariantWeightSchedule)
     {
         _variants[variantWeight.Key].weight = variantWeight.Value;
     }
 }
コード例 #2
0
ファイル: MVTestAR.cs プロジェクト: MattCollinge/Spikes
        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);
        }