コード例 #1
0
 public void SetupTest()
 {
     TaskListT.ClearTaskListTable();
     TaskT.ClearTaskTable();
     TaskSubscriptionT.ClearTaskSubscriptionTable();
     SignalodT.ClearSignalodTable();
     _taskListParent     = TaskListT.CreateTaskList(descript: "TaskListParent");
     _taskListChild      = TaskListT.CreateTaskList(descript: "TaskListChild", parent: _taskListParent.TaskListNum, parentDesc: _taskListParent.Descript);
     _taskListGrandchild = TaskListT.CreateTaskList(descript: "TaskListGrandchild", parent: _taskListChild.TaskListNum,
                                                    parentDesc: _taskListChild.Descript);
     _task = TaskT.CreateTask(_taskListGrandchild.TaskListNum, descript: "Test Task", fromNum: Security.CurUser.UserNum); //Starts in _taskListGrandchild
     Security.CurUser.TaskListInBox = _taskListParent.TaskListNum;                                                        //Set inbox for current user to _taskListParent.
     try {
         Userods.Update(Security.CurUser);
     }
     catch {
         Assert.Fail("Failed to update current user task list inbox.");                //Error updating user.
     }
     _userControlTasksInstance = new UserControlTasks();
     _userControlTasksAccessor = new PrivateObject(_userControlTasksInstance);
     //Artificially set that we are viewing _listTaskListParent.
     _userControlTasksAccessor.SetField("_listTaskListTreeHistory", new List <TaskList>()
     {
         _taskListParent
     });
     _userControlTasksAccessor.SetField("_dictTaskLists", new Dictionary <long, TaskList>());
 }
コード例 #2
0
        ///<summary>Correct TaskLists are returned when a parent TaskList is subscribed to in a parent->child->grandchild TaskList hierarchy.</summary>
        public void UserControlTasks_GetSubscribedTaskLists()
        {
            //Subscribe to _taskListParent. This will result in a subscription list of _taskListParent,_taskListChild,_taskListGrandchild
            TaskSubscriptionT.CreateTaskSubscription(Security.CurUser.UserNum, _taskListParent.TaskListNum);
            List <TaskList> listSubscribedTaskLists         = UserControlTasks.GetSubscribedTaskLists(Security.CurUser.UserNum);
            List <TaskList> listExpectedSubscribedTaskLists = new List <TaskList>()
            {
                _taskListParent, _taskListChild, _taskListGrandchild
            };

            Assert.AreEqual(listExpectedSubscribedTaskLists.Count, listSubscribedTaskLists.Count);           //Same number of subscriptions.
            foreach (TaskList taskListSubscribed in listSubscribedTaskLists)
            {
                //Every subscribed tasklist should be in the expected list of subscribed tasklists.
                Assert.IsTrue(listExpectedSubscribedTaskLists.Exists(x => x.TaskListNum == taskListSubscribed.TaskListNum));
            }
        }
コード例 #3
0
        ///<summary>List of signalNums tracking signals sent from this machine gets cleared on a full refresh.</summary>
        public void UserControlTasks_RefreshMainLists_ListSentSignalsClear()
        {
            long        signalNum          = 1;
            List <long> listSentSignalNums = new List <long>()
            {
                signalNum
            };

            //Adds a signalNum to the list of sent signalNums.
            UserControlTasks.RefillLocalTaskGrids(_task, new List <TaskNote>(), listSentSignalNums, true);
            List <long> listTrackedSignalNums = (List <long>)_userControlTasksAccessor.GetField("_listSentTaskSignalNums");
            //Assert.AreEqual(listSentSignalNums.Count,listTrackedSignalNums.Count); Add back when local memory refresh has been re-implemented.
            //Assert.AreEqual(signalNum,listTrackedSignalNums[0]); Add back when local memory refresh has been re-implemented.
            long parent = 0;

            _userControlTasksAccessor.Invoke("RefreshMainLists", parent, DateTime.Today);          //A full refresh should clear the list of sent signalNums.
            listTrackedSignalNums = (List <long>)_userControlTasksAccessor.GetField("_listSentTaskSignalNums");
            Assert.AreEqual(0, listTrackedSignalNums.Count);
        }