public void Segment_Evaluator_Should_Match_All_Expectations()
 {
     foreach (KeyValuePair <string, dynamic> testCaseGroup in TestExpectations)
     {
         Dictionary <string, dynamic> testCase = JObject.FromObject(testCaseGroup.Value).ToObject <Dictionary <string, dynamic> >();
         foreach (KeyValuePair <string, dynamic> testCaseContent in testCase)
         {
             Dictionary <string, dynamic> segments                    = JObject.FromObject(testCaseContent.Value["dsl"]).ToObject <Dictionary <string, dynamic> >();
             Dictionary <string, dynamic> customVariables             = testCaseContent.Value.ContainsKey("custom_variables") ? JObject.FromObject(testCaseContent.Value["custom_variables"]).ToObject <Dictionary <string, dynamic> >() : null;
             Dictionary <string, dynamic> variationTargetingVariables = testCaseContent.Value.ContainsKey("variation_targeting_variables") ? JObject.FromObject(testCaseContent.Value["variation_targeting_variables"]).ToObject <Dictionary <string, dynamic> >() : null;
             if (variationTargetingVariables != null)
             {
                 customVariables = variationTargetingVariables;
             }
             bool expectation = testCaseContent.Value["expectation"];
             bool result      = new SegmentEvaluator().evaluate("user", "dummyCampaign", Constants.SegmentationType.PRE_SEGMENTATION, segments, customVariables);
             Assert.Equal(result, expectation);
         }
     }
 }
 public SegmentMatchService(SegmentEvaluator evaluator)
 {
     m_evaluator = evaluator;
 }
Beispiel #3
0
 public SegmentMatchService(SegmentEvaluator evaluator)
 {
     m_evaluator = evaluator;
 }