コード例 #1
0
        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);
        }
コード例 #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()));
        }
コード例 #3
0
ファイル: TestUtil.cs プロジェクト: fossabot/xamarin-client
        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);
        }