Ejemplo n.º 1
0
        public async Task ShouldSendsTasksInParallel()
        {
            var slowClass = new SlowClassAsync();

            await AsyncRepeater.Go(nomberOfTests, async() => await slowClass.ProcessSlowly());

            Assert.AreEqual(nomberOfTests, slowClass.Counter);
        }
Ejemplo n.º 2
0
        public async Task ParallelAccessToAsyncMethod()
        {
            var slowClass = new SlowClassAsync();

            await AsyncRepeater.Go(numberOfTests, () => cache.BlitzGet(slowClass.ProcessQuickly));

            Assert.AreEqual(1, slowClass.Counter);
        }
Ejemplo n.º 3
0
        public async Task DifferentKeysWillCallTheAsyncMethodAgain()
        {
            var slowClass = new SlowClassAsync();

            var key1 = Guid.NewGuid().ToString();
            await AsyncRepeater.Go(numberOfTests, () => cache.BlitzGet(key1, slowClass.ProcessQuickly));

            var key2 = Guid.NewGuid().ToString();
            await AsyncRepeater.Go(numberOfTests, () => cache.BlitzGet(key2, slowClass.ProcessQuickly));

            Assert.AreEqual(2, slowClass.Counter);
        }