Esempio n. 1
0
        public void ComponentDeleteFileAction_Handles_NonExisting_File()
        {
            string fileNameCopied = "ComponentDeleteFileAction_Handles_NonExisting_File.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            Assert.IsFalse(File.Exists(_pathCopied));

            FileLibrary.ComponentDeleteFileAction(_pathCopied);
            Assert.IsFalse(File.Exists(_pathCopied));
        }
Esempio n. 2
0
        public void ComponentDeleteFileAction_Deletes_Existing_File()
        {
            string fileNameCopied = "ComponentDeleteFileAction_Deletes_Existing_File.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false);
            Assert.IsTrue(File.Exists(_pathCopied));

            FileLibrary.ComponentDeleteFileAction(_pathCopied);
            Assert.IsFalse(File.Exists(_pathCopied));
        }
Esempio n. 3
0
        public void ComponentDeleteFileAction_Events_Log_From_Exception()
        {
            string fileNameCopied = "ComponentDeleteFileAction_Events_Log_From_Exception.txt";

            _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied);

            FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false);
            Assert.IsTrue(File.Exists(_pathCopied));

            File.SetAttributes(_pathCopied, FileAttributes.ReadOnly);

            // Set up event listener
            var wasCalled = false;

            FileLibrary.Log += (e) => wasCalled = true;

            FileLibrary.ComponentDeleteFileAction(_pathCopied);

            Assert.IsTrue(wasCalled);
        }