コード例 #1
0
ファイル: GetSetPropertiesTests.cs プロジェクト: mo5h/omeo
        [Test]//, Ignore( "Investigating problems on OMNIAMEA-UNIT")]
        public void GetSetCategories()
        {
            FolderEnum       folderEnum       = FolderEnum.SearchForFolders(new string[] { "TasksTest" });
            FolderDescriptor folderDescriptor = folderEnum.GetFolderDescriptor("TasksTest");

            Assert.IsNotNull(folderDescriptor);
            IEFolder folder =
                OutlookSession.OpenFolder(folderDescriptor.FolderIDs.EntryId, folderDescriptor.FolderIDs.StoreId);

            Assert.IsNotNull(folder);
            using ( folder )
            {
                IEMessages messages = folder.GetMessages();
                Assert.IsNotNull(messages);
                using ( messages )
                {
                    Assert.AreEqual(1, messages.GetCount());
                    IEMessage task = messages.OpenMessage(0);
                    Assert.IsNotNull(task);
                    using ( task )
                    {
                        ArrayList categories = OutlookSession.GetCategories(task);
                        Assert.AreEqual(null, categories);
                        categories = new ArrayList();
                        categories.Add("category1");
                        categories.Add("category2");
                        categories.Add("category3");
                        OutlookSession.SetCategories(task, categories);
                        task.SaveChanges();
                    }
                    task = messages.OpenMessage(0);
                    Assert.IsNotNull(task);
                    using ( task )
                    {
                        ArrayList categories = OutlookSession.GetCategories(task);
                        Assert.AreEqual(3, categories.Count);
                        categories.Remove("category1");
                        categories.Remove("category2");
                        categories.Remove("category3");
                        Assert.AreEqual(0, categories.Count);
                        OutlookSession.SetCategories(task, null);
                        task.SaveChanges();
                    }
                    task = messages.OpenMessage(0);
                    Assert.IsNotNull(task);
                    using ( task )
                    {
                        ArrayList categories = OutlookSession.GetCategories(task);
                        Assert.AreEqual(null, categories);
                    }
                }
            }
        }