public void EventProcessorIsOfflineWhenNetworkIsUnavailable()
        {
            var connectivityStateManager = new MockConnectivityStateManager(false);
            var eventProcessor           = new MockEventProcessor();
            var config = TestUtil.ConfigWithFlagsJson(simpleUser, appKey, "{}")
                         .ConnectivityStateManager(connectivityStateManager)
                         .EventProcessor(eventProcessor)
                         .Build();

            using (var client = TestUtil.CreateClient(config, simpleUser))
            {
                Assert.True(eventProcessor.Offline);

                connectivityStateManager.Connect(true);
                Assert.False(eventProcessor.Offline);

                connectivityStateManager.Connect(false);
                Assert.True(eventProcessor.Offline);

                // If client is configured offline...
                client.SetOffline(true, TimeSpan.FromSeconds(1));

                // ...then even if the network comes back on, events stay off
                connectivityStateManager.Connect(true);
                Assert.True(eventProcessor.Offline);
            }
        }
        public void ConnectionChangeShouldStopUpdateProcessor()
        {
            var mockUpdateProc = new MockPollingProcessor(null);
            var mockConnectivityStateManager = new MockConnectivityStateManager(true);
            var config = TestUtil.ConfigWithFlagsJson(simpleUser, appKey, "{}")
                         .UpdateProcessorFactory(mockUpdateProc.AsFactory())
                         .ConnectivityStateManager(mockConnectivityStateManager)
                         .Build();

            using (var client = TestUtil.CreateClient(config, simpleUser))
            {
                mockConnectivityStateManager.Connect(false);
                Assert.False(mockUpdateProc.IsRunning);
            }
        }