Exemple #1
0
        public void ComponentSetAttributeAction_For_NonExisting_File()
        {
            string fileNameCopied = "ComponentSetAttributeAction_For_NonExisting_File.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

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

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

            FileLibrary.ComponentSetAttributeAction(_pathCopied, FileAttributes.ReadOnly);

            Assert.AreEqual(FileAttributes.ReadOnly, (File.GetAttributes(_pathCopied) & FileAttributes.ReadOnly));
        }