Пример #1
0
        public void DataStoreStatusProviderSendsStatusUpdates()
        {
            var dataStoreFactory = new CapturingDataStoreFactory(Components.InMemoryDataStore);
            var config           = BasicConfig()
                                   .DataStore(dataStoreFactory)
                                   .Build();

            using (var client = new LdClient(config))
            {
                var statuses = new EventSink <DataStoreStatus>();
                client.DataStoreStatusProvider.StatusChanged += statuses.Add;

                var newStatus = new DataStoreStatus {
                    Available = false
                };
                dataStoreFactory.DataStoreUpdates.UpdateStatus(newStatus);

                Assert.Equal(newStatus, statuses.ExpectValue());
            }
        }
Пример #2
0
        public void DataStoreStatusProviderReturnsLatestStatus()
        {
            var dataStoreFactory = new CapturingDataStoreFactory(Components.InMemoryDataStore);
            var config           = BasicConfig()
                                   .DataStore(dataStoreFactory)
                                   .Build();

            using (var client = new LdClient(config))
            {
                Assert.Equal(new DataStoreStatus {
                    Available = true
                },
                             client.DataStoreStatusProvider.Status);

                var newStatus = new DataStoreStatus {
                    Available = false
                };
                dataStoreFactory.DataStoreUpdates.UpdateStatus(newStatus);

                Assert.Equal(newStatus, client.DataStoreStatusProvider.Status);
            }
        }
        public void DataStoreStatusProviderReturnsLatestStatus()
        {
            var dataStoreFactory = new CapturingDataStoreFactory(Components.InMemoryDataStore);
            var config           = Configuration.Builder("")
                                   .DataSource(Components.ExternalUpdatesOnly)
                                   .DataStore(dataStoreFactory)
                                   .Events(Components.NoEvents)
                                   .Build();

            using (var client = new LdClient(config))
            {
                Assert.Equal(new DataStoreStatus {
                    Available = true
                },
                             client.DataStoreStatusProvider.Status);

                var newStatus = new DataStoreStatus {
                    Available = false
                };
                dataStoreFactory.DataStoreUpdates.UpdateStatus(newStatus);

                Assert.Equal(newStatus, client.DataStoreStatusProvider.Status);
            }
        }