Index: Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -rf701bc630f0cdc6c946f01145e39313afe11f36c -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f701bc630f0cdc6c946f01145e39313afe11f36c) +++ Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -1264,6 +1264,15 @@ } /// + /// Looks up a localized string similar to Gegevens van '{0}' zijn geëxporteerd naar bestand '{1}'.. + /// + public static string GuiExportHandler_ExportItemUsingDialog_Data_from_0_exported_to_file_1 { + get { + return ResourceManager.GetString("GuiExportHandler_ExportItemUsingDialog_Data_from_0_exported_to_file_1", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Exporteren van '{0}' is mislukt.. /// public static string GuiExportHandler_ExportItemUsingDialog_Export_of_DataType_0_failed { Index: Core/Gui/src/Core.Gui/Properties/Resources.resx =================================================================== diff -u -rf701bc630f0cdc6c946f01145e39313afe11f36c -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Core/Gui/src/Core.Gui/Properties/Resources.resx (.../Resources.resx) (revision f701bc630f0cdc6c946f01145e39313afe11f36c) +++ Core/Gui/src/Core.Gui/Properties/Resources.resx (.../Resources.resx) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -535,6 +535,9 @@ Gegevens zijn geëxporteerd naar bestand '{0}'. + + Gegevens van '{0}' zijn geëxporteerd naar bestand '{1}'. + ..\Resources\warning.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Index: Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs =================================================================== diff -u -r267c9ef2b20b89090259f63c96fee89a32cb4d1a -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs) (revision 267c9ef2b20b89090259f63c96fee89a32cb4d1a) +++ Riskeer/Integration/src/Riskeer.Integration.IO/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter.cs) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -25,9 +25,12 @@ using System.Linq; using Core.Common.Base.IO; using Core.Common.Util; +using log4net; using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Forms.Helpers; using Riskeer.Integration.IO.Properties; +using CoreCommonUtilResources = Core.Common.Util.Properties.Resources; +using CoreGuiResources = Core.Gui.Properties.Resources; using RiskeerCommonIOResources = Riskeer.Common.IO.Properties.Resources ; namespace Riskeer.Integration.IO.Exporters @@ -37,6 +40,8 @@ /// public class HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter : IFileExporter { + private static readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter)); + private readonly IEnumerable> locationCalculationsForTargetProbabilities; private readonly string folderPath; @@ -89,8 +94,13 @@ ? Resources.HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter_WaterLevels_DisplayName : Resources.HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter_WaveHeights_DisplayName; + double targetProbability = calculationsForTargetProbability.TargetProbability; + var exportName = $"{exportType} {ProbabilityFormattingHelper.Format(targetProbability)}"; + + log.InfoFormat(CoreGuiResources.GuiExportHandler_ExportItemUsingDialog_Start_exporting_DataType_0_, exportName); + string uniqueName = NamingHelper.GetUniqueName( - exportedCalculations, $"{exportType}_{ReturnPeriodFormattingHelper.FormatFromProbability(calculationsForTargetProbability.TargetProbability)}", + exportedCalculations, $"{exportType}_{ReturnPeriodFormattingHelper.FormatFromProbability(targetProbability)}", c => c.Value); string filePath = Path.Combine(folderPath, $"{uniqueName}.{RiskeerCommonIOResources.Shape_file_filter_Extension}"); @@ -104,6 +114,7 @@ return false; } + log.InfoFormat(CoreGuiResources.GuiExportHandler_ExportItemUsingDialog_Data_from_0_exported_to_file_1, exportName, filePath); exportedCalculations.Add(calculationsForTargetProbability, uniqueName); return true; } Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs =================================================================== diff -u -ree2a193cd93696d64c8a43ccd2faaa50ad1a64fe -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs) (revision ee2a193cd93696d64c8a43ccd2faaa50ad1a64fe) +++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Exporters/HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest.cs) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -134,19 +134,19 @@ var exporter = new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(targetProbabilities, folderPath); - string[] expectedFilePaths = - { - Path.Combine(folderPath, $"Waterstanden_{GetReturnPeriodText(targetProbabilities.First().Item1.TargetProbability)}.shp"), - Path.Combine(folderPath, $"Golfhoogten_{GetReturnPeriodText(targetProbabilities.Last().Item1.TargetProbability)}.shp") - }; - try { // Call bool isExported = exporter.Export(); // Assert Assert.IsTrue(isExported); + + string[] expectedFilePaths = + { + Path.Combine(folderPath, $"Waterstanden_{GetReturnPeriodText(targetProbabilities.First().Item1.TargetProbability)}.shp"), + Path.Combine(folderPath, $"Golfhoogten_{GetReturnPeriodText(targetProbabilities.Last().Item1.TargetProbability)}.shp") + }; Assert.IsTrue(expectedFilePaths.All(File.Exists)); } finally @@ -162,8 +162,6 @@ string folderPath = TestHelper.GetScratchPadPath($"{nameof(HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest)}.{nameof(Export_WithDoubleHydraulicBoundaryLocationCalculationsForTargetProbabilities_WritesFilesAndReturnsTrue)}"); Directory.CreateDirectory(folderPath); - var random = new Random(21); - var targetProbabilities = new[] { new Tuple( @@ -182,20 +180,76 @@ var exporter = new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(targetProbabilities, folderPath); - string[] expectedFilePaths = + try { - Path.Combine(folderPath, "Waterstanden_10.shp"), - Path.Combine(folderPath, "Waterstanden_10 (1).shp"), - Path.Combine(folderPath, "Golfhoogten_1.000.shp"), - Path.Combine(folderPath, "Golfhoogten_1.000 (1).shp") + // Call + bool isExported = exporter.Export(); + + // Assert + Assert.IsTrue(isExported); + + string[] expectedFilePaths = + { + Path.Combine(folderPath, "Waterstanden_10.shp"), + Path.Combine(folderPath, "Waterstanden_10 (1).shp"), + Path.Combine(folderPath, "Golfhoogten_1.000.shp"), + Path.Combine(folderPath, "Golfhoogten_1.000 (1).shp") + }; + Assert.IsTrue(expectedFilePaths.All(File.Exists)); + } + finally + { + Directory.Delete(folderPath, true); + } + } + + [Test] + public void Export_WithHydraulicBoundaryLocationCalculationsForTargetProbabilities_LogsMessages() + { + // Setup + string folderPath = TestHelper.GetScratchPadPath($"{nameof(HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporterTest)}.{nameof(Export_WithHydraulicBoundaryLocationCalculationsForTargetProbabilities_LogsMessages)}"); + Directory.CreateDirectory(folderPath); + + var random = new Random(21); + + var targetProbabilities = new[] + { + new Tuple( + new HydraulicBoundaryLocationCalculationsForTargetProbability(random.NextDouble(0, 0.1)), + HydraulicBoundaryLocationCalculationsType.WaterLevel), + new Tuple( + new HydraulicBoundaryLocationCalculationsForTargetProbability(random.NextDouble(0, 0.1)), + HydraulicBoundaryLocationCalculationsType.WaveHeight) }; + var exporter = new HydraulicBoundaryLocationCalculationsForTargetProbabilitiesExporter(targetProbabilities, folderPath); + try { // Call - bool isExported = exporter.Export(); + var isExported = false; + void Call() => isExported = exporter.Export(); // Assert + string[] expectedCalculationNames = + { + $"Waterstanden {ProbabilityFormattingHelper.Format(targetProbabilities.First().Item1.TargetProbability)}", + $"Golfhoogten {ProbabilityFormattingHelper.Format(targetProbabilities.Last().Item1.TargetProbability)}" + }; + + string[] expectedFilePaths = + { + Path.Combine(folderPath, $"Waterstanden_{GetReturnPeriodText(targetProbabilities.First().Item1.TargetProbability)}.shp"), + Path.Combine(folderPath, $"Golfhoogten_{GetReturnPeriodText(targetProbabilities.Last().Item1.TargetProbability)}.shp") + }; + + TestHelper.AssertLogMessagesAreGenerated(Call, new[] + { + $"Exporteren van '{expectedCalculationNames[0]}' is gestart.", + $"Gegevens van '{expectedCalculationNames[0]}' zijn geëxporteerd naar bestand '{expectedFilePaths[0]}'.", + $"Exporteren van '{expectedCalculationNames[1]}' is gestart.", + $"Gegevens van '{expectedCalculationNames[1]}' zijn geëxporteerd naar bestand '{expectedFilePaths[1]}'." + }); Assert.IsTrue(isExported); Assert.IsTrue(expectedFilePaths.All(File.Exists)); } Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationGroupExporter.cs =================================================================== diff -u -r9a83eb890b0d3aac04ee48d4999fae0c92e7e10c -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationGroupExporter.cs (.../MacroStabilityInwardsCalculationGroupExporter.cs) (revision 9a83eb890b0d3aac04ee48d4999fae0c92e7e10c) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationGroupExporter.cs (.../MacroStabilityInwardsCalculationGroupExporter.cs) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -186,7 +186,7 @@ return false; } - log.InfoFormat(Resources.MacroStabilityInwardsCalculationGroupExporter_Export_Data_from_0_exported_to_file_1, calculation.Name, filePath); + log.InfoFormat(CoreGuiResources.GuiExportHandler_ExportItemUsingDialog_Data_from_0_exported_to_file_1, calculation.Name, filePath); exportedCalculations.Add(calculation, uniqueName); return true; } Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs =================================================================== diff -u -r80c53924c7488a48f8148ba8b73260446a262883 -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 80c53924c7488a48f8148ba8b73260446a262883) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -367,16 +367,6 @@ } /// - /// Looks up a localized string similar to Gegevens van '{0}' zijn geëxporteerd naar bestand '{1}'.. - /// - public static string MacroStabilityInwardsCalculationGroupExporter_Export_Data_from_0_exported_to_file_1 { - get { - return ResourceManager.GetString("MacroStabilityInwardsCalculationGroupExporter_Export_Data_from_0_exported_to_file" + - "_1", resourceCulture); - } - } - - /// /// Looks up a localized string similar to De laag bevat een ongeldige geometrie.. /// public static string MacroStabilityInwardsSoilLayerTransformer_TransformSegmentToRing_Invalid_geometry_for_Ring { Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx =================================================================== diff -u -ra206b997ecdc2e76de7d46e3f39ee4fa467629ea -r00cf1098df9d6d15f3cd847d572eb789cbdb4ea3 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision a206b997ecdc2e76de7d46e3f39ee4fa467629ea) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision 00cf1098df9d6d15f3cd847d572eb789cbdb4ea3) @@ -223,9 +223,6 @@ Berekening '{0}' heeft geen uitvoer. Deze berekening wordt overgeslagen. - - Gegevens van '{0}' zijn geëxporteerd naar bestand '{1}'. - POP - {0}