示例#1
0
        public void SetFileNotReadOnly_For_Existing_File()
        {
            // Set up temporary sample file to alter
            string fileNameCopied = "SetFileNotReadOnly_For_Existing_File.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);
            File.Copy(_pathOriginal, _pathCopied);

            FileInfo infoReader = new FileInfo(_pathCopied);

            Assert.IsFalse(infoReader.IsReadOnly);

            File.SetAttributes(_pathCopied, FileAttributes.ReadOnly);
            infoReader = new FileInfo(_pathCopied);
            Assert.IsTrue(infoReader.IsReadOnly);

            FileLibrary.SetFileNotReadOnly(_pathCopied);

            infoReader = new FileInfo(_pathCopied);
            Assert.IsFalse(infoReader.IsReadOnly);
        }