public async Task FindEntryNuGetV2MultiThreadWithDelays()
        {
            int    taskCount = 100;
            Random random    = new Random();

            EdmMetadataCache.Clear();

            var tasks = new List <Task>();

            metadataCalls = 0;

            for (var i = 0; i < taskCount; i++)
            {
                if (random.NextDouble() < 0.25)
                {
                    await Task.Delay(random.Next(1, 250));
                }

                tasks.Add(FindEntryNuGetV2());
            }

            await Task.WhenAll(tasks);

            Assert.Equal(1, metadataCalls);
        }
        public async Task FindEntryNuGetV2MultiThread()
        {
            EdmMetadataCache.Clear();

            var tasks = new List <Task>();

            metadataCalls = 0;

            for (var i = 0; i < 10; i++)
            {
                tasks.Add(FindEntryNuGetV2());
            }

            await Task.WhenAll(tasks);

            Assert.Equal(1, metadataCalls);
        }
 /// <summary>
 /// Clears service metadata cache.
 /// </summary>
 public static void ClearMetadataCache()
 {
     EdmMetadataCache.Clear();
 }