private static async Task Iterations(AuditBase audit) { for (int i = 0; i < 3500; i++) { await audit.WriteMessage(1, i, Guid.NewGuid(), Guid.NewGuid(), _messages[i % _msgCount]); } }
private static async Task Run(AuditBase audit) { List <Task> tasks = new List <Task>(_taskCount); for (int i = 0; i < _taskCount; i++) { tasks.Add(Task.Run(async() => { await Iterations(audit); })); } await Task.WhenAll(tasks); }