Beispiel #1
0
        public void TestPCPath()
        {
            // Get test browser object and generate path list of idListPidls
            var testitem  = Browser.Create(KF_IID.ID_FOLDERID_ComputerFolder);
            var pathItems = Browser.PathItemsAsIdList(testitem);

            // Should contain the fullpidl to 'This PC'
            Assert.IsTrue(pathItems.Count == 1);

            foreach (var item in pathItems)
            {
                string displayName = PidlManager.IdListFullToName(item, SHGDNF.SHGDN_NORMAL);
                string parseName   = PidlManager.IdListFullToName(item, SHGDNF.SHGDN_FORPARSING);

                Console.WriteLine("Display Name '{0}' Parse Name '{1}'", displayName, parseName);

                Assert.IsFalse(string.IsNullOrEmpty(parseName));
                Console.WriteLine(parseName);

                var browserItem = Browser.Create(parseName);
                Assert.IsTrue(browserItem != null);

                Assert.IsTrue(browserItem.EqualsParseName(parseName));

                var browserItem1 = Browser.Create(item);
                Assert.IsTrue(browserItem1 != null);

                // Object from PIDL and ParseName should realy describe same location
                Assert.IsTrue(browserItem1.Equals(browserItem));
            }
        }
Beispiel #2
0
        public void TestDrivePath()
        {
            // Get test browser object and generate path list of idListPidls
            // Get the default drive's path
            var drivePath     = new DirectoryInfo(Environment.SystemDirectory).Root.Name;
            var driveInfoPath = new System.IO.DriveInfo(drivePath);

            Assert.IsTrue(driveInfoPath != null);
            Assert.IsTrue(drivePath != null);

            var testitem  = Browser.Create(drivePath);
            var pathItems = Browser.PathItemsAsIdList(testitem);

            // Should contain the fullpidl to 'This PC', '<Drive (eg.: C:)>'
            Assert.IsTrue(pathItems.Count == 2);

            foreach (var item in pathItems)
            {
                string displayName = PidlManager.IdListFullToName(item, SHGDNF.SHGDN_NORMAL);
                string parseName   = PidlManager.IdListFullToName(item, SHGDNF.SHGDN_FORPARSING);

                Console.WriteLine("Display Name '{0}' Parse Name '{1}'", displayName, parseName);

                Assert.IsFalse(string.IsNullOrEmpty(parseName));
                Console.WriteLine(parseName);

                var browserItem = Browser.Create(parseName);
                Assert.IsTrue(browserItem != null);

                Assert.IsTrue(browserItem.EqualsParseName(parseName));

                var browserItem1 = Browser.Create(item);
                Assert.IsTrue(browserItem1 != null);

                // Object from PIDL and ParseName should realy describe same location
                Assert.IsTrue(browserItem1.Equals(browserItem));
            }
        }