public async Task TestRepeatConnectAsync(Int64 testUniqueId) { var startTime = DateTime.Now; var testResults = new List <Task <(bool, string)> >(); for (int i = 0; i < DummyList.Count; ++i) { var dummy = DummyList[i]; testResults.Add(Task <(bool, string)> .Run(() => ActionNetConnect.RepeatConnectAsync(dummy, Config, IsInProgress))); } await Task.WhenAll(testResults.ToArray()); TestResultMgr.AddTestResult(testUniqueId, Config.ActionCase, DummyList, startTime); }
public async Task TestRepeatEchoAsync(Int64 testUniqueId, EchoCondition echoCondi) { var startTime = DateTime.Now; var testResults = new List <Task <(bool, string)> >(); for (int i = 0; i < DummyList.Count; ++i) { var dummy = DummyList[i]; testResults.Add(Task <(bool, string)> .Run(async() => { var echoAction = new ActionEcho(); return(await echoAction.EchoAsync(dummy, echoCondi)); })); } await Task.WhenAll(testResults.ToArray()); TestResultMgr.AddTestResult(testUniqueId, Config.ActionCase, DummyList, startTime); }
public async Task RunAction(Int64 testUniqueId, TestCase testType, TestConfig config) { var testResults = new List <Task <(int, bool, string)> >(); var actionList = new List <ActionBase>(); var startTime = DateTime.Now; testResults.Capacity = DummyList.Count; actionList.Capacity = DummyList.Count; for (int i = 0; i < DummyList.Count; ++i) { var dummy = DummyList[i]; var action = MakeActionFactory(testType, config); action.Before(dummy); actionList.Add(action); if (config.DummyIntervalTime > 0) { await Task.Delay(config.DummyIntervalTime); } testResults.Add(Task <(int, bool, string)> .Run(() => { return(action.Run(dummy, config)); })); } await Task.WhenAll(testResults.ToArray()); TestResultMgr.AddTestResult(testUniqueId, testType, DummyList, startTime, testResults); foreach (var action in actionList) { action.After(); } }