private async Task GetCallTreeAsync() { List <AppProxy> appProxiesModelList = _applicationServices.GetProxyObjects().ToList(); var applicationList = ApplicationTranslator.ToModel(appProxiesModelList); //list that stores task objects and after they all finished work with them List <Task <string> > tasks = new List <Task <string> >(); foreach (var environment in _environment) { foreach (var app in applicationList) { string application = app.ApplicationName; string callTreeApi = "https://chatops.common.cnxloyalty.com/api/calltree/" + application + "/" + environment; tasks.Add(GetCallTreeJsonString(callTreeApi)); //string callTreeString = Task.Run(() => GetCallTreeJsonString(callTreeApi)); } } var results = await Task.WhenAll(tasks); foreach (var item in results) { try { List <CallTreeProxy> jsonCallProxy = JsonConvert.DeserializeObject <List <CallTreeProxy> >(item); callTreeProxyList.Add(jsonCallProxy[0]); } catch (Exception ex) { Log.Information(ex.Message.ToString()); } } }
public void Testing_Application_DB_Model_Return_By_Application_Translator_Services() { var appplicationProxyModel = _applicationServices.GetProxyObjects().ToList(); var applicationDbModel = ApplicationTranslator.ToModel(appplicationProxyModel); Assert.IsType <Application>(applicationDbModel[0]); }