Beispiel #1
0
        public async Task ClearCacheTest1Async()
        {
            var propertyManager = new MockPropertyManagerWrapper
            {
                SubmitPropertyBatchAsyncFunc = Workflow3
            };

            Guid activityId = Guid.NewGuid();

            IVersionedPropertyStore versionedPropertyStore = await VersionedPropertyStore.CreateAsync(
                activityId, traceType, defaultStoreName, propertyManager, retryPolicyFactory).ConfigureAwait(false);

            IVersionedKeyValue vkv = await versionedPropertyStore.GetValueAsync(activityId, "A").ConfigureAwait(false);

            VerifyVersionedKeyValue(vkv, "Apple", 2, 1, workflow3Counter);

            IVersionedKeyValue vkv2 = await versionedPropertyStore.GetValueAsync(activityId, "A").ConfigureAwait(false);

            // verify that the counter hasn't been incremented since the actual property manager hasn't been invoked
            // but the value has been obtained from the cache
            VerifyVersionedKeyValue(vkv2, "Apple", 2, 1, workflow3Counter);

            versionedPropertyStore.ClearCache();

            IVersionedKeyValue vkv3 = await versionedPropertyStore.GetValueAsync(activityId, "A").ConfigureAwait(false);

            // verify that the counter has been incremented since the actual property manager has been invoked
            // since the value has been cleared from the cache
            VerifyVersionedKeyValue(vkv3, "Apple", 2, 2, workflow3Counter);

            Assert.AreEqual(workflow3Counter, 2);
        }
 public void ClearCache()
 {
     versionedPropertyStore.ClearCache();
 }