Exemple #1
0
        public void Test_File_Is_A_Directory()
        {
            #region Prepare
            // Path for existing file
            string path = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())) + "\\IO";
            #endregion

            #region Act
            var fileADirectory = _fileProcessor.IsFileADirectory(path);
            #endregion

            #region Assert
            Assert.True(fileADirectory);
            #endregion
        }
Exemple #2
0
        /// <summary>
        /// Check, validate path and assign new path to the arguments
        /// </summary>
        /// <param name="args">Arguments passed through command line</param>
        /// <returns>String if there was any error during validation, NULL if there are none</returns>
        public string CheckFile(ref string[] args)
        {
            var filePath = _fileProcessor.ConstructFilePath(args[0]);

            // Check if file path is not null
            if (filePath == null)
            {
                return("File does not exist");
            }

            // Check if file path exists
            if (!_fileProcessor.DoesFileExist(filePath))
            {
                return("File does not exist");
            }

            // Check if file is a directory
            if (_fileProcessor.IsFileADirectory(filePath))
            {
                return("File is a directory");
            }

            args[0] = filePath;

            return(null);
        }