示例#1
0
        public void TestLocalFileStore_GZip_Json()
        {
            var rootPath = Path.Combine(
                Directory.GetCurrentDirectory(),
                "test-data-store");

            //if (Directory.Exists(rootPath)) Directory.Delete(rootPath, true);

            var testKey = new TestValue.Key(accountId: Guid.NewGuid());

            var testValueA = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Hello, world!");

            var testValueB = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Kthx, world!");

            var dataStore = new FileStoreDataStore <TestValue.Key, TestValue>(
                fileStore: new LocalFileStore(rootPath: rootPath),
                serializer: new JsonSerializer($"{JsonOptions.Default}"),
                compressor: new GZipCompressor(),
                keyMap: "test-values/{AccountId}",
                fileExtension: ".json.gzip");

            UniversalIntegrationTest.TestDataStore(
                dataStore,
                testKey,
                testValueA,
                testValueB);
        }
        public void TestGoogleDrive()
        {
            var testKey = new TestValue.Key(accountId: Guid.NewGuid());

            var testValueA = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Hello, world!");

            var testValueB = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Kthx, world!");

            var dataStore = new FileStoreDataStore <TestValue.Key, TestValue>(
                fileStore: new GoogleDriveFileStore(
                    applicationName: GetConfig("ApplicationName"),
                    serviceAccountEmail: GetConfig("ServiceAccountEmail"),
                    serviceAccountKey: GetConfig("ServiceAccountKey"),
                    grantAccessToEmails: GetConfig("GrantAccessToEmails")),
                serializer: new JsonSerializer($"{JsonOptions.Default}"),
                keyMap: "test-values/{AccountId}",
                fileExtension: ".json");

            TestDataStore(
                dataStore,
                testKey,
                testValueA,
                testValueB);
        }
        public void TestLocalFileStore_Json()
        {
            InitializeLocalStorage();

            var rootPath = Path.Combine(
                Directory.GetCurrentDirectory(),
                "test-data-store");

            //if (Directory.Exists(rootPath)) Directory.Delete(rootPath, true);

            var testKey = new TestValue.Key(accountId: Guid.NewGuid());

            var testValueA = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Hello, world!");

            var testValueB = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Kthx, world!");

            var dataStore = new FileStoreDataStore <TestValue.Key, TestValue>(
                fileStore: new LocalFileStore(rootPath: rootPath),
                serializer: new JsonSerializer(),
                keyMap: "test-values/{AccountId}",
                fileExtension: ".json");

            TestDataStore(
                dataStore,
                testKey,
                testValueA,
                testValueB);
        }
        public void TestGoogleDrive_Context()
        {
            var testKey = new TestValue.Key(accountId: Guid.NewGuid());

            var testValueA = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Hello, world!");

            var testValueB = new TestValue(
                accountId: testKey.AccountId.Value,
                message: "Kthx, world!");

            var dataStore = new ContextFactory(new ConfigurationProvider(k => GetConfig(k)))
                            .Create <IGoogleDriveTestDataContext>().Store;

            TestDataStore(
                dataStore,
                testKey,
                testValueA,
                testValueB);
        }