public bool CreateTestFile(TestFile testFile) { testFile.Filename = _fileHandler.GetFilenameWithExtension(testFile.Filename); string fullPath = _fileHandler.CreateFileFullPath(testFile.Filename); bool fileExists = _fileHandler.FileExists(fullPath); if (fileExists) { throw new IOException("File already exists"); } return(SaveTestFile(testFile, fullPath)); }
public bool CreateTestFile(TestFile testFile) { testFile.Filename = _fileHandler.GetFilenameWithExtension(testFile.Filename); string filePath = _fileHandler.CreateFileFullPath(testFile.Filename); bool fileExists = _fileHandler.FileExists(filePath); if (fileExists) { throw new IOException("File already exists"); } string contents = _testFileWriter.Write(testFile); return(_fileHandler.WriteAllText(filePath, contents)); }