示例#1
0
        public ActionResult Sync(string tasklistId, string taskFolderId, string changes, string by, string sorts)
        {
            //Fetch模式不支持同步变更
            Assert.IsFalse(this._fetchTaskHelper.IsFetchTaskFolder(taskFolderId ?? tasklistId));
            var folder = this.GetTaskFolder(taskFolderId ?? tasklistId);
            var a      = this.Context.Current;

            return(Json(this.Sync(changes, by, sorts
                                  , o => { }
                                  , () =>
            {
                var o = new PersonalTask(a);
                if (folder != null)
                {
                    o.SetTaskFolder(folder);
                }
                return o;
            }
                                  , (o, c) =>
            {
                var task = o as PersonalTask;
                //只有创建者才能更新个人任务
                Assert.AreEqual(task.CreatorAccountId, a.ID);
            }
                                  , () => folder == null
                                  , o => o
                                  , o => { folder.Settings[by] = o; this._taskFolderService.Update(folder); })));
        }
示例#2
0
        public void LastUpdateTime()
        {
            var a    = this.CreateAccount();
            var task = new PersonalTask(a);
            //subjet
            var old = task.LastUpdateTime;

            this.Idle();
            task.SetSubject(task.Subject);
            Assert.AreEqual(task.LastUpdateTime, old);
            task.SetSubject(string.Empty);
            Assert.Greater(task.LastUpdateTime, old);
            //body
            old = task.LastUpdateTime;
            this.Idle();
            task.SetBody(task.Body);
            Assert.AreEqual(task.LastUpdateTime, old);
            task.SetBody(string.Empty);
            Assert.Greater(task.LastUpdateTime, old);
            //dueTime
            old = task.LastUpdateTime;
            this.Idle();
            task.SetDueTime(null);
            Assert.Greater(task.LastUpdateTime, old);
            //priority
            old = task.LastUpdateTime;
            this.Idle();
            task.SetPriority(task.Priority);
            Assert.AreEqual(task.LastUpdateTime, old);
            task.SetPriority(Priority.Upcoming);
            Assert.Greater(task.LastUpdateTime, old);
            //taskfolder
            old = task.LastUpdateTime;
            this.Idle();
            var folder = this.CreatePersonalTaskFolder(a);

            task.SetTaskFolder(folder);
            Assert.Greater(task.LastUpdateTime, old);
            old = task.LastUpdateTime;
            task.SetTaskFolder(folder);
            Assert.AreEqual(task.LastUpdateTime, old);
        }
示例#3
0
        public void GetAll()
        {
            var a      = this.CreateAccount();
            var folder = this.CreatePersonalTaskFolder(a);

            var task = new PersonalTask(a);

            this._personalTaskService.Create(task);

            task = new PersonalTask(a);
            task.SetTaskFolder(folder);
            this._personalTaskService.Create(task);

            task = new PersonalTask(a);
            task.SetTaskFolder(folder);
            this._personalTaskService.Create(task);

            Assert.AreEqual(3, this._personalTaskService.GetTasks(a).Count());
            Assert.AreEqual(2, this._personalTaskService.GetTasks(a, folder).Count());
            Assert.AreEqual(1, this._personalTaskService.GetTasksNotBelongAnyFolder(a).Count());
        }