Ejemplo n.º 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 TestLocalFileStore_BondSimpleXml()
        {
            InitializeLocalStorage();

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

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

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

            var testValueA = new BondTestValue
            {
                AccountId = testKey.AccountId.Value,

                Message = "Hello, world!"
            };

            var testValueB = new BondTestValue
            {
                AccountId = testKey.AccountId.Value,

                Message = "Kthx, world!"
            };

            var dataStore = new FileStoreDataStore <BondTestValueKey, BondTestValue>(
                fileStore: new LocalFileStore(rootPath: rootPath),
                serializer: new BondSimpleXmlSerializer(),
                keyMap: "test-values/{AccountId}",
                fileExtension: ".bond.xml");

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