public void GetItem_Attribute_AttributeValue()
        {
            string str = "Test:Value";
            TreeViewItem_Attribute item = (TreeViewItem_Attribute)TreeItemsFactory.GetItem(str);

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

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_File));
        }
        public void GetItem_Directory_Status()
        {
            string        str  = @"C:\1\";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

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

            Assert.AreEqual <string>(item.Name, "1");
        }
        public void GetItem_Attribute_Name()
        {
            string        str  = "Test";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

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

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_Directory));
        }
        public void GetItem_Attribute()
        {
            string        str  = "Test";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_Attribute));
        }
        public void GetItem_Attribute_Status()
        {
            string        str  = "Test";
            ITreeViewItem item = TreeItemsFactory.GetItem(str);

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

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

            Assert.IsInstanceOfType(item, typeof(TreeViewItem_FileFB2));
        }
        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);
        }
        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));
        }
        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));
        }
        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);
        }
        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>));
        }
        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>));
        }
        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());
        }
        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>));
        }
Beispiel #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);
        }
        public void GetItem_Empty_Status()
        {
            ITreeViewItem item = TreeItemsFactory.GetItem();

            Assert.AreEqual <ItemType>(item.Type, ItemType.Empty);
        }
        public void GetItem_Empty()
        {
            ITreeViewItem item = TreeItemsFactory.GetItem();

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