public void TestWithNoFileName(IConfigurationResultExporter exporter, ProgramOptions options) { string nameWithEmptyString = ExportFilenameHelper.GetFilenameForExportConfiguration(exporter, string.Empty, options); string nameWithNullString = ExportFilenameHelper.GetFilenameForExportConfiguration(exporter, null, options); string patternName = ExportFilenameHelper.GetFilenameForExportConfiguration(exporter, exporter.DefaultFileNamePattern, options); Assert.IsEqual(nameWithEmptyString, nameWithNullString); Assert.IsEqual(nameWithNullString, patternName); }
public void TestWithAssemblyVariable(IConfigurationResultExporter exporter, ProgramOptions options) { string current = Environment.CurrentDirectory; current = current.Substring(current.Replace("\\", "/").LastIndexOf("/") + 1); string expected = DateTime.Now.ToString("ddMMyyy") + "-%state%-" + current + ".xml"; string runTestFileName = ExportFilenameHelper.GetFilenameForExportConfiguration(exporter, null, options); Assert.IsEqual(runTestFileName, expected); }
public static string GetFilenameForExportConfiguration(IConfigurationResultExporter exporter, string filename, ProgramOptions options) { string optionsFilename = options.IsDirectory ? options.Directory.Substring(options.Directory.Replace("\\", "/ ").LastIndexOf("/") + 1) : Path.GetFileNameWithoutExtension(options.File); if (string.IsNullOrWhiteSpace(filename)) { if (!string.IsNullOrWhiteSpace(exporter.DefaultFileNamePattern)) { filename = exporter.DefaultFileNamePattern; } else { filename = optionsFilename; } } return(filename.Replace("%assembly%", optionsFilename).Replace("%date%", DateTime.Now.ToString("ddMMyyy")) + "." + exporter.FileExtension); }
public void TestWithDateVariable(IConfigurationResultExporter exporter, ProgramOptions options) { string runTestFileName = ExportFilenameHelper.GetFilenameForExportConfiguration(exporter, "%date%-runtest", options); Assert.IsEqual(runTestFileName, DateTime.Now.ToString("ddMMyyy") + "-runtest.xml"); }
public void TestWithFilename(IConfigurationResultExporter exporter, ProgramOptions options) { string runTestFilename = ExportFilenameHelper.GetFilenameForExportConfiguration(exporter, "runtest", options); Assert.IsEqual(runTestFilename, "runtest.xml"); }