public async Task <ContentResult> LatestTestResult() { var mongoconnection = ConfigurationManager.AppSettings["mongo"]; var database = ConfigurationManager.AppSettings["mongodb"]; var mongoClient = new MongoClient(mongoconnection); var server = mongoClient.GetServer(); server.Connect(); var db = server.GetDatabase(database); var collection = db.GetCollection("testresults"); var query = new SortByBuilder(); query.Descending("Timestamp"); var latestDocument = collection.FindAllAs <BsonDocument>().SetSortOrder(query).SetLimit(1); server.Disconnect(); var jsonWriterSettings = new JsonWriterSettings { OutputMode = JsonOutputMode.Strict }; var json = latestDocument.ToJson(jsonWriterSettings); return(Content(json, "application/json")); }
public static SortByBuilder BuildSortByBuilder(string sortbyExpression) { try { // create sort order builder SortByBuilder builder = new SortByBuilder(); string[] splitSortExpr = sortbyExpression.Split(','); foreach (string s in splitSortExpr) { string[] splitSort = s.Split(':'); if (splitSort[1].Equals("1")) { builder.Ascending(new string[] { splitSort[0].ToString() }); } else { builder.Descending(new string[] { splitSort[0].ToString() }); } } return(builder); } catch (Exception) { throw; } }
/// <summary> /// 获得排序 /// </summary> /// <returns></returns> public static SortByBuilder GetSort(List <DataFilter.QueryFieldItem> FieldItemLst) { var sort = new SortByBuilder(); List <String> ascendingList = new List <String>(); List <String> descendingList = new List <String>(); //_id将以文字的形式排序,所以不要排序_id!! foreach (var item in FieldItemLst) { switch (item.sortType) { case DataFilter.SortType.NoSort: break; case DataFilter.SortType.Ascending: ascendingList.Add(item.ColName); break; case DataFilter.SortType.Descending: descendingList.Add(item.ColName); break; default: break; } } sort.Ascending(ascendingList.ToArray()); sort.Descending(descendingList.ToArray()); return(sort); }
/// <summary> /// 获得排序 /// </summary> /// <returns></returns> public static SortByBuilder GetSort(List <DataFilter.QueryFieldItem> fieldItemLst) { var sort = new SortByBuilder(); //排序 fieldItemLst.Sort((x, y) => { return(x.SortOrder - y.SortOrder); }); foreach (var item in fieldItemLst) { if (item.SortOrder == 0) { continue; } switch (item.SortType) { case DataFilter.SortType.NoSort: break; case DataFilter.SortType.Ascending: sort.Ascending(item.ColName); break; case DataFilter.SortType.Descending: sort.Descending(item.ColName); break; } } return(sort); }
/// <summary> /// </summary> /// <returns></returns> public static SortByBuilder GetSort(List <DataFilter.QueryFieldItem> fieldItemLst) { var sort = new SortByBuilder(); var ascendingList = new List <string>(); var descendingList = new List <string>(); foreach (var item in fieldItemLst) { switch (item.SortType) { case DataFilter.SortType.NoSort: break; case DataFilter.SortType.Ascending: ascendingList.Add(item.ColName); break; case DataFilter.SortType.Descending: descendingList.Add(item.ColName); break; } } sort.Ascending(ascendingList.ToArray()); sort.Descending(descendingList.ToArray()); return(sort); }
public List <Match> GetRecentMatches(int numberOfMatches) { var sbb = new SortByBuilder(); sbb.Descending("TimeStampUtc"); var matches = Collection.FindAllAs <Match>().SetSortOrder(sbb).SetLimit(numberOfMatches).ToList(); return(matches); }
public IEnumerable <IEnumerable <KeyValuePair <string, object> > > Find(string entityName, QueryObject query, QuerySortObject[] sort, int?skip, int?limit) { var mongoCollection = MongoStaticContext.Context.GetBsonCollection(RECORD_COLLECTION_PREFIX + entityName); var mongoQuery = ConvertQuery(query); var cursor = mongoCollection.Find(mongoQuery); if (sort != null && sort.Length > 0) { SortByBuilder sortBy = null; foreach (var s in sort) { if (s.SortType == QuerySortType.Ascending) { sortBy = sortBy == null?SortBy.Ascending(s.FieldName) : sortBy.Ascending(s.FieldName); } else { sortBy = sortBy == null?SortBy.Descending(s.FieldName) : sortBy.Descending(s.FieldName); } } cursor.SetSortOrder(sortBy); } if (skip.HasValue) { cursor.SetSkip(skip.Value); } if (limit.HasValue) { cursor.SetLimit(limit.Value); } List <List <KeyValuePair <string, object> > > result = new List <List <KeyValuePair <string, object> > >(); foreach (BsonDocument doc in cursor) { List <KeyValuePair <string, object> > record = new List <KeyValuePair <string, object> >(); foreach (var fieldName in doc.Names) { if (fieldName == "_id") { record.Add(new KeyValuePair <string, object>("id", BsonTypeMapper.MapToDotNetValue(doc["_id"]))); } else { record.Add(new KeyValuePair <string, object>(fieldName, ConvertBsonValueToObject(doc[fieldName]))); } } result.Add(record); } return(result); }
public MongoSortWarpper Desc(params string[] keys) { if (MongoSortBy == null) { MongoSortBy = SortBy.Descending(keys); } else { MongoSortBy = MongoSortBy.Descending(keys); } return(this); }
protected virtual IMongoSortBy BuildSortExpression(TFilter filter) { IMongoSortBy sort = SortBy.Null; if (filter.Ordering.Any()) { var builder = new SortByBuilder(); foreach (var order in filter.Ordering) { builder = order.Desc ? builder.Descending(order.Key) : builder.Ascending(order.Key); } sort = builder; } return(sort); }
private static SortByBuilder GetSortOrder(IEnumerable <string> sortBy) { var builder = new SortByBuilder(); foreach (var field in sortBy) { if (field[0] == '-') { builder.Descending(field.Substring(1)); } else { builder.Ascending(field); } } return(builder); }
public void BufferedLogsRecordedTest() { Log.Info("a log 1"); Log.Info("a log 2"); Log.Info("a log 3"); Log.Info("a log 4"); Log.Info("a log 5"); SortByBuilder sbb = new SortByBuilder(); sbb.Descending("_id"); var allDocs = collection.FindAllAs <BsonDocument>().SetSortOrder(sbb).SetLimit(5); BsonDocument doc = allDocs.First(); Assert.AreEqual(doc.GetElement("message").Value.AsString, "a log 5"); }
public static SortByBuilder GetSort(TaskQueue.TQItemSelector selector) { SortByBuilder sb = new SortByBuilder(); foreach (KeyValuePair <string, TaskQueue.TQItemSelectorParam> kv in selector.parameters) { switch (kv.Value.ValueSet) { case TaskQueue.TQItemSelectorSet.Ascending: sb = sb.Ascending(kv.Key); break; case TaskQueue.TQItemSelectorSet.Descending: sb = sb.Descending(kv.Key); break; } } return(sb); }
/// <summary> /// Converts PS objects to a SortBy object. /// </summary> /// <param name="values">Strings or @{Name=Boolean}. Null and empty is allowed.</param> /// <returns>SortBy object, may be empty but not null.</returns> public static IMongoSortBy ObjectsToSortBy(IEnumerable values) { if (values == null) { return(SortBy.Null); } var builder = new SortByBuilder(); foreach (var it in values) { var name = it as string; if (name != null) { builder.Ascending(name); continue; } var hash = it as IDictionary; if (hash == null) { throw new ArgumentException("SortBy: Invalid size object type."); } if (hash.Count != 1) { throw new ArgumentException("SortBy: Expected a dictionary with one entry."); } foreach (DictionaryEntry kv in hash) { name = kv.Key.ToString(); if (LanguagePrimitives.IsTrue(kv.Value)) { builder.Ascending(name); } else { builder.Descending(name); } } } return(builder); }
private void ConnectBtn_Click(object sender, EventArgs e) { try { mongo = new MongoDBHelper(DbAddressTxt.Text + ":" + PortTxt.Text, DbNameTxt.Text, CollectionNameTxt.Text); } catch (FormatException) { MessageBox.Show("Please Make Sure All Fields Entered Correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } SortByBuilder sbb = new SortByBuilder(); sbb.Descending("_id"); var lastDocs = mongo.collection.FindAllAs <BsonDocument>().SetSortOrder(sbb).SetLimit(15); ArrayList keyList = new ArrayList(); foreach (BsonDocument lastDoc in lastDocs) { BsonObjectId id = lastDoc["_id"].AsObjectId; BsonDocument testRun = lastDoc["TestRun"].AsBsonDocument; string testRunName = testRun["@testRunName"].AsString; string userName = testRun["@userName"].AsString; string timeStamp = testRun["@timeStamp"].AsString; string hashtableKey = @"""" + testRunName + @""" """ + userName + @""" """ + timeStamp + @""""; //Track the order of each test run keyList.Add(hashtableKey); } for (int i = 0; i < keyList.Count; i++) { TestRunComboBox.Items.Insert(i, keyList[i]); CompareTestComboBox.Items.Insert(i, keyList[i]); //temporary to fill box BaseComboBox.Items.Insert(i, keyList[i]); } ReadyLbl.Text = "Connection Successful"; GetTestRunBtn.Enabled = true; GetDataByDaysBtn.Enabled = true; CompareSubmitBtn.Enabled = true; //add logic to focus depending on selected tab TestRunComboBox.Focus(); }
public void LogExceptionRecorded() { try { throw new ApplicationException("BOOM"); } catch (Exception e) { Log.Fatal("a log", e); } SortByBuilder sbb = new SortByBuilder(); sbb.Descending("_id"); var allDocs = collection.FindAllAs <BsonDocument>().SetSortOrder(sbb).SetLimit(1); BsonDocument doc = allDocs.First(); Assert.IsTrue(doc.GetElement("exception").Value is BsonString); Assert.IsTrue(doc.GetElement("exception").Value.AsString.IndexOf("BOOM", StringComparison.Ordinal) > -1); }
private static SortByBuilder AddSorting(SortByBuilder sortBy, string sortDirection, string dbSortField) { //SortByBuilder sortBy; switch (sortDirection) { case "+": { sortBy = sortBy.Ascending(dbSortField); } break; case "-": { sortBy = sortBy.Descending(dbSortField); } break; default: sortBy = sortBy.Ascending(dbSortField); break; } return(sortBy); }
public List <T> Page <T>(DbQueryParams qParams) where T : class, new() { // First query part consists of search params with specified operator between List <IMongoQuery> queries = new List <IMongoQuery>(); foreach (var item in qParams.QueryParams) { queries.Add(Query.Matches(item.Key, new BsonRegularExpression(String.Format("(?:{0})", item.Value), "is"))); } var query = qParams.Operator == QueryOperator.AND ? Query.And(queries) : Query.Or(queries); MongoCursor <T> cursor = mongoDb.GetCollection <T>(GetTypeName(typeof(T))).Find(query); cursor.SetSkip(qParams.SkipRecords).SetLimit(qParams.Count); // Setting the Sort params if (qParams.SortParams != null && qParams.SortParams.Count > 0) { SortByBuilder sbb = new SortByBuilder(); foreach (KeyValuePair <string, bool> sortItem in qParams.SortParams) { if (sortItem.Value) { sbb.Ascending(sortItem.Key); } else { sbb.Descending(sortItem.Key); } } cursor.SetSortOrder(sbb); } return(cursor.ToList()); }
private void ApplySorting(MongoCursor <BsonDocument> cursor, IEnumerable <SimpleOrderByItem> orderings) { if (orderings == null || !orderings.Any()) { return; } var sortBuilder = new SortByBuilder(); foreach (var ordering in orderings) { var name = ExpressionFormatter.GetFullName(ordering.Reference); if (ordering.Direction == OrderByDirection.Ascending) { sortBuilder.Ascending(name); } else { sortBuilder.Descending(name); } } cursor.SetSortOrder(sortBuilder); }
public virtual object Execute() { var visitor = new MongoDBVisitor(); visitor.Visite(ContentQuery.Expression); var mongoCursor = Query(visitor); if (mongoCursor == null) { return(DefaultValueExecute(visitor.CallType)); } if (visitor.Skip != 0) { mongoCursor.Skip = visitor.Skip; } SortByBuilder sortBuilder = new SortByBuilder(); foreach (var item in visitor.OrderFields) { if (item.Descending) { sortBuilder.Descending(item.FieldName); } else { sortBuilder.Ascending(item.FieldName); } } mongoCursor = mongoCursor.SetSortOrder(sortBuilder); object result = null; switch (visitor.CallType) { case Kooboo.CMS.Content.Query.Expressions.CallType.Count: result = Convert.ToInt32(mongoCursor.Count()); break; case Kooboo.CMS.Content.Query.Expressions.CallType.First: result = mongoCursor.First().ToContent(); break; case Kooboo.CMS.Content.Query.Expressions.CallType.Last: result = mongoCursor.Last().ToContent(); break; case Kooboo.CMS.Content.Query.Expressions.CallType.LastOrDefault: result = mongoCursor.Last().ToContent(); break; case Kooboo.CMS.Content.Query.Expressions.CallType.FirstOrDefault: result = mongoCursor.FirstOrDefault().ToContent(); break; case Kooboo.CMS.Content.Query.Expressions.CallType.Unspecified: default: if (visitor.Take != 0) { result = mongoCursor.Take(visitor.Take).Select(it => it.ToContent()); } else { result = mongoCursor.Select(it => it.ToContent()); } break; } if (mongoCursor.Database.Server.State != MongoServerState.Disconnected) { mongoCursor.Database.Server.Disconnect(); } return(result); }
/// <summary> /// Analyze the data in the Mongodb, and put associated data in to different tables /// </summary> /// <returns>Returns true when finshed analyzing data</returns> public bool AnalyzeData(int dropDownIndex, int days) { DateTime date = DateTime.Now.Subtract(TimeSpan.FromDays(days)); SortByBuilder sbb = new SortByBuilder(); sbb.Descending("_id"); var lastDocs = collection.FindAllAs <BsonDocument>().SetSortOrder(sbb).SetLimit(15); Hashtable idRunNameTable = new Hashtable(); ArrayList keyList = new ArrayList(); foreach (BsonDocument lastDoc in lastDocs) { BsonObjectId id = lastDoc["_id"].AsObjectId; BsonDocument testRun = lastDoc["TestRun"].AsBsonDocument; string testRunName = testRun["@testRunName"].AsString; string userName = testRun["@userName"].AsString; string timeStamp = testRun["@timeStamp"].AsString; string hashtableKey = @"""" + testRunName + @""" """ + userName + @""" """ + timeStamp + @""""; idRunNameTable.Add(hashtableKey, id); //Track the order of each test run keyList.Add(hashtableKey); } BsonObjectId objectId = null; if (dropDownIndex >= 0) { objectId = (BsonObjectId)idRunNameTable[keyList[dropDownIndex]]; } bool ret = false; successAllConfigTable = new Hashtable(); failAllConfigTable = new Hashtable(); successConfigTable = new Hashtable(); failConfigTable = new Hashtable(); //var projectNames = collection.Distinct("TestRun.Configuration.test-results.@project-name").ToList(); Hashtable projectAutomationTable = this.GetProjectAutomationTable(objectId, days); var filteredTable = projectAutomationTable.Cast <DictionaryEntry>().Where(x => ((ArrayList)x.Value).Count != 0).ToDictionary(x => (string)x.Key, x => (ArrayList)x.Value); var projectNames = filteredTable.Keys; int progress = 0; int totalNumProject = projectNames.Count; foreach (string project in projectNames) { ArrayList automationNameList = (ArrayList)filteredTable[project]; int report = progress * 100 / totalNumProject; OnProgressUpdate(report); foreach (string automation in automationNameList) { MongoCursor <BsonDocument> testSuccess = null; if (dropDownIndex == -1) { var queryResults1 = Query.And(Query.GT("Date", date), Query.ElemMatch("TestRun.Configuration.test-results", Query.And( Query.EQ("@project-name", project), Query.ElemMatch("test-suite.results.test-case", Query.And( Query.EQ("@name", automation), Query.EQ("@success", "True")))))); testSuccess = collection.Find(queryResults1); } else { var queryResults1 = Query.And(Query.EQ("_id", objectId), Query.ElemMatch("TestRun.Configuration.test-results", Query.And( Query.EQ("@project-name", project), Query.ElemMatch("test-suite.results.test-case", Query.And( Query.EQ("@name", automation), Query.EQ("@success", "True")))))); testSuccess = collection.Find(queryResults1); } MongoCursor <BsonDocument> testAll; if (dropDownIndex == -1) { var queryResults2 = Query.And(Query.GT("Date", date), Query.ElemMatch("TestRun.Configuration.test-results", Query.And( Query.EQ("@project-name", project), Query.ElemMatch("test-suite.results.test-case", Query.EQ("@name", automation))))); testAll = collection.Find(queryResults2); } else { var queryResults2 = Query.And(Query.EQ("_id", objectId), Query.ElemMatch("TestRun.Configuration.test-results", Query.And( Query.EQ("@project-name", project), Query.ElemMatch("test-suite.results.test-case", Query.EQ("@name", automation))))); testAll = collection.Find(queryResults2); } MongoCursor <BsonDocument> testFail; if (dropDownIndex == -1) { var queryResults3 = Query.And(Query.GT("Date", date), Query.ElemMatch("TestRun.Configuration.test-results", Query.And( Query.EQ("@project-name", project), Query.ElemMatch("test-suite.results.test-case", Query.And( Query.EQ("@name", automation), Query.EQ("@success", "False")))))); testFail = collection.Find(queryResults3); } else { var queryResults3 = Query.And(Query.EQ("_id", objectId), Query.ElemMatch("TestRun.Configuration.test-results", Query.And( Query.EQ("@project-name", project), Query.ElemMatch("test-suite.results.test-case", Query.And( Query.EQ("@name", automation), Query.EQ("@success", "False")))))); testFail = collection.Find(queryResults3); } if (testSuccess.Count() != testAll.Count() && testSuccess.Count() != 0) { IEnumerable <BsonDocument> diffs = testAll.Except(testSuccess); foreach (BsonDocument diffBson in diffs) { BsonDocument testRun = diffBson["TestRun"].AsBsonDocument; string version = testRun["@runtimeVersion"].AsString; var failQuery = Query.And( Query.EQ("@project-name", project), Query.EQ("@runtime-version", version), Query.ElemMatch("failures.automation", Query.And( Query.EQ("@name", automation), Query.EQ("@success", "False")))); MongoCursor <BsonDocument> failCursor = failCollection.Find(failQuery); List <Automation> failureAutomationList = new List <Automation>(); BsonArray failAutomation = new BsonArray(); if (failCursor.Count() != 0) { BsonDocument failTypeDoc = failCursor.First(); BsonDocument failures = failTypeDoc["failures"].AsBsonDocument; var failAutoJson = failures.ToJson(); failureAutomationList = JsonConvert.DeserializeObject <Failures>(failAutoJson).automation; } string failureType = string.Empty; string failureMsg = string.Empty; if (failureAutomationList.Count != 0) { var failAutomationWithName = failureAutomationList.Find(x => x.name.Equals(automation)); var failStatus = failAutomationWithName.status; failureType = failStatus.failureType; failureMsg = failStatus.message; } BsonArray configs = testRun["Configuration"].AsBsonArray; foreach (BsonDocument config in configs) { var configJson = config.ToJson(); var configDeserial = JsonConvert.DeserializeObject <Configuration>(configJson); string templateName = configDeserial.templateName; var testResultsDeserial = configDeserial.testResults; var testResultOnProject = testResultsDeserial.Find(x => x.projectName.Equals(project)); var testSuite = testResultOnProject.testSuite; var testResults = testSuite.results; var testCase = testResults.TestCases; var unitTestResult = testCase.Find(x => x.name.Equals(automation)); //To be done string errorMsg = string.Empty; if (failCursor.Count() == 0) { failureType = "Failure"; } if (failConfigTable.ContainsKey(templateName) == false) { Hashtable projectTable = new Hashtable(); ArrayList list = new ArrayList(); Hashtable detailTable = new Hashtable(); list.Add(failureType); list.Add(version); list.Add(errorMsg); detailTable.Add(automation, list); projectTable.Add(project, detailTable); failConfigTable.Add(templateName, projectTable); } else { Hashtable table = (Hashtable)failConfigTable[templateName]; if (table == null) { table = new Hashtable(); } if (table.ContainsKey(project)) { Hashtable errorTable = (Hashtable)table[project]; if (errorTable.ContainsKey(automation) == false) { ArrayList list = new ArrayList(); list.Add(failureType); list.Add(version); list.Add(errorMsg); errorTable.Add(automation, list); table[project] = errorTable; } } else { Hashtable errorTable = new Hashtable(); ArrayList list = new ArrayList(); list.Add(failureType); list.Add(version); list.Add(errorMsg); errorTable.Add(automation, list); table.Add(project, errorTable); } failConfigTable[templateName] = table; } } } } if (testAll.Count() != testFail.Count() && testFail.Count() != 0) { IEnumerable <BsonDocument> diff = testAll.Except(testFail); foreach (BsonDocument diffBson in diff) { BsonDocument testRun = diffBson["TestRun"].AsBsonDocument; string version = testRun["@runtimeVersion"].AsString; BsonArray configs = testRun["Configuration"].AsBsonArray; foreach (BsonDocument config in configs) { var configJson = config.ToJson(); var configDeserial = JsonConvert.DeserializeObject <Configuration>(configJson); string templateName = configDeserial.templateName; var testResultsDeserial = configDeserial.testResults; var testResultOnProject = testResultsDeserial.Find(x => x.projectName.Equals(project)); var testSuite = testResultOnProject.testSuite; var testResults = testSuite.results; var testCase = testResults.TestCases; var unitTestResult = testCase.Find(x => x.name.Equals(automation)); if (successConfigTable.ContainsKey(templateName) == false) { Hashtable projectTable = new Hashtable(); Hashtable detailTable = new Hashtable(); ArrayList list = new ArrayList(); list.Add(version); detailTable.Add(automation, list); projectTable.Add(project, detailTable); successConfigTable.Add(templateName, projectTable); } else { Hashtable table = (Hashtable)successConfigTable[templateName]; if (table == null) { table = new Hashtable(); } if (table.ContainsKey(project) == true) { Hashtable detailTable = (Hashtable)table[project]; ArrayList list = new ArrayList(); if (detailTable.ContainsKey(automation) == false) { list.Add(version); detailTable.Add(automation, list); } else { list = (ArrayList)detailTable[automation]; list.Add(version); detailTable[automation] = list; } table[project] = detailTable; } else { Hashtable detailTable = new Hashtable(); ArrayList list = new ArrayList(); if (detailTable.ContainsKey(automation) == false) { list.Add(version); detailTable.Add(automation, list); } table.Add(project, detailTable); } successConfigTable[templateName] = table; } } } } if (testFail.Count() == 0) { BsonDocument first = testSuccess.First(); string version = this.GetRuntimeVersion(first); if (successAllConfigTable.ContainsKey(project) == false) { ArrayList list = new ArrayList(); list.Add(version); Hashtable table = new Hashtable(); table.Add(automation, list); successAllConfigTable.Add(project, table); } else { Hashtable table = (Hashtable)successAllConfigTable[project]; ArrayList list = (ArrayList)table[automation]; if (list == null) { list = new ArrayList(); } list.Add(version); table[automation] = list; successAllConfigTable[project] = table; } } if (testSuccess.Count() == 0) { BsonDocument first = testFail.First(); string version = this.GetRuntimeVersion(first); var failQuery = Query.And( Query.EQ("@project-name", project), Query.EQ("@runtime-version", version), Query.ElemMatch("failures.automation", Query.And( Query.EQ("@name", automation), Query.EQ("@success", "False")))); MongoCursor <BsonDocument> failCursor = failCollection.Find(failQuery); List <Automation> failureAutomationList = new List <Automation>(); BsonArray failAutomation = new BsonArray(); if (failCursor.Count() != 0) { BsonDocument failTypeDoc = failCursor.First(); BsonDocument failures = failTypeDoc["failures"].AsBsonDocument; var failAutoJson = failures.ToJson(); failureAutomationList = JsonConvert.DeserializeObject <Failures>(failAutoJson).automation; } string failureType = string.Empty; string failureMsg = string.Empty; if (failureAutomationList.Count != 0) { var failAutomationWithName = failureAutomationList.Find(x => x.name.Equals(automation)); var failStatus = failAutomationWithName.status; failureType = failStatus.failureType; failureMsg = failStatus.message; } if (failCursor.Count() == 0) { failureType = "Failure"; } string errorMsg = string.Empty; foreach (BsonDocument fail in testFail) { BsonDocument testRun = fail["TestRun"].AsBsonDocument; BsonArray configs = testRun["Configuration"].AsBsonArray; foreach (BsonDocument config in configs) { var configJson = config.ToJson(); var configDeserial = JsonConvert.DeserializeObject <Configuration>(configJson); string templateName = configDeserial.templateName; var testResultsDeserial = configDeserial.testResults; var testResultOnProject = testResultsDeserial.Find(x => x.projectName.Equals(project)); var testSuite = testResultOnProject.testSuite; var testResults = testSuite.results; var testCase = testResults.TestCases; var unitTestResult = testCase.Find(x => x.name.Equals(automation)); //To be done errorMsg = string.Empty; } } if (failAllConfigTable.ContainsKey(project) == false) { ArrayList list = new ArrayList(); list.Add(failureType); list.Add(version); list.Add(errorMsg); Hashtable table = new Hashtable(); table.Add(automation, list); failAllConfigTable.Add(project, table); } else { Hashtable table = (Hashtable)failAllConfigTable[project]; ArrayList list = (ArrayList)table[automation]; if (list == null) { list = new ArrayList(); } list.Add(failureType); list.Add(version); list.Add(errorMsg); table[automation] = list; failAllConfigTable[project] = table; } } } progress++; } OnProgressUpdate(100); ret = true; return(ret); }