コード例 #1
0
        public async void InsertGetIntsTest(int iteration)
        {
            var key   = FakeDataGenerator.RandomString(iteration);
            var value = new Random().Next();

            var coreAppSettings = new PrivateWiki.Services.KeyValueCaches.InMemoryCache();
            await coreAppSettings.InsertAsync(key, value);

            var actual = await coreAppSettings.GetIntAsync(key);

            Assert.True(actual.IsSuccess);
            Assert.Equal(value, actual.Value);
        }
コード例 #2
0
        public async void InsertGetObjectsTest()
        {
            var key = FakeDataGenerator.RandomString(10);

            var value = new TestObject();

            var coreAppSettings = new PrivateWiki.Services.KeyValueCaches.InMemoryCache();
            await coreAppSettings.InsertAsync(key, value);

            var result = await coreAppSettings.GetObjectAsync <TestObject>(key);

            Assert.True(result.IsSuccess);

            var actual = result.Value;

            Assert.Equal(value.test1, actual.test1);
            Assert.Equal(value.test2, actual.test2);
            Assert.Equal(value.test3, actual.test3);
        }