Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs =================================================================== diff -u -rb731017e828e47ed72aa803dfcc7eeaa7f770933 -rc4528c8f253cdfee73a61d9af5fe869de793cc40 --- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs (.../CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs) (revision b731017e828e47ed72aa803dfcc7eeaa7f770933) +++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs (.../CustomCalculationConfigurationExporterDesignGuidelinesTestFixture.cs) (revision c4528c8f253cdfee73a61d9af5fe869de793cc40) @@ -44,7 +44,7 @@ public void Constructor_ConfigurationNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => CallDefaultConstructor(null, "test.xml"); + TestDelegate test = () => CallConfigurationFilePathConstructor(null, "test.xml"); // Assert var activatorException = Assert.Throws(test); @@ -57,7 +57,7 @@ public void Constructor_FilePathInvalid_ThrowArgumentException(string filePath) { // Call - TestDelegate test = () => CallDefaultConstructor(Enumerable.Empty(), filePath); + TestDelegate test = () => CallConfigurationFilePathConstructor(Enumerable.Empty(), filePath); // Assert var activatorException = Assert.Throws(test); @@ -69,7 +69,7 @@ public void Constructor_ExpectedValues() { // Call - TCalculationConfigurationExporter exporter = CallDefaultConstructor(Enumerable.Empty(), "test.xml"); + TCalculationConfigurationExporter exporter = CallConfigurationFilePathConstructor(Enumerable.Empty(), "test.xml"); // Assert AssertDefaultConstructedInstance(exporter); @@ -79,12 +79,13 @@ public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse() { // Setup - string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse)); - using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse))) + const string folderName = nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse); + string directoryPath = TestHelper.GetScratchPadPath(folderName); + using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) { string filePath = Path.Combine(directoryPath, "test.xml"); - TCalculationConfigurationExporter exporter = CallDefaultConstructor(new[] + TCalculationConfigurationExporter exporter = CallConfigurationFilePathConstructor(new[] { CreateCalculation() }, filePath); @@ -96,7 +97,7 @@ Action call = () => isExported = exporter.Export(); // Assert - IEnumerable> logMessages = AssertExportFailedLogMessages(filePath); + IEnumerable> logMessages = GetExpectedExportFailedLogMessages(filePath); TestHelper.AssertLogMessagesWithLevelAreGenerated(call, logMessages); Assert.IsFalse(isExported); } @@ -115,7 +116,7 @@ string filePath = Path.Combine(stringBuilder.ToString(), "test.xml"); - TCalculationConfigurationExporter exporter = CallDefaultConstructor(new[] + TCalculationConfigurationExporter exporter = CallConfigurationFilePathConstructor(new[] { CreateCalculation() }, filePath); @@ -125,12 +126,12 @@ Action call = () => isExported = exporter.Export(); // Assert - IEnumerable> logMessages = AssertExportFailedLogMessages(filePath); + IEnumerable> logMessages = GetExpectedExportFailedLogMessages(filePath); TestHelper.AssertLogMessagesWithLevelAreGenerated(call, logMessages); Assert.IsFalse(isExported); } - protected virtual IEnumerable> AssertExportFailedLogMessages(string filePath) + protected virtual IEnumerable> GetExpectedExportFailedLogMessages(string filePath) { return new[] { @@ -161,7 +162,7 @@ protected void WriteAndValidate(IEnumerable configuration, string expectedXmlFilePath) { string filePath = TestHelper.GetScratchPadPath($"{nameof(TCalculationConfigurationExporter)}.{nameof(WriteAndValidate)}.xml"); - TCalculationConfigurationExporter exporter = CallDefaultConstructor(configuration, filePath); + TCalculationConfigurationExporter exporter = CallConfigurationFilePathConstructor(configuration, filePath); try { @@ -188,7 +189,8 @@ return (TCalculation) Activator.CreateInstance(typeof(TCalculation)); } - private static TCalculationConfigurationExporter CallDefaultConstructor(IEnumerable configuration, string filePath) + private static TCalculationConfigurationExporter CallConfigurationFilePathConstructor( + IEnumerable configuration, string filePath) { return (TCalculationConfigurationExporter) Activator.CreateInstance(typeof(TCalculationConfigurationExporter), configuration, filePath); }