コード例 #1
0
        public void GetItem_Attribute_AttributeValue()
        {
            string str = "Test:Value";
            TreeViewItem_Attribute item = (TreeViewItem_Attribute)TreeItemsFactory.GetItem(str);

            Assert.AreEqual <string>("Value", item.AttributeValue);
        }
コード例 #2
0
        public void GetItem_File()
        {
            string        str  = @"C:\1\SYSERROR.DBF";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_File));
        }
コード例 #3
0
        public void GetItem_Directory_Status()
        {
            string        str  = @"C:\1\";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.AreEqual <ItemType>(item.Type, ItemType.Directory);
        }
コード例 #4
0
        public void GetItem_Directory_Name()
        {
            string        str  = @"C:\1\";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.AreEqual <string>(item.Name, "1");
        }
コード例 #5
0
        public void GetItem_Attribute_Name()
        {
            string        str  = "Test";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.AreEqual <string>(item.Name, str);
        }
コード例 #6
0
        public void GetItem_Directory()
        {
            string        str  = @"C:\1\";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_Directory));
        }
コード例 #7
0
        public void GetItem_Attribute()
        {
            string        str  = "Test";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_Attribute));
        }
コード例 #8
0
        public void GetItem_Attribute_Status()
        {
            string        str  = "Test";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.AreEqual <ItemType>(item.Type, ItemType.Attribute);
        }
コード例 #9
0
        public void GetItem_File_Status()
        {
            string        str  = @"C:\1\SYSERROR.DBF";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.AreEqual <ItemType>(item.Type, ItemType.File);
        }
コード例 #10
0
        public void GetItem_FileinFB2()
        {
            string        str  = @"C:\librus_MyHomeLib\Davydov_Moskovit.454563.fb2";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_FileFB2));
        }
コード例 #11
0
        public void GetItem_FileZIP()
        {
            string        str  = @"C:\librus_MyHomeLib\lib.rus.ec\fb2-000024-030559.zip";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.AreEqual <ItemType>(item.Type, ItemType.Zip);
        }
コード例 #12
0
        public void GetItem_FileinFB2_ZIP()
        {
            string        zip  = @"C:\librus_MyHomeLib\flibusta\Davydov_Moskovit.454563.fb2.zip";
            string        fb2  = "Davydov_Moskovit.454563.fb2";
            ITreeViewItem item = TreeItemsFactory.GetItem(zip, fb2);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_FileFB2));
        }
コード例 #13
0
        public void GetItem_FileinZIP_isFile()
        {
            string        zip  = @"C:\librus_MyHomeLib\lib.rus.ec\fb2-000024-030559.zip";
            string        file = "24.fb2";
            ITreeViewItem item = TreeItemsFactory.GetItem(zip, file);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_File));
        }
コード例 #14
0
        public void GetItem_FileinZIP()
        {
            string        zip  = @"C:\librus_MyHomeLib\lib.rus.ec\fb2-000024-030559.zip";
            string        file = "24.fb2";
            ITreeViewItem item = TreeItemsFactory.GetItem(zip, file);

            Assert.AreEqual <ItemType>(item.Type, ItemType.InZip);
        }
コード例 #15
0
        public void TreeViewItem_FileFB2_GetInfo()
        {
            string str = @"E:\librus_MyHomeLib\Davydov_Moskovit.454563.fb2";
            TreeViewItem_FileFB2 item   = (TreeViewItem_FileFB2)TreeItemsFactory.GetItem(str);
            IEnumerable <string> childs = item.GetChilds();

            foreach (string child in childs)
            {
                Debug.WriteLine(child);
            }
            Assert.IsInstanceOfType(childs, typeof(IEnumerable <string>));
        }
コード例 #16
0
        public void TreeViewItem_FileFB2Zip_GetInfo()
        {
            string               zip    = @"E:\librus_MyHomeLib\flibusta\Davydov_Moskovit.454563.fb2.zip";
            string               fb2    = "Davydov_Moskovit.454563.fb2";
            ITreeViewItem        item   = TreeItemsFactory.GetItem(zip, fb2);
            IEnumerable <string> childs = item.GetChilds();

            foreach (string child in childs)
            {
                Debug.WriteLine(child);
            }
            Assert.IsInstanceOfType(childs, typeof(IEnumerable <string>));
        }
コード例 #17
0
        public void TreeViewItem_FileFB2_GetAuthors()
        {
            string str = @"E:\librus_MyHomeLib\Davydov_Moskovit.454563.fb2";
            TreeViewItem_FileFB2 item = (TreeViewItem_FileFB2)TreeItemsFactory.GetItem(str);

            Debug.WriteLine("============1============");

            var authors = item.GetAuthors();

            foreach (ITreeViewItem child in authors)
            {
                Debug.WriteLine(child.Name);
                Debug.WriteLine("========================");
                foreach (var itm in child.GetChilds_Items())
                {
                    Debug.WriteLine(itm.Name);
                }
                Debug.WriteLine("========================");
            }
            Assert.AreEqual(3, authors.Count());
        }
コード例 #18
0
        public void TreeViewItem_FileFB2_GetChilds_Items()
        {
            string str = @"E:\librus_MyHomeLib\Davydov_Moskovit.454563.fb2";
            TreeViewItem_FileFB2 item = (TreeViewItem_FileFB2)TreeItemsFactory.GetItem(str);

            IEnumerable <ITreeViewItem> childs = item.GetChilds_Items();

            foreach (ITreeViewItem child in childs)
            {
                if (child is TreeViewItem_Attribute)
                {
                    Debug.WriteLine(((TreeViewItem_Attribute)child).AttributeType);
                }
                Debug.WriteLine("========================");
                IEnumerable <string> childs1 = child.GetChilds();
                foreach (string child1 in childs1)
                {
                    Debug.WriteLine(child1);
                }
                Debug.WriteLine(child.Name);
            }
            Assert.IsInstanceOfType(childs, typeof(IEnumerable <ITreeViewItem>));
        }
コード例 #19
0
        private ITreeViewItem GetInitItem()
        {
            ITreeViewItem item;

            if (string.IsNullOrEmpty(fileDestination))
            {
                throw new ArgumentOutOfRangeException("fileDestination", "Wrong database name");
            }

            if (string.IsNullOrEmpty(fileSource))
            {
                throw new ArgumentOutOfRangeException("fileSource", "Wrong source file name");
            }

            item = TreeItemsFactory.GetItem(fileSource);

            if (item.State == ItemState.Error)
            {
                throw new ArgumentOutOfRangeException("fileSource", "Wrong source file name");
            }

            return(item);
        }
コード例 #20
0
        public void GetItem_Empty_Status()
        {
            ITreeViewItem item = TreeItemsFactory.GetItem();

            Assert.AreEqual <ItemType>(item.Type, ItemType.Empty);
        }
コード例 #21
0
        public void GetItem_Empty()
        {
            ITreeViewItem item = TreeItemsFactory.GetItem();

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_Empty));
        }