예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public LdClientEventTests(ITestOutputHelper testOutput) : base(testOutput)
 {
     _factory = eventProcessor.AsSingletonFactory();
 }