Exemple #1
0
        public void EvaluationUsesDataStoreIfClientIsNotInitedButStoreIsInited()
        {
            var dataStore = new InMemoryDataStore();

            dataStore.Init(FullDataSet <ItemDescriptor> .Empty());
            var flag = new FeatureFlagBuilder("key").OffWithValue(LdValue.Of(1)).Build();

            TestUtils.UpsertFlag(dataStore, flag);

            var config = BasicConfig()
                         .DataStore(dataStore.AsSingletonFactory())
                         .DataSource(MockDataSourceThatNeverStarts().AsSingletonFactory())
                         .Build();

            using (var client = new LdClient(config))
            {
                Assert.Equal(1, client.IntVariation("key", User.WithKey("user"), 0));
            }
        }
        public void EvaluationUsesDataStoreIfClientIsNotInitedButStoreIsInited()
        {
            var dataStore = new InMemoryDataStore();

            dataStore.Init(FullDataSet <ItemDescriptor> .Empty());
            var flag = new FeatureFlagBuilder("key").OffWithValue(LdValue.Of(1)).Build();

            TestUtils.UpsertFlag(dataStore, flag);

            var config = Configuration.Builder(sdkKey).StartWaitTime(TimeSpan.Zero)
                         .DataStore(TestUtils.SpecificDataStore(dataStore))
                         .DataSource(TestUtils.SpecificDataSource(dataSource))
                         .Events(Components.NoEvents)
                         .Logging(Components.Logging(testLogging))
                         .Build();

            using (var client = new LdClient(config))
            {
                Assert.Equal(1, client.IntVariation("key", User.WithKey("user"), 0));
            }
        }