コード例 #1
0
ファイル: TaskFolderTest.cs プロジェクト: codesharp/cooper
        public void Create_Personal()
        {
            var a = this.CreateAccount();
            var folder = new PersonalTaskFolder("default", a);
            Assert.Throws(typeof(AssertionException), () => folder.SetName(null));
            this._taskFolderService.Create(folder);

            this.Evict(folder);

            var folder2 = this._taskFolderService.GetTaskFolder(folder.ID);
            Assert.IsInstanceOf<PersonalTaskFolder>(folder2);
            Assert.AreEqual(folder.Name, folder2.Name);
            Assert.AreEqual(a.ID, (folder2 as PersonalTaskFolder).OwnerAccountId);
        }
コード例 #2
0
ファイル: TaskFolderTest.cs プロジェクト: codesharp/cooper
        public void Update_Personal()
        {
            var a = this.CreateAccount();
            var folder = new PersonalTaskFolder("default", a);
            this._taskFolderService.Create(folder);

            this.Evict(folder);

            folder = this._taskFolderService.GetTaskFolder(folder.ID) as PersonalTaskFolder;
            folder.SetName("abc");
            this._taskFolderService.Update(folder);

            this.Evict(folder);
            folder = this._taskFolderService.GetTaskFolder(folder.ID) as PersonalTaskFolder;
            Assert.AreEqual("abc", folder.Name);
        }
コード例 #3
0
ファイル: TaskFolderTest.cs プロジェクト: codesharp/cooper
        public void Extension()
        {
            var a = this.CreateAccount();
            var folder = new PersonalTaskFolder("default", a);
            this._taskFolderService.Create(folder);

            this.Evict(folder);

            folder = this._taskFolderService.GetTaskFolder(folder.ID) as PersonalTaskFolder;
            folder.Settings["key"] = "abc";
            this._taskFolderService.Update(folder);

            this.Evict(folder);

            folder = this._taskFolderService.GetTaskFolder(folder.ID) as PersonalTaskFolder;
            Assert.AreEqual("abc", folder.Settings["key"]);
        }
コード例 #4
0
 public ActionResult CreateTaskFolders(string data)
 {
     Assert.IsNotNullOrWhiteSpace(data);
     var collects = new List<Correction>();
     var all = _serializer.JsonDeserialize<TaskFolderInfo[]>(data);
     foreach (var l in all)
     {
         try
         {
             var list = new PersonalTaskFolder(l.Name, this.Context.Current);
             this._taskFolderService.Create(list);
             collects.Add(new Correction() { NewId = list.ID.ToString(), OldId = l.ID.ToString() });
         }
         catch (Exception e)
         {
             this._log.Error(string.Format("创建任务表时异常:{0}|{1}|{2}", l.ID, l.Name, l.Type), e);
         }
     }
     return Json(collects);
 }
コード例 #5
0
 public ActionResult CreateTaskFolder(string name, string type)
 {
     var list = new PersonalTaskFolder(name, this.Context.Current);
     this._taskFolderService.Create(list);
     return Json(list.ID);
 }
コード例 #6
0
ファイル: TestBase.cs プロジェクト: codesharp/cooper
 protected PersonalTaskFolder CreatePersonalTaskFolder(Account a)
 {
     var folder = new PersonalTaskFolder(this.RandomString(), a);
     this._taskFolderService.Create(folder);
     return folder;
 }