private static async Task <ProgressionSystem <FeatureFlag> > NewInMemoryTestXpSystem(string apiKey, string sheetId, string sheetName)
        {
            var cachedFlags          = new InMemoryKeyValueStore();
            var googleSheetsStore    = new GoogleSheetsKeyValueStore(cachedFlags, apiKey, sheetId, sheetName);
            var cachedFlagsLocalData = new InMemoryKeyValueStore();
            var analytics            = new LocalAnalytics(new InMemoryKeyValueStore());

            analytics.createStoreFor = (_ => new InMemoryKeyValueStore().GetTypeAdapter <AppFlowEvent>());
            var featureFlagStore = new FeatureFlagStore(cachedFlagsLocalData, googleSheetsStore);

            return(await DefaultProgressionSystem.Setup(featureFlagStore, analytics));
        }
Exemple #2
0
        public async Task TestDefaultProgressionSystemSetup()
        {
            // Get your key from https://console.developers.google.com/apis/credentials
            var apiKey = "AIzaSyCtcFQMgRIUHhSuXggm4BtXT4eZvUrBWN0";
            // https://docs.google.com/spreadsheets/d/1KBamVmgEUX-fyogMJ48TT6h2kAMKyWU1uBL5skCGRBM contains the sheetId:
            var sheetId              = "1KBamVmgEUX-fyogMJ48TT6h2kAMKyWU1uBL5skCGRBM";
            var sheetName            = "MySheet1"; // Has to match the sheet name
            var cachedFlags          = FileBasedKeyValueStore.New("FeatureFlags");
            var cachedFlagsLocalData = FileBasedKeyValueStore.New("FeatureFlags_LocalData");
            var googleSheetsStore    = new GoogleSheetsKeyValueStore(cachedFlags, apiKey, sheetId, sheetName);

            DefaultProgressionSystem.Setup(new TestFeatureFlagStore(cachedFlagsLocalData, googleSheetsStore));

            AppFlow.TrackEvent(EventConsts.catMethod, "Some event");
            Assert.False(await FeatureFlag.IsEnabled("MyFlag4"));
            Log.d("Now take a look at the folders in " + cachedFlags.folderForAllFiles.Parent.GetFullFileSystemPath());
        }