コード例 #1
0
 public void VariationSendsFeatureEventForUnknownFlag()
 {
     using (LdClient client = MakeClient(user))
     {
         string result = client.StringVariation("flag", "b");
         Assert.Equal("b", result);
         Assert.Collection(eventProcessor.Events,
                           e => CheckIdentifyEvent(e, user),
                           e => {
             EvaluationEvent fe = Assert.IsType <EvaluationEvent>(e);
             Assert.Equal("flag", fe.FlagKey);
             Assert.Equal("b", fe.Value.AsString);
             Assert.Null(fe.Variation);
             Assert.Null(fe.FlagVersion);
             Assert.Equal("b", fe.Default.AsString);
             Assert.Null(fe.Reason);
             Assert.NotEqual(0, fe.Timestamp.Value);
         });
     }
 }
コード例 #2
0
        public void VariationSendsFeatureEventForDefaultValue()
        {
            var flag = new FeatureFlagBuilder().Version(1000).Build();

            _testData.Update(_testData.Flag("flag").PreconfiguredFlag(flag));
            using (LdClient client = MakeClient(user))
            {
                string result = client.StringVariation("flag", "b");
                Assert.Equal("b", result);
                Assert.Collection(eventProcessor.Events,
                                  e => CheckIdentifyEvent(e, user),
                                  e => {
                    EvaluationEvent fe = Assert.IsType <EvaluationEvent>(e);
                    Assert.Equal("flag", fe.FlagKey);
                    Assert.Equal("b", fe.Value.AsString);
                    Assert.Null(fe.Variation);
                    Assert.Equal(1000, fe.FlagVersion);
                    Assert.Equal("b", fe.Default.AsString);
                    Assert.Null(fe.Reason);
                    Assert.NotEqual(0, fe.Timestamp.Value);
                });
            }
        }