public void Add_Multiple() { var tl = new TaskList(_testDataPath); int c = tl.Count(); var task = new Task("Add_Multiple task one"); tl.Add(task); var task2 = new Task("Add_Multiple task two"); tl.Add(task2); Assert.AreEqual(c + 2, tl.Count()); }
public ActionResult ListTwo(DateTime bDate, DateTime eDate, string SearchType = "", int codeID = 0, string code = "", int codeID2 = 0, string codeName = "") { IEnumerable <task> TaskList; if (SearchType == "GoalSearch") { TaskList = TaskRepository.GetTaskByGoal(codeID); ViewBag.GoalID = codeID; goal goal = GoalRepository.GetGoalByID(codeID); ministry ministry = MinistryRepository.GetMinistryByID(goal.ministryID); ViewBag.Heading = string.Format("{0} {1} Task List", ministry.MinistryName, goal.Title); } else if (SearchType == "StatusSearch") { TaskList = TaskRepository.GetTaskByStatus(code); ViewBag.Heading = "Task List by Status"; } else if (SearchType == "Due Date Search") { TaskList = TaskRepository.GetTaskByDueDateRange(bDate, eDate); ViewBag.Heading = "Task List by Date Range"; } else if (SearchType == "Assigned Date Search") { TaskList = TaskRepository.GetTaskByAssignDateRange(bDate, eDate); ViewBag.Heading = "Task List by Assigned Date"; } else if (SearchType == "CompletionRatioSearch") { TaskList = TaskRepository.GetTaskByRatio(codeName); ViewBag.Heading = "Task List by Percentage Completed"; } else if (SearchType == "MinistrySearch") { TaskList = TaskRepository.GetTaskByMinistryDateRange(codeID, bDate, eDate); ViewBag.GoalID = codeID; goal goal = GoalRepository.GetGoalByID(codeID); ministry ministry = MinistryRepository.GetMinistryByID(goal.ministryID); ViewBag.Heading = string.Format("{0} {1} Task List", ministry.MinistryName, goal.Title); } else { TaskList = TaskRepository.GetTaskByAssignDateRange(bDate, eDate); } ViewBag.RecordCount = TaskList.Count(); foreach (var i in TaskList) { i.member = MemberRepository.GetMemberByID(i.AssignTo); } return(PartialView(TaskList)); }
public void Add_To_Empty_File() { // v0.3 and earlier contained a bug where a blank task was added string tempTaskFile = CreateTempTasksFile(); File.WriteAllLines(tempTaskFile, new string[] {}); // empties the file var tl = new TaskList(tempTaskFile); tl.Add(new Task("A task")); Assert.AreEqual(1, tl.Count()); // Clean up File.Delete(tempTaskFile); }