Beispiel #1
0
        public async Task TestFtpFileStore_Context()
        {
            var dataStore = new ContextFactory().Create <IFtpDataContext>().Store;

            var tasks = Enumerable
                        .Range(0, 3)
                        .Select(i => Task.Run(() =>
            {
                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!");

                _output.WriteLine($"Starting {i}");

                TestDataStore(
                    dataStore,
                    testKey,
                    testValueA,
                    testValueB);

                _output.WriteLine($"Finished {i}");
            }));

            await Task.WhenAll(tasks);
        }
Beispiel #2
0
        public void TestFtpFileStore_FromRoot()
        {
            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 FtpFileStore(
                    host: Host,
                    username: Username,
                    password: Password),
                serializer: new JsonSerializer($"{JsonOptions.Default}"),
                keyMap: "{AccountId}",
                fileExtension: ".json");

            TestDataStore(
                dataStore,
                testKey,
                testValueA,
                testValueB);
        }
Beispiel #3
0
        public async Task TestFtpFileStore_Concurrent()
        {
            int concurrentCount = 30;

            var dataStore = new FileStoreDataStore <TestValue.Key, TestValue>(
                fileStore: new FtpFileStore(
                    host: Host,
                    username: Username,
                    password: Password,
                    maxConcurrentConnections: $"{concurrentCount}"),
                serializer: new JsonSerializer($"{JsonOptions.Default}"),
                keyMap: "test-values/another folder/moar_folder/{AccountId}",
                fileExtension: ".json");

            var tasks = Enumerable
                        .Range(0, concurrentCount)
                        .Select(i => Task.Run(() =>
            {
                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!");

                _output.WriteLine($"Starting {i}");

                TestDataStore(
                    dataStore,
                    testKey,
                    testValueA,
                    testValueB);

                _output.WriteLine($"Finished {i}");
            }));

            await Task.WhenAll(tasks);
        }