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);
        }
Exemplo n.º 2
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()));
        }
Exemplo n.º 3
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);
        }