public void Test_NoDatasetToken(string badString) { var dest = new ExecuteDatasetExtractionFlatFileDestination(); dest.ExtractionSubdirectoryPattern = badString; var ex = Assert.Throws <Exception>(() => dest.Check(new ThrowImmediatelyCheckNotifier())); StringAssert.Contains("ExtractionSubdirectoryPattern must contain a Dataset element", ex.Message); }
public void Test_NoRelativePaths() { var dest = new ExecuteDatasetExtractionFlatFileDestination(); dest.ExtractionSubdirectoryPattern = "../../troll"; var ex = Assert.Throws <Exception>(() => dest.Check(new ThrowImmediatelyCheckNotifier())); StringAssert.Contains("ExtractionSubdirectoryPattern cannot contain dots", ex.Message); }
public void Test_ValidPaths(string goodString, string pattern) { var sds = WhenIHaveA <SelectedDataSets>(); sds.ExtractionConfiguration.Project.ExtractionDirectory = TestContext.CurrentContext.WorkDirectory; sds.ExtractionConfiguration.Name = "AAA"; sds.ExtractableDataSet.Catalogue.Name = "BBB"; sds.ExtractableDataSet.Catalogue.Acronym = "C"; var cmd = new ExtractDatasetCommand(sds.ExtractionConfiguration, new ExtractableDatasetBundle(sds.ExtractableDataSet)); var dest = new ExecuteDatasetExtractionFlatFileDestination(); dest.ExtractionSubdirectoryPattern = goodString; Assert.DoesNotThrow(() => dest.Check(new ThrowImmediatelyCheckNotifier())); var answer = dest.GetDirectoryFor(cmd); StringAssert.IsMatch(pattern, answer.FullName.Replace('\\', '/')); }