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); } Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingCalculationConfigurationExporterTest.cs =================================================================== diff -u -rb731017e828e47ed72aa803dfcc7eeaa7f770933 -rc4528c8f253cdfee73a61d9af5fe869de793cc40 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingCalculationConfigurationExporterTest.cs (.../PipingCalculationConfigurationExporterTest.cs) (revision b731017e828e47ed72aa803dfcc7eeaa7f770933) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingCalculationConfigurationExporterTest.cs (.../PipingCalculationConfigurationExporterTest.cs) (revision c4528c8f253cdfee73a61d9af5fe869de793cc40) @@ -81,7 +81,7 @@ }; string expectedXmlFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO, - Path.Combine("PipingCalculationConfigurationWriter", + Path.Combine("PipingCalculationConfigurationExporter", "folderWithSubfolderAndCalculation.xml")); // Call and Assert Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingCalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingCalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingCalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml (revision c4528c8f253cdfee73a61d9af5fe869de793cc40) @@ -0,0 +1,43 @@ + + + + + PUNT_KAT_18 + PK001_0001 + 0.1 + 0.2 + PK001_0001_Piping + W1-6_0_1D1 + + + 0 + 0.1 + + + 0.7 + 0.1 + + + + + + PUNT_SCH_17 + PK001_0002 + 0.3 + 0.4 + PK001_0002_Piping + W1-6_4_1D1 + + + 0 + 0.1 + + + 0.7 + 0.1 + + + + + + \ No newline at end of file