Beispiel #1
0
 public void ThrowsUnauthorizedAccessExceptionWhenProcessDoesNotHaveRightToCreateFile()
 {
     using (new DirectoryAccessDenier(this.storageFolder, FileSystemRights.CreateFiles))
     {
         var folder = new PlatformFolder(this.storageFolder);
         AssertEx.Throws <UnauthorizedAccessException>(() => folder.CreateFile(FileSystemTest.GetUniqueFileName()));
     }
 }
Beispiel #2
0
 public void ThrowsUnauthorizedAccessExceptionWhenProcessDoesNotHaveRightToCreateFile()
 {
     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.CreateFiles))
     {
         var folder = new PlatformFolder(this.storageFolder);
         AssertEx.Throws <UnauthorizedAccessException>(() => folder.CreateFile(FileSystemTest.GetUniqueFileName()));
     }
 }