public void Test_File_Exist() { #region Prepare // Path for existing file string path = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())), "file.json"); #endregion #region Act var fileExist = _fileProcessor.DoesFileExist(path); #endregion #region Assert Assert.True(fileExist); #endregion }
/// <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); }