//Tests the getCategories method public void Test1() { CategoriesStorageImp ss = new CategoriesStorageImp(); //trying to get the categories of the task which his task id is : //"7ec2bfb1-0a0d-406b-9132-2d65abb811f0" List <Category> categories = ss.getCategories("7ec2bfb1-0a0d-406b-9132-2d65abb811f0"); Console.WriteLine("[] Categories saved for the taskID : \"7ec2bfb1-0a0d-406b-9132-2d65abb811f0\" "); foreach (Category category in categories) { Console.WriteLine("CategoryID : " + category.getCategoryID()); Console.WriteLine("CategoryName : " + category.getCatrgoryName()); Console.Write("Keywords : "); if (category.getKeywordList() != null) { foreach (String keyword in category.getKeywordList()) { Console.Write(keyword + " "); } } Console.WriteLine(""); Console.WriteLine("ParentCategory : " + category.getParentName()); Console.WriteLine("ConfidenceLevel : " + category.getConfidenceLevel()); Console.WriteLine("============================================================="); } if (categories.Count == 0) { Console.WriteLine("Test Not Found !!"); } Console.WriteLine(" - PASSED -"); Console.WriteLine("============================================================="); }
//Tests all the methods when the data searched for does not exist in the data base public void Test4() { CategoriesStorageImp ss = new CategoriesStorageImp(); //Trying to call the method with task id that does not exist in the data base List <Category> categories = ss.getCategories("7562bfb1-0a0d-406b-9132-2d65abb811f0"); if (categories.Count == 0) { Console.WriteLine(" - PASSED -"); } }
/** * returns the category list of the specified task */ public List <Category> getCategories(String taskId) { return(_categoriesStorageImp.getCategories(taskId)); }