public void EnsureBadCodeDoesntBreak() { try { PubTatorHandler.GetInstance().GetArticleByPmId("fdsfds"); } catch (Exception e) { Assert.Fail(); } }
SearchData.DisplayData[] GetResponses(string[] ids) { Console.WriteLine("CheckAgain"); var i = 0; var displayDatas = new List <SearchData.DisplayData>(); foreach (var response in PubTatorHandler.GetInstance().GetArticleByPmId(ids)) { var termArray = SearchData.Query?.Split(" ").Where( s => !string.IsNullOrWhiteSpace(s)).ToList(); var data = new SearchData.DisplayData { Database = "PubMed", Confidence = Math.Round(response.ComputeRelevance(termArray?.ToArray())), Pmid = ids[i], Title = response.Passages[0].Text, Tags = new List <Annotation>() }; var duplicates = new List <string>(); foreach (var annotation in from passage in response.Passages where passage.Annotations.Count > 0 from annotation in passage.Annotations where !duplicates.Contains(annotation.Infons["identifier"]) select annotation) { Console.WriteLine("{0}:\t{1}\t{2}", annotation.Infons["type"], annotation.Infons["identifier"], annotation.Text); data.Tags.Add(annotation); duplicates.Add(annotation.Infons["identifier"]); } displayDatas.Add(data); i++; } return(displayDatas.ToArray()); }