Пример #1
0
        public void UpdatePersonalTask()
        {
            var account = this.CreateAccount();
            var task    = new PersonalTask(account);

            task.SetSubject(RandomString());
            task.SetBody(RandomString());
            task.SetPriority(Priority.Later);
            task.MarkAsCompleted();
            task.SetDueTime(DateTime.Now.AddDays(3));

            this._taskService.Create(task);

            this.Evict(task);

            var task2 = this._taskService.GetTask(task.ID) as PersonalTask;

            task2.SetSubject(task2.Subject + "updated");
            task2.SetBody(task2.Body + "updated");
            task2.SetPriority(Priority.Upcoming);
            task2.MarkAsInCompleted();
            task2.SetDueTime(DateTime.Now.AddDays(4));

            this._taskService.Update(task2);
            this.Evict(task2);
            var task3 = this._taskService.GetTask(task2.ID) as PersonalTask;

            Assert.AreEqual(task2.Subject, task3.Subject);
            Assert.AreEqual(task2.Body, task3.Body);
            Assert.AreEqual(task2.Priority, task3.Priority);
            Assert.AreEqual(FormatTime(task2.DueTime.Value), FormatTime(task3.DueTime.Value));
            Assert.AreEqual(task2.IsCompleted, task3.IsCompleted);
            Assert.AreEqual(task2.CreatorAccountId, task3.CreatorAccountId);
        }
Пример #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);
        }