public void ReturnsEmptyEnumerableWhenStorageFolderIsEmpty()
 {
     var folder = new PlatformFolder(this.storageFolder);
     IEnumerable<IPlatformFile> files = folder.GetFiles();
     Assert.NotNull(files);
     Assert.Empty(files);
 }
Ejemplo n.º 2
0
            public void ReturnsEmptyEnumerableWhenStorageFolderIsEmpty()
            {
                var folder = new PlatformFolder(this.storageFolder);
                IEnumerable <IPlatformFile> files = folder.GetFiles();

                Assert.IsNotNull(files);
                AssertEx.IsEmpty(files);
            }
Ejemplo n.º 3
0
 public void ThrowsUnauthorizedAccessExceptionWhenProcessDoesNotHaveRightToListDirectory()
 {
     using (new DirectoryAccessDenier(this.storageFolder, FileSystemRights.ListDirectory))
     {
         var folder = new PlatformFolder(this.storageFolder);
         AssertEx.Throws <UnauthorizedAccessException>(() => folder.GetFiles());
     }
 }
 public void ReturnsEmptyEnumerableWhenStorageFolderWasDeleted()
 {
     var folder = new PlatformFolder(this.storageFolder);
     FileSystemTest.DeletePlatformItem(this.storageFolder);
     IEnumerable<IPlatformFile> files = folder.GetFiles();
     Assert.NotNull(files);
     Assert.Empty(files);
 }
Ejemplo n.º 5
0
            public void ReturnsEmptyEnumerableWhenStorageFolderWasDeleted()
            {
                var folder = new PlatformFolder(this.storageFolder);

                FileSystemTest.DeletePlatformItem(this.storageFolder);
                IEnumerable <IPlatformFile> files = folder.GetFiles();

                Assert.IsNotNull(files);
                AssertEx.IsEmpty(files);
            }
Ejemplo n.º 6
0
 public void ThrowsUnauthorizedAccessExceptionWhenProcessDoesNotHaveRightToListDirectory()
 {
     Trace.WriteLine(string.Format("{0} Blocking Listing Permission on: {1} ", DateTime.Now.ToLongTimeString(), this.storageFolder.FullName));
     // Only on Windows as the APIs are not available in Linux.
     // The product also does not this this.
     using (new DirectoryAccessDenier(this.storageFolder, FileSystemRights.ListDirectory))
     {
         var folder = new PlatformFolder(this.storageFolder);
         AssertEx.Throws <UnauthorizedAccessException>(() => folder.GetFiles());
     }
 }
Ejemplo n.º 7
0
            public void ReturnsEnumerableOfObjectsRepresentingExistingFiles()
            {
                string[] expectedFileNames = new string[] { "file.1", "blah.txt", "foo.bar" };
                foreach (string fileName in expectedFileNames)
                {
                    FileSystemTest.CreatePlatformFile(fileName, this.storageFolder);
                }

                var folder = new PlatformFolder(this.storageFolder);

                IEnumerable <IPlatformFile> files = folder.GetFiles();

                AssertEx.AreEqual(expectedFileNames.OrderBy(name => name), files.Select(f => f.Name).OrderBy(name => name));
            }
            public void ReturnsEnumerableOfObjectsRepresentingExistingFiles()
            {
                string[] expectedFileNames = new string[] { "file.1", "blah.txt", "foo.bar" };
                foreach (string fileName in expectedFileNames)
                {
                    FileSystemTest.CreatePlatformFile(fileName, this.storageFolder);
                }

                var folder = new PlatformFolder(this.storageFolder);

                IEnumerable<IPlatformFile> files = folder.GetFiles();
                Assert.Equal(expectedFileNames.OrderBy(name => name), files.Select(f => f.Name).OrderBy(name => name));
            }
 public void ThrowsUnauthorizedAccessExceptionWhenProcessDoesNotHaveRightToListDirectory()
 {
     using (new DirectoryAccessDenier(this.storageFolder, FileSystemRights.ListDirectory))
     {
         var folder = new PlatformFolder(this.storageFolder);
         Assert.Throws<UnauthorizedAccessException>(() => folder.GetFiles());
     }
 }