IMobileUpdateProcessor Processor()
        {
            var mockFeatureFlagRequestor = new MockFeatureFlagRequestor(flagsJson);
            var stubbedFlagCache         = new UserFlagInMemoryCache();

            mockFlagCacheManager = new MockFlagCacheManager(stubbedFlagCache);
            user = User.WithKey("user1Key");
            return(new MobilePollingProcessor(mockFeatureFlagRequestor, mockFlagCacheManager, user, TimeSpan.FromSeconds(30), TimeSpan.Zero));
        }
        internal static IUserFlagCache StubbedFlagCache(User user)
        {
            // stub json into the FlagCache
            IUserFlagCache stubbedFlagCache = new UserFlagInMemoryCache();

            if (String.IsNullOrEmpty(user.Key))
            {
                return(stubbedFlagCache);
            }

            stubbedFlagCache.CacheFlagsForUser(StubbedFlagsDictionary(), user);
            return(stubbedFlagCache);
        }
示例#3
0
        internal static ConfigurationBuilder ConfigWithFlagsJson(User user, string appKey, string flagsJson)
        {
            var            flags            = DecodeFlagsJson(flagsJson);
            IUserFlagCache stubbedFlagCache = new UserFlagInMemoryCache();

            if (user != null && user.Key != null)
            {
                stubbedFlagCache.CacheFlagsForUser(flags, user);
            }

            return(Configuration.BuilderInternal(appKey)
                   .FlagCacheManager(new MockFlagCacheManager(stubbedFlagCache))
                   .ConnectivityStateManager(new MockConnectivityStateManager(true))
                   .EventProcessor(new MockEventProcessor())
                   .UpdateProcessorFactory(MockPollingProcessor.Factory(null))
                   .PersistentStorage(new MockPersistentStorage())
                   .DeviceInfo(new MockDeviceInfo()));
        }
示例#4
0
        public static Configuration ConfigWithFlagsJson(User user, string appKey, string flagsJson)
        {
            var            flags            = DecodeFlagsJson(flagsJson);
            IUserFlagCache stubbedFlagCache = new UserFlagInMemoryCache();

            if (user != null && user.Key != null)
            {
                stubbedFlagCache.CacheFlagsForUser(flags, user);
            }

            Configuration configuration = Configuration.Default(appKey)
                                          .WithFlagCacheManager(new MockFlagCacheManager(stubbedFlagCache))
                                          .WithConnectionManager(new MockConnectionManager(true))
                                          .WithEventProcessor(new MockEventProcessor())
                                          .WithUpdateProcessor(new MockPollingProcessor())
                                          .WithPersister(new MockPersister())
                                          .WithDeviceInfo(new MockDeviceInfo(""))
                                          .WithFeatureFlagListenerManager(new FeatureFlagListenerManager());

            return(configuration);
        }