Skip to content

Test Data tools

Jon P Smith edited this page Jan 4, 2021 · 1 revision

6. Various tools for getting test data, or file paths to test data

The static class TestData contains a number of methods to help with loading or deleting test data. The methods use a directory called TestData in the project you call the method from.

I'm not going to describe the method and its parameters etc. as its fairly obvious and you can look at the code. The methods available are:

  • public static string GetFilePath(string searchPattern).
  • public static string[] GetFilePaths(string searchPattern = "")
  • public static string GetFileContent(string searchPattern)
  • public static bool EnsureFileDeleted(string searchPattern)
  • public static void DeleteDirectoryAndAnyContent(string topDirPath)
  • public static void DeleteAllFilesAndSubDirsInDir(string topDirPath)
  • public static string GetTestDataDir(string alternateTestDir = TestFileDirectoryName, Assembly callingAssembly = null)
  • public static string GetCallingAssemblyTopLevelDir(Assembly callingAssembly = null)
Clone this wiki locally