Example #1
0
        public async Task FolderPropertyTest()
        {
            await STATask.Run(() =>
            {
                var path   = TestConfig.TestDirectory.FullName;
                var actual = ShellFactory.FromFolderPath(path);

                actual.Parent.IsNotNull();
                actual.Parent.ParsingName.Is(TestConfig.TestDirectory.Parent?.FullName);
            });
        }
Example #2
0
        public async Task EqualsTest1()
        {
            await STATask.Run(() =>
            {
                var folder1 = ShellFactory.FromFolderPath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
                var folder2 = ShellFactory.FromFolderPath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));

                folder1.IsNotSameReferenceAs(folder2);

                folder1.Equals(folder2).IsTrue();
                (folder1 == folder2).IsTrue();
                (folder1.Path == folder2.Path).IsTrue();
                (folder1.GetHashCode() == folder2.GetHashCode()).IsTrue();
            });
        }
Example #3
0
        public async Task FromFolderPathTest()
        {
            await STATask.Run(() =>
            {
                var path   = TestConfig.TestDirectory.FullName;
                var actual = ShellFactory.FromFolderPath(path);

                actual.IsNotNull();
                actual.Path.Is(path);
                actual.ParsingName.Is(path);
                actual.Name.Is(TestConfig.TestDirectoryName);
                actual.Parent.ParsingName.Is(TestConfig.TestDirectory.Parent?.FullName);

                // Flags
                actual.IsFileSystem.IsTrue();
            });
        }
Example #4
0
        public async Task GetItemsTest()
        {
            await STATask.Run(() =>
            {
                var path   = TestConfig.TestDirectory.FullName;
                var folder = ShellFactory.FromFolderPath(path);
                var actual = folder.EnumerateObjects().ToList();

                var folder1 = actual.Find(item => ShellTestConfig.CompareFileName(item.Name, "Pictures"));
                folder1.IsNotNull();

                var file1 = actual.Find(item => ShellTestConfig.CompareFileName(item.Name, "Test.txt"));
                file1.IsNotNull();
                file1.IsInstanceOf <ShellFile>();

                var file2 = actual.Find(Item => ShellTestConfig.CompareFileName(Item.Name, "Test2.txt"));
                file2.IsNotNull();
                file2.IsInstanceOf <ShellFile>();
            });
        }