コード例 #1
0
        public void SetAccessControl_FileInfo_FileSecurity_InvalidArguments()
        {
            FileInfo fileInfo = new FileInfo("\\");

            Assert.Throws <ArgumentNullException>("fileSecurity", () => FileSystemAclExtensions.SetAccessControl(fileInfo, (FileSecurity)null));
        }
コード例 #2
0
 public void SetAccessControl_FileStream_FileSecurity_InvalidArguments()
 {
     Assert.Throws <NullReferenceException>(() => FileSystemAclExtensions.SetAccessControl((FileStream)null, (FileSecurity)null));
 }
コード例 #3
0
 public void GetAccessControl_FileInfo_AccessControlSections_InvalidArguments()
 {
     Assert.Throws <NullReferenceException>(() => FileSystemAclExtensions.GetAccessControl((FileInfo)null, new AccessControlSections()));
 }
コード例 #4
0
        public void SetAccessControl_DirectoryInfo_DirectorySecurity_InvalidArguments()
        {
            DirectoryInfo directoryInfo = new DirectoryInfo("\\");

            Assert.Throws <ArgumentNullException>("directorySecurity", () => FileSystemAclExtensions.SetAccessControl(directoryInfo, (DirectorySecurity)null));
        }
コード例 #5
0
 public void GetAccessControl_DirectoryInfo_InvalidArguments()
 {
     Assert.Throws <NullReferenceException>(() => FileSystemAclExtensions.GetAccessControl((DirectoryInfo)null));
 }
コード例 #6
0
 public void GetAccessControl_Filestream_InvalidArguments()
 {
     Assert.Throws <ArgumentNullException>("fileStream", () => FileSystemAclExtensions.GetAccessControl((FileStream)null));
 }
コード例 #7
0
 public void GetAccessControl_FileInfo_InvalidArguments()
 {
     Assert.Throws <ArgumentNullException>(() => FileSystemAclExtensions.GetAccessControl((FileInfo)null));
 }
コード例 #8
0
 public void GetAccessControl_DirectoryInfo_AccessControlSections_InvalidArguments()
 {
     Assert.Throws <ArgumentNullException>(() => FileSystemAclExtensions.GetAccessControl((DirectoryInfo)null, new AccessControlSections()));
 }
コード例 #9
0
 public void SetAccessControl_FileStream_FileSecurity_InvalidFileSecurityObject()
 {
     using (var directory = new TempDirectory())
         using (var file = new TempFile(Path.Combine(directory.Path, "file.txt")))
             using (FileStream fileStream = File.Open(file.Path, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.None))
             {
                 AssertExtensions.Throws <ArgumentNullException>("fileSecurity", () => FileSystemAclExtensions.SetAccessControl(fileStream, (FileSecurity)null));
             }
 }