public void EventProcessorIsOfflineWhenNetworkIsUnavailable() { var connectivityStateManager = new MockConnectivityStateManager(false); var eventProcessor = new MockEventProcessor(); var config = BasicConfig() .ConnectivityStateManager(connectivityStateManager) .Events(eventProcessor.AsSingletonFactory()) .Build(); using (var client = TestUtil.CreateClient(config, BasicUser)) { 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 EventProcessorIsOnlineByDefault() { var eventProcessor = new MockEventProcessor(); var config = BasicConfig() .Events(eventProcessor.AsSingletonFactory()) .Build(); using (var client = TestUtil.CreateClient(config, BasicUser)) { Assert.False(eventProcessor.Offline); } }
public LdClientEventTests(ITestOutputHelper testOutput) : base(testOutput) { _factory = eventProcessor.AsSingletonFactory(); }