public void GetIdStringTest() { if (_appConfig.IdWorkerProvid is not IdWorkerProvidType.Redis) { return; } if (_cacheConfig.Type is not CacheType.Redis) { return; } var list = new List <string>(10_0000); var tasks = new Task[100]; for (int i = 0; i < tasks.Length; i++) { tasks[i] = Task.Run(() => { for (int i = 0; i < 1000; i++) { var id = _idWorker.GetIdString(); list.Add(id); } }); } Task.WaitAll(tasks); var set = new HashSet <string>(list); if (set.Count != list.Count) { Assert.Fail(); } }
public void GetIdStringTest() { var list = new List <string>(10_0000); var tasks = new Task[100]; for (int i = 0; i < tasks.Length; i++) { tasks[i] = Task.Run(() => { for (int i = 0; i < 1000; i++) { var id = _idWorker.GetIdString(); list.Add(id); } }); } Task.WaitAll(tasks); var set = new HashSet <string>(list); if (set.Count != list.Count) { Assert.Fail(); } }