Ejemplo n.º 1
0
 public async Task GetFolderTest()
 {
     await STATask.Run(() =>
     {
         var desktop = ShellKnownFolders.Desktop;
         var actual  = desktop.GetFolder();
         actual.IsNull();
     });
 }
 public async Task GetAllPublicLibrariesTest()
 {
     await STATask.Run(() =>
     {
         foreach (var library in ShellLibraries.EnumeratePublicLibraries())
         {
             Dump(library);
         }
     });
 }
Ejemplo n.º 3
0
        public async Task OperatorNotEqualsTest2()
        {
            await STATask.Run(() =>
            {
                var shellFile1 = ShellFactory.FromFilePath(Path.Combine(TestConfig.TestDirectory.FullName, @"Test.txt"));
                var shellFile2 = ShellFactory.FromFilePath(Path.Combine(TestConfig.TestDirectory.FullName, @"Test.txt"));

                Assert.False(shellFile1 != shellFile2);
            });
        }
Ejemplo n.º 4
0
        public async Task NotEqualsTest2()
        {
            await STATask.Run(() =>
            {
                var shellFile1    = ShellFactory.FromFilePath(Path.Combine(TestConfig.TestDirectory.FullName, @"Test.txt"));
                Object shellFile2 = "abcdefg";

                Assert.False(shellFile1.Equals(shellFile2));
            });
        }
 public async Task EnumerateKnownFoldersTest()
 {
     await STATask.Run(() =>
     {
         foreach (var folder in ShellKnownFolders.EnumerateKnownFolders())
         {
             Dump(folder);
         }
     });
 }
Ejemplo n.º 6
0
        public async Task EqualsObjectTest()
        {
            await STATask.Run(() =>
            {
                var shellFile1    = ShellFactory.FromFilePath(Path.Combine(TestConfig.TestDirectory.FullName, @"Test.txt"));
                Object shellFile2 = ShellFactory.FromFilePath(Path.Combine(TestConfig.TestDirectory.FullName, @"Test.txt"));

                Assert.True(shellFile1.Equals(shellFile2));
            });
        }
        public async Task VideosLibraryTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellLibraries.VideosLibrary;

                Assert.Equal(LibraryFolderTypes.Videos, actual.LibraryType);

                Dump(actual);
            });
        }
Ejemplo n.º 8
0
        public async Task GetHashCodeTest()
        {
            await STATask.Run(() =>
            {
                const string fileName = @"Test.txt";
                var path   = Path.Combine(TestConfig.TestDirectory.FullName, fileName);
                var actual = ShellFactory.FromFilePath(path);

                Assert.NotEqual(0, actual.GetHashCode());
            });
        }
Ejemplo n.º 9
0
        public async Task FromFilePathErrorTest()
        {
            await STATask.Run(() =>
            {
                const string filename = @"xxxx.txt";
                var path = Path.Combine(TestConfig.TestDirectory.FullName, filename);

                var ex = Assert.Throws <FileNotFoundException>(() => ShellFactory.FromFilePath(path));
                Assert.Equal(path, ex.FileName);
            });
        }
Ejemplo n.º 10
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);
            });
        }
        public async Task CreateFromCanonicalNameTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolderFactory.FromCanonicalName("DocumentsLibrary");

                Assert.NotNull(actual);
                Assert.Equal("DocumentsLibrary", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task SearchHomeTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.SearchHome;

                Assert.NotNull(actual);
                Assert.Equal("SearchHomeFolder", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task RecycleBinTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.RecycleBin;

                Assert.NotNull(actual);
                Assert.Equal("RecycleBinFolder", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task ComputerTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Computer;

                Assert.NotNull(actual);
                Assert.Equal("MyComputerFolder", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task PrintersTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Printers;

                Assert.NotNull(actual);
                Assert.Equal("PrintersFolder", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task NetworkTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Network;

                Assert.NotNull(actual);
                Assert.Equal("NetworkPlacesFolder", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task HomeGroupCurrentUserTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.HomeGroupCurrentUser;

                Assert.NotNull(actual);
                Assert.Equal("HomeGroupCurrentUserFolder", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task UserProfilesTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.UserProfiles;

                Assert.NotNull(actual);
                Assert.Equal("UserProfiles", actual.CanonicalName);

                Dump(actual);
            });
        }
        public async Task LoadKnownFolderTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellLibraryFactory.Load(ShellKnownFolderFactory.FromCanonicalName("PicturesLibrary"));

                Assert.NotNull(actual);
                Assert.Equal(LibraryFolderTypes.Pictures, actual.LibraryType);

                Dump(actual);
            });
        }
Ejemplo n.º 20
0
        public async Task SizePropertyTest()
        {
            await STATask.Run(() =>
            {
                const string fileName = @"Test.txt";
                var path   = Path.Combine(TestConfig.TestDirectory.FullName, fileName);
                var actual = ShellFactory.FromFilePath(path);

                Console.WriteLine(actual.Size);
                Assert.True(0 < actual.Size);
            });
        }
Ejemplo n.º 21
0
        public async Task ToStringTest()
        {
            await STATask.Run(() =>
            {
                const string fileName = @"Test.txt";
                var path   = Path.Combine(TestConfig.TestDirectory.FullName, fileName);
                var actual = ShellFactory.FromFilePath(path);

                Console.WriteLine(actual.ToString());
                Assert.NotEqual(-1, actual.ToString().IndexOf(path, StringComparison.InvariantCultureIgnoreCase));
            });
        }
Ejemplo n.º 22
0
        public async Task FolderPropertyTest()
        {
            await STATask.Run(() =>
            {
                const string fileName = @"Test.txt";
                var path   = Path.Combine(TestConfig.TestDirectory.FullName, fileName);
                var actual = ShellFactory.FromFilePath(path);

                Assert.NotNull(actual.Folder);
                Assert.Equal(TestConfig.TestDirectory.FullName, actual.Folder.ParsingName);
            });
        }
        public async Task LibrariesTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Libraries;

                Assert.NotNull(actual);
                Assert.Equal("Libraries", actual.CanonicalName);
                Assert.Equal(@"::{031E4825-7B94-4DC3-B131-E946B44C8DD5}", actual.ParsingName);

                Dump(actual);
            });
        }
        public async Task PicturesTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Pictures;

                Assert.NotNull(actual);
                Assert.Equal("My Pictures", actual.CanonicalName);
                Assert.Equal(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), actual.ParsingName);

                Dump(actual);
            });
        }
        public async Task ApplicationDataTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.ApplicationData;

                Assert.NotNull(actual);
                Assert.Equal("AppData", actual.CanonicalName);
                Assert.Equal(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), actual.ParsingName);

                Dump(actual);
            });
        }
        public async Task PublicTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Public;

                Assert.NotNull(actual);
                Assert.Equal("Public", actual.CanonicalName);
                Assert.True(actual.ParsingName.EndsWith(@"\Users\Public"));

                Dump(actual);
            });
        }
        public async Task DocumentsTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Documents;

                Assert.NotNull(actual);
                Assert.Equal("Personal", actual.CanonicalName);
                Assert.Equal(Environment.GetFolderPath(Environment.SpecialFolder.Personal), actual.ParsingName);

                Dump(actual);
            });
        }
        public async Task DesktopTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellKnownFolders.Desktop;

                Assert.NotNull(actual);
                Assert.Equal("Desktop", actual.CanonicalName);
                Assert.Equal(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), actual.ParsingName);
                Assert.True(actual.Path.Any());

                Dump(actual);
            });
        }
        public async Task ControlPanelTest()
        {
            await STATask.Run(() =>
            {
                var controlPanel = ShellKnownFolderFactory.FromKnownFolderId(new Guid("82A74AEB-AEB4-465C-A014-D097EE346D63"));

                Assert.NotNull(controlPanel);

                foreach (var item in controlPanel.EnumerateFiles().Cast <ShellNonFileSystemItem>())
                {
                    Dump(item);
                }
            });
        }
        public async Task MusicLibraryTest()
        {
            await STATask.Run(() =>
            {
                var actual = ShellLibraries.MusicLibrary;

                Assert.NotNull(actual);
                Assert.Equal(LibraryFolderTypes.Music, actual.LibraryType);
                Assert.Equal("Music.library-ms", actual.Name);
                Assert.Equal(@"::{031E4825-7B94-4DC3-B131-E946B44C8DD5}\Music.library-ms", actual.ParsingName);

                Dump(actual);
            });
        }