Exemple #1
0
        public async Task UpdateValueTest()
        {
            var revision = 0;

            async Task <int> update()
            {
                var r = Interlocked.Increment(ref revision);
                await Task.Delay(10);

                return(r);
            }

            var asyncCache = new AsyncCache <int>(update);
            await asyncCache.Task;
            var result = await asyncCache.UpdateAsync();

            Assert.AreEqual(revision, result);
        }