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

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            Assert.DoesNotThrow(() => FileLibrary.ComponentRemoveAttributeAction(_pathCopied, FileAttributes.ReadOnly));
        }
Example #2
0
        public void ComponentRemoveAttributeAction_For_Existing_File()
        {
            // Set up temporary sample file to alter
            string fileNameCopied = "ComponentRemoveAttributeAction_For_Existing_File.txt";

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

            File.SetAttributes(_pathCopied, FileAttributes.ReadOnly);

            FileInfo infoReader = new FileInfo(_pathCopied);

            Assert.IsTrue(infoReader.IsReadOnly);

            FileLibrary.ComponentRemoveAttributeAction(_pathCopied, FileAttributes.ReadOnly);
            infoReader = new FileInfo(_pathCopied);
            Assert.IsFalse(infoReader.IsReadOnly);
        }