public async void InitPassesUserToUpdateProcessorFactory()
        {
            MockPollingProcessor stub = new MockPollingProcessor("{}");
            User testUser             = User.WithKey("new-user");

            var config = TestUtil.ConfigWithFlagsJson(testUser, appKey, "{}")
                         .UpdateProcessorFactory(stub.AsFactory())
                         .Build();

            using (var client = await LdClient.InitAsync(config, testUser))
            {
                Assert.Same(testUser, stub.ReceivedUser);
            }
        }
        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);
            }
        }
        public async void InitWithAutoGeneratedAnonUserPassesGeneratedUserToUpdateProcessorFactory()
        {
            MockPollingProcessor stub = new MockPollingProcessor("{}");
            User anonUserIn           = User.Builder((String)null).Anonymous(true).Build();

            var config = TestUtil.ConfigWithFlagsJson(anonUserIn, appKey, "{}")
                         .UpdateProcessorFactory(stub.AsFactory())
                         .Build();

            using (var client = await LdClient.InitAsync(config, anonUserIn))
            {
                Assert.NotSame(anonUserIn, stub.ReceivedUser);
                Assert.Equal(MockDeviceInfo.GeneratedId, stub.ReceivedUser.Key);
                Assert.True(stub.ReceivedUser.Anonymous);
            }
        }