Index: Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs =================================================================== diff -u -re9b8aa3e972b9f07a3201f143c26de0e3f082d49 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision e9b8aa3e972b9f07a3201f143c26de0e3f082d49) +++ Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -43,7 +43,7 @@ private readonly IWin32Window dialogParent; private readonly IProjectOwner projectOwner; - private readonly IStoreProject projectPersistor; + private readonly IStoreProject projectPersister; private readonly IProjectFactory projectFactory; private readonly IMigrateProject projectMigrator; private readonly IInquiryHelper inquiryHelper; @@ -64,7 +64,7 @@ this.dialogParent = dialogParent; this.projectOwner = projectOwner; this.inquiryHelper = inquiryHelper; - projectPersistor = projectStorage; + projectPersister = projectStorage; this.projectMigrator = projectMigrator; this.projectFactory = projectFactory; } @@ -77,26 +77,26 @@ } IProject project = projectOwner.Project; - projectPersistor.StageProject(project); + projectPersister.StageProject(project); try { - if (!projectPersistor.HasStagedProjectChanges(projectOwner.ProjectFilePath)) + if (!projectPersister.HasStagedProjectChanges(projectOwner.ProjectFilePath)) { - projectPersistor.UnstageProject(); + projectPersister.UnstageProject(); return true; } } catch (StorageException e) { log.Error(e.Message, e); - projectPersistor.UnstageProject(); + projectPersister.UnstageProject(); } bool unsavedChangesHandled = ShowSaveUnsavedChangesDialog(); - if (projectPersistor.HasStagedProject) + if (projectPersister.HasStagedProject) { - projectPersistor.UnstageProject(); + projectPersister.UnstageProject(); } return unsavedChangesHandled; @@ -119,7 +119,7 @@ { using (var openFileDialog = new OpenFileDialog { - Filter = projectPersistor.OpenProjectFileFilter, + Filter = projectPersister.OpenProjectFileFilter, Title = Resources.OpenFileDialog_Title }) { @@ -156,7 +156,7 @@ return false; } - var activity = new SaveProjectActivity(project, filePath, false, projectPersistor, projectOwner); + var activity = new SaveProjectActivity(project, filePath, false, projectPersister, projectOwner); ActivityProgressDialogRunner.Run(dialogParent, activity); return activity.State == ActivityState.Finished; } @@ -172,7 +172,7 @@ return SaveProjectAs(); } - var activity = new SaveProjectActivity(project, filePath, true, projectPersistor, projectOwner); + var activity = new SaveProjectActivity(project, filePath, true, projectPersister, projectOwner); ActivityProgressDialogRunner.Run(dialogParent, activity); return activity.State == ActivityState.Finished; } @@ -264,7 +264,7 @@ FilePath = filePath, ProjectOwner = projectOwner, ProjectFactory = projectFactory, - ProjectStorage = projectPersistor + ProjectStorage = projectPersister }; var activity = new OpenProjectActivity(openProjectProperties, migrationProperties); ActivityProgressDialogRunner.Run(dialogParent, activity); @@ -310,7 +310,7 @@ /// The selected project file, or null otherwise. private string OpenProjectSaveFileDialog(string projectName) { - return inquiryHelper.GetTargetFileLocation(projectPersistor.SaveProjectFileFilter, projectName); + return inquiryHelper.GetTargetFileLocation(projectPersister.SaveProjectFileFilter, projectName); } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Geometry.Test/AdvancedMath2DTest.cs =================================================================== diff -u -r76083efbd5b5eb1508bd12a1c29138bb8e21cefe -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Core/Common/test/Core.Common.Geometry.Test/AdvancedMath2DTest.cs (.../AdvancedMath2DTest.cs) (revision 76083efbd5b5eb1508bd12a1c29138bb8e21cefe) +++ Core/Common/test/Core.Common.Geometry.Test/AdvancedMath2DTest.cs (.../AdvancedMath2DTest.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -513,7 +513,7 @@ }; // Call - Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(outerRing, new [] + Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(outerRing, new[] { innerRing1, innerRing2 Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationExporter.cs =================================================================== diff -u -r70a1224e4fe0f259a097819c8b0fe406464f861c -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationExporter.cs (.../MacroStabilityInwardsCalculationExporter.cs) (revision 70a1224e4fe0f259a097819c8b0fe406464f861c) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationExporter.cs (.../MacroStabilityInwardsCalculationExporter.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using Components.Persistence.Stability; @@ -102,32 +103,42 @@ PersistableDataModel persistableDataModel = PersistableDataModelFactory.Create(calculation, getNormativeAssessmentLevelFunc, filePath); - string tempFilePath = $"{filePath}.temp"; - try { - using (IPersister persister = persistenceFactory.CreateArchivePersister(tempFilePath, persistableDataModel)) + using (IPersister persister = persistenceFactory.CreateArchivePersister(filePath, persistableDataModel)) { persister.Persist(); } - - MoveTempFileToFinal(tempFilePath); } catch (Exception) { - File.Delete(tempFilePath); + TryDeleteFile(); + log.ErrorFormat("{0} {1}", string.Format(CoreCommonUtilResources.Error_General_output_error_0, filePath), Resources.MacroStabilityInwardsCalculationExporter_Export_no_stability_project_exported); return false; } return true; } + private void TryDeleteFile() + { + try + { + File.Delete(filePath); + } + catch (Exception) + { + // Do nothing + } + } + private void ValidateData() { if (Math.Abs(calculation.InputParameters.MaximumSliceWidth - 1) > 1e-3) { - log.Warn(Resources.MacroStabilityInwardsCalculationExporter_ValidateData_DGeoSuite_only_supports_MaximumSliceWidth_one); + log.WarnFormat(Resources.MacroStabilityInwardsCalculationExporter_ValidateData_DGeoSuite_only_supports_MaximumSliceWidth_one_but_calculation_has_MaximumSliceWidth_0, + calculation.InputParameters.MaximumSliceWidth.ToString(null, CultureInfo.CurrentCulture)); } IEnumerable layers = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(calculation.InputParameters.SoilProfileUnderSurfaceLine.Layers); @@ -136,15 +147,5 @@ log.Warn(Resources.MacroStabilityInwardsCalculationExporter_ValidateData_Multiple_aquifer_layers_not_supported_no_aquifer_layer_exported); } } - - private void MoveTempFileToFinal(string tempFilePath) - { - if (File.Exists(filePath)) - { - File.Delete(filePath); - } - - File.Move(tempFilePath, filePath); - } } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/MacroStabilityInwardsExportRegistry.cs =================================================================== diff -u -r04448db4aa26dc298cec9e84ea767afc315d97a3 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/MacroStabilityInwardsExportRegistry.cs (.../MacroStabilityInwardsExportRegistry.cs) (revision 04448db4aa26dc298cec9e84ea767afc315d97a3) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/MacroStabilityInwardsExportRegistry.cs (.../MacroStabilityInwardsExportRegistry.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -156,7 +156,7 @@ } /// - /// Adds a geometry to the register. + /// Adds a geometry to the registry. /// /// The /// to register the geometry for. @@ -171,7 +171,7 @@ } /// - /// Adds a soil layer to the register. + /// Adds a soil layer to the registry. /// /// The /// to register the soil layer for. @@ -186,7 +186,7 @@ } /// - /// Adds a Waternet to the register. + /// Adds a Waternet to the registry. /// /// The /// to register the Waternet for. @@ -201,7 +201,7 @@ } /// - /// Adds Waternet creator settings to the register. + /// Adds Waternet creator settings to the registry. /// /// The /// to register the Waternet creator settings for. @@ -216,7 +216,7 @@ } /// - /// Adds a state to the register. + /// Adds a state to the registry. /// /// The /// to register the state for. Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableCalculationSettingsFactory.cs =================================================================== diff -u -raa141f5355c7631aef79085d3bbea2d0bb4e9fa4 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableCalculationSettingsFactory.cs (.../PersistableCalculationSettingsFactory.cs) (revision aa141f5355c7631aef79085d3bbea2d0bb4e9fa4) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableCalculationSettingsFactory.cs (.../PersistableCalculationSettingsFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -35,7 +35,7 @@ /// Creates a collection of . /// /// The sliding curve to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when any parameter is null. Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableDataModelFactory.cs =================================================================== diff -u -r6ff01e7ca7bcb0fefcef033ae31738c401bcf24f -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableDataModelFactory.cs (.../PersistableDataModelFactory.cs) (revision 6ff01e7ca7bcb0fefcef033ae31738c401bcf24f) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableDataModelFactory.cs (.../PersistableDataModelFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -78,15 +78,15 @@ SoilLayers = PersistableSoilLayerCollectionFactory.Create(soilProfile, idFactory, registry), Waternets = PersistableWaternetFactory.Create( DerivedMacroStabilityInwardsInput.GetWaternetDaily(input), - DerivedMacroStabilityInwardsInput.GetWaternetExtreme(input, GetAssessmentLevel(input, getNormativeAssessmentLevelFunc)), + DerivedMacroStabilityInwardsInput.GetWaternetExtreme(input, GetEffectiveAssessmentLevel(input, getNormativeAssessmentLevelFunc)), idFactory, registry), - WaternetCreatorSettings = PersistableWaternetCreatorSettingsFactory.Create(input, GetAssessmentLevel(input, getNormativeAssessmentLevelFunc), idFactory, registry), + WaternetCreatorSettings = PersistableWaternetCreatorSettingsFactory.Create(input, GetEffectiveAssessmentLevel(input, getNormativeAssessmentLevelFunc), idFactory, registry), States = PersistableStateFactory.Create(soilProfile, idFactory, registry), Stages = PersistableStageFactory.Create(idFactory, registry) }; } - private static RoundedDouble GetAssessmentLevel(MacroStabilityInwardsInput input, Func getNormativeAssessmentLevelFunc) + private static RoundedDouble GetEffectiveAssessmentLevel(MacroStabilityInwardsInput input, Func getNormativeAssessmentLevelFunc) { return input.UseAssessmentLevelManualInput ? input.AssessmentLevel Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableGeometryFactory.cs =================================================================== diff -u -r76b0441378930f0e6052aa3e65332dc23fe4b0be -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableGeometryFactory.cs (.../PersistableGeometryFactory.cs) (revision 76b0441378930f0e6052aa3e65332dc23fe4b0be) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableGeometryFactory.cs (.../PersistableGeometryFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -37,7 +37,7 @@ /// Creates a new instance of . /// /// The soil profile to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when any parameter is null. Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableSoilCollectionFactory.cs =================================================================== diff -u -rbe3d9a45b29158909701853718aefbcb1d74497e -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableSoilCollectionFactory.cs (.../PersistableSoilCollectionFactory.cs) (revision be3d9a45b29158909701853718aefbcb1d74497e) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableSoilCollectionFactory.cs (.../PersistableSoilCollectionFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -39,7 +39,7 @@ /// Creates a new instance of . /// /// The soil profile to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// The created . /// Thrown when any parameter is null. @@ -77,7 +77,7 @@ /// Creates a new instance of . /// /// The layer to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// The created . /// Thrown when Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableSoilLayerCollectionFactory.cs =================================================================== diff -u -r51789ab5bcaa4abaf4acaf92e7efddaa82426a50 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableSoilLayerCollectionFactory.cs (.../PersistableSoilLayerCollectionFactory.cs) (revision 51789ab5bcaa4abaf4acaf92e7efddaa82426a50) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableSoilLayerCollectionFactory.cs (.../PersistableSoilLayerCollectionFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -37,7 +37,7 @@ /// Creates a collection of . /// /// The soil profile to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when any parameter Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableStageFactory.cs =================================================================== diff -u -r7fd9d2bf74176ea1d05e7bb7619a09a5ec7caec0 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableStageFactory.cs (.../PersistableStageFactory.cs) (revision 7fd9d2bf74176ea1d05e7bb7619a09a5ec7caec0) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableStageFactory.cs (.../PersistableStageFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -34,7 +34,7 @@ /// /// Creates a collection of . /// - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when any parameter Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableStateFactory.cs =================================================================== diff -u -rdb6b3624eb33a8c762dec9f4565c18cd229fba5f -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableStateFactory.cs (.../PersistableStateFactory.cs) (revision db6b3624eb33a8c762dec9f4565c18cd229fba5f) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableStateFactory.cs (.../PersistableStateFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -41,7 +41,7 @@ /// Creates a new collection of . /// /// The soil profile to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when any parameter is null. Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableWaternetCreatorSettingsFactory.cs =================================================================== diff -u -raa141f5355c7631aef79085d3bbea2d0bb4e9fa4 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableWaternetCreatorSettingsFactory.cs (.../PersistableWaternetCreatorSettingsFactory.cs) (revision aa141f5355c7631aef79085d3bbea2d0bb4e9fa4) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableWaternetCreatorSettingsFactory.cs (.../PersistableWaternetCreatorSettingsFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -41,7 +41,7 @@ /// /// The input to use. /// The normative assessment level to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when , @@ -79,7 +79,7 @@ /// Creates a new for daily. /// /// The input to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// The created . /// Thrown when @@ -102,7 +102,7 @@ /// /// The input to use. /// The normative assessment level to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// The created . /// Thrown when @@ -125,7 +125,7 @@ /// Creates a new . /// /// The input to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// The stage type. /// The created . Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableWaternetFactory.cs =================================================================== diff -u -rd786814eb47687382a96e596b2fc8fa04ccb22f6 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableWaternetFactory.cs (.../PersistableWaternetFactory.cs) (revision d786814eb47687382a96e596b2fc8fa04ccb22f6) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/PersistableWaternetFactory.cs (.../PersistableWaternetFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -39,7 +39,7 @@ /// /// The daily waternet to use. /// The extreme waternet to use. - /// The factory fo IDs. + /// The factory for creating IDs. /// The persistence registry. /// A collection of . /// Thrown when any parameter is null. Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs =================================================================== diff -u -r02bb3f034254e688fb76ea43a0be6c0d406a44d6 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 02bb3f034254e688fb76ea43a0be6c0d406a44d6) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -285,17 +285,17 @@ } /// - /// Looks up a localized string similar to D-GEO Suite Stability ondersteunt enkel een maximale lamelbreedte van 1 meter, om hieraan te voldoen is dit aangepast in de geëxporteerde berekening.. + /// Looks up a localized string similar to De berekening bevat een lamelbreedte van {0} meter. D-GEO Suite Stability ondersteunt enkel een maximale lamelbreedte van 1 meter. Er wordt daarom een lamelbreedte van 1 meter geëxporteerd.. /// - public static string MacroStabilityInwardsCalculationExporter_ValidateData_DGeoSuite_only_supports_MaximumSliceWidth_one { + public static string MacroStabilityInwardsCalculationExporter_ValidateData_DGeoSuite_only_supports_MaximumSliceWidth_one_but_calculation_has_MaximumSliceWidth_0 { get { return ResourceManager.GetString("MacroStabilityInwardsCalculationExporter_ValidateData_DGeoSuite_only_supports_Max" + - "imumSliceWidth_one", resourceCulture); + "imumSliceWidth_one_but_calculation_has_MaximumSliceWidth_0", resourceCulture); } } /// - /// Looks up a localized string similar to Het is niet mogelijk om meerdere aquifer lagen te exporteren. Er is geen aquifer laag geëxporteerd.. + /// Looks up a localized string similar to De schematisatie van de berekening bevat meerdere aquifer lagen. D-GEO Suite Stability ondersteunt slechts 1 aquifer laag. Er worden daarom geen aquifer lagen geëxporteerd.. /// public static string MacroStabilityInwardsCalculationExporter_ValidateData_Multiple_aquifer_layers_not_supported_no_aquifer_layer_exported { get { Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx =================================================================== diff -u -r02bb3f034254e688fb76ea43a0be6c0d406a44d6 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision 02bb3f034254e688fb76ea43a0be6c0d406a44d6) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -214,11 +214,11 @@ Export from Riskeer - - D-GEO Suite Stability ondersteunt enkel een maximale lamelbreedte van 1 meter, om hieraan te voldoen is dit aangepast in de geëxporteerde berekening. + + De berekening bevat een lamelbreedte van {0} meter. D-GEO Suite Stability ondersteunt enkel een maximale lamelbreedte van 1 meter. Er wordt daarom een lamelbreedte van 1 meter geëxporteerd. - Het is niet mogelijk om meerdere aquifer lagen te exporteren. Er is geen aquifer laag geëxporteerd. + De schematisatie van de berekening bevat meerdere aquifer lagen. D-GEO Suite Stability ondersteunt slechts 1 aquifer laag. Er worden daarom geen aquifer lagen geëxporteerd. Berekening '{0}' heeft geen uitvoer. Deze berekening wordt overgeslagen. Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Exporters/MacroStabilityInwardsCalculationExporterTest.cs =================================================================== diff -u -r70a1224e4fe0f259a097819c8b0fe406464f861c -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Exporters/MacroStabilityInwardsCalculationExporterTest.cs (.../MacroStabilityInwardsCalculationExporterTest.cs) (revision 70a1224e4fe0f259a097819c8b0fe406464f861c) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Exporters/MacroStabilityInwardsCalculationExporterTest.cs (.../MacroStabilityInwardsCalculationExporterTest.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Globalization; using System.IO; using Components.Persistence.Stability; using Core.Common.Base.Data; @@ -164,7 +165,6 @@ // Assert Assert.IsFalse(File.Exists(filePath)); - Assert.IsFalse(File.Exists($"{filePath}.temp")); } [Test] @@ -191,7 +191,7 @@ // Assert PersistableDataModelTestHelper.AssertPersistableDataModel(calculation, filePath, persistenceFactory.PersistableDataModel); - Assert.AreEqual($"{filePath}.temp", persistenceFactory.FilePath); + Assert.AreEqual(filePath, persistenceFactory.FilePath); var persister = (MacroStabilityInwardsTestPersister) persistenceFactory.CreatedPersister; Assert.IsTrue(persister.PersistCalled); @@ -206,10 +206,10 @@ } [Test] - public void Export_RunsSuccessful_WritesFileAndRemovesTempFile() + public void Export_RunsSuccessful_WritesFile() { // Setup - string filePath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsCalculationExporterTest)}.{nameof(Export_RunsSuccessful_WritesFileAndRemovesTempFile)}.ValidFile.stix"); + string filePath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsCalculationExporterTest)}.{nameof(Export_RunsSuccessful_WritesFile)}.ValidFile.stix"); MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation()); calculation.Output = MacroStabilityInwardsOutputTestFactory.CreateRandomOutput(); @@ -225,7 +225,6 @@ // Assert Assert.IsTrue(exportResult); Assert.IsTrue(File.Exists(filePath)); - Assert.IsFalse(File.Exists($"{filePath}.temp")); } } finally @@ -241,11 +240,11 @@ { // Setup string filePath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsCalculationExporterTest)}.{nameof(Export_MaximumSliceWidthNotOne_LogsWarningAndReturnsTrue)}.ValidFile.stix"); - + MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation()); calculation.InputParameters.MaximumSliceWidth = (RoundedDouble) maximumSliceWidth; calculation.Output = MacroStabilityInwardsOutputTestFactory.CreateRandomOutput(); - + var exporter = new MacroStabilityInwardsCalculationExporter(calculation, new PersistenceFactory(), filePath, AssessmentSectionTestHelper.GetTestAssessmentLevel); try @@ -257,7 +256,7 @@ void Call() => exportResult = exporter.Export(); // Assert - const string expectedMessage = "D-GEO Suite Stability ondersteunt enkel een maximale lamelbreedte van 1 meter, om hieraan te voldoen is dit aangepast in de geëxporteerde berekening."; + string expectedMessage = $"De berekening bevat een lamelbreedte van {calculation.InputParameters.MaximumSliceWidth.ToString(null, CultureInfo.CurrentCulture)} meter. D-GEO Suite Stability ondersteunt enkel een maximale lamelbreedte van 1 meter. Er wordt daarom een lamelbreedte van 1 meter geëxporteerd."; TestHelper.AssertLogMessageWithLevelIsGenerated(Call, new Tuple(expectedMessage, LogLevelConstant.Warn)); Assert.IsTrue(exportResult); } @@ -273,11 +272,11 @@ { // Setup string filePath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsCalculationExporterTest)}.{nameof(Export_MaximumSliceWidthNotOne_LogsWarningAndReturnsTrue)}.ValidFile.stix"); - + MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation()); calculation.InputParameters.StochasticSoilProfile.SoilProfile.Layers.ForEachElementDo(layer => layer.Data.IsAquifer = true); calculation.Output = MacroStabilityInwardsOutputTestFactory.CreateRandomOutput(); - + var exporter = new MacroStabilityInwardsCalculationExporter(calculation, new PersistenceFactory(), filePath, AssessmentSectionTestHelper.GetTestAssessmentLevel); try @@ -289,7 +288,7 @@ void Call() => exportResult = exporter.Export(); // Assert - const string expectedMessage = "Het is niet mogelijk om meerdere aquifer lagen te exporteren. Er is geen aquifer laag geëxporteerd."; + const string expectedMessage = "De schematisatie van de berekening bevat meerdere aquifer lagen. D-GEO Suite Stability ondersteunt slechts 1 aquifer laag. Er worden daarom geen aquifer lagen geëxporteerd."; TestHelper.AssertLogMessageWithLevelIsGenerated(Call, new Tuple(expectedMessage, LogLevelConstant.Warn)); Assert.IsTrue(exportResult); } @@ -299,5 +298,42 @@ File.Delete(filePath); } } + + [Test] + public void Export_ErrorDuringCalculationExport_LogsErrorAndReturnsFalse() + { + // Setup + string folderPath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsCalculationExporterTest)}.{nameof(Export_ErrorDuringCalculationExport_LogsErrorAndReturnsFalse)}"); + Directory.CreateDirectory(folderPath); + + string filePath = Path.Combine(folderPath, "ValidFile.stix"); + + MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation()); + calculation.Output = MacroStabilityInwardsOutputTestFactory.CreateRandomOutput(); + + var exporter = new MacroStabilityInwardsCalculationExporter(calculation, new PersistenceFactory(), filePath, AssessmentSectionTestHelper.GetTestAssessmentLevel); + + try + { + using (var fileDisposeHelper = new FileDisposeHelper(filePath)) + using (new MacroStabilityInwardsCalculatorFactoryConfig()) + { + fileDisposeHelper.LockFiles(); + + // Call + var exportResult = false; + void Call() => exportResult = exporter.Export(); + + // Assert + string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'. Er is geen D-GEO Suite Stability Project geëxporteerd."; + TestHelper.AssertLogMessageWithLevelIsGenerated(Call, new Tuple(expectedMessage, LogLevelConstant.Error)); + Assert.IsFalse(exportResult); + } + } + finally + { + Directory.Delete(folderPath, true); + } + } } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Factories/MacroStabilityInwardsExportRegistryTest.cs =================================================================== diff -u -raa141f5355c7631aef79085d3bbea2d0bb4e9fa4 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Factories/MacroStabilityInwardsExportRegistryTest.cs (.../MacroStabilityInwardsExportRegistryTest.cs) (revision aa141f5355c7631aef79085d3bbea2d0bb4e9fa4) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Factories/MacroStabilityInwardsExportRegistryTest.cs (.../MacroStabilityInwardsExportRegistryTest.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -67,7 +67,7 @@ } [Test] - public void AddSettings_WithSettings_AddsSettings() + public void AddSettings_ValidStageType_AddsStageTypeWithSettingsId() { // Setup var registry = new MacroStabilityInwardsExportRegistry(); @@ -99,7 +99,7 @@ } [Test] - public void AddSoil_WithSoilLayer_AddsSoilLayer() + public void AddSoil_WithSoilLayer_AddsSoilLayerWithId() { // Setup MacroStabilityInwardsSoilLayer2D soilLayer = MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(); @@ -133,7 +133,7 @@ } [Test] - public void AddGeometry_WithGeometry_AddsGeometry() + public void AddGeometry_ValidStageType_AddsStageTypeWithGeometryId() { // Setup var registry = new MacroStabilityInwardsExportRegistry(); @@ -182,7 +182,7 @@ } [Test] - public void AddGeometryLayer_NewStageType_AddsStageTypeAndGeometryLayer() + public void AddGeometryLayer_NewStageType_AddsStageTypeAndGeometryLayerId() { // Setup MacroStabilityInwardsSoilLayer2D geometryLayer = MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(); @@ -207,7 +207,7 @@ } [Test] - public void AddGeometryLayer_StageTypeAlreadyRegistered_AddsGeometryLayer() + public void AddGeometryLayer_StageTypeAlreadyRegistered_AddsGeometryLayerId() { // Setup MacroStabilityInwardsSoilLayer2D geometryLayer1 = MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(); @@ -261,7 +261,7 @@ } [Test] - public void AddSoilLayer_WithSoilLayer_AddsSoilLayer() + public void AddSoilLayer_ValidStageType_AddsStageTypeWithSoilLayerId() { // Setup var registry = new MacroStabilityInwardsExportRegistry(); @@ -294,7 +294,7 @@ } [Test] - public void AddWaternet_WithWaternet_AddsWaternet() + public void AddWaternet_ValidStageType_AddsStageTypeWithWaternetId() { // Setup var registry = new MacroStabilityInwardsExportRegistry(); @@ -327,7 +327,7 @@ } [Test] - public void AddWaternetCreatorSettings_WithWaternetCreatorSettings_AddsWaternetCreatorSettings() + public void AddWaternetCreatorSettings_ValidStageType_AddsStageTypeWithWaternetCreatorSettingsId() { // Setup var registry = new MacroStabilityInwardsExportRegistry(); @@ -360,7 +360,7 @@ } [Test] - public void AddState_WithWaternetCreatorSettings_AddsWaternetCreatorSettings() + public void AddState_ValidStageType_AddsStageTypeWithStateId() { // Setup var registry = new MacroStabilityInwardsExportRegistry(); Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil.Test/MacroStabilityInwardsTestPersistenceFactoryTest.cs =================================================================== diff -u -r3bf3b71d05219007bef7d8397ddb4ff2494eea8d -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil.Test/MacroStabilityInwardsTestPersistenceFactoryTest.cs (.../MacroStabilityInwardsTestPersistenceFactoryTest.cs) (revision 3bf3b71d05219007bef7d8397ddb4ff2494eea8d) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil.Test/MacroStabilityInwardsTestPersistenceFactoryTest.cs (.../MacroStabilityInwardsTestPersistenceFactoryTest.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -46,10 +46,10 @@ } [Test] - public void CreateArchivePersister_ThrowExceptionAndWriteFalseFalse_SetsPropertiesAndReturnsTestPersister() + public void CreateArchivePersister_ThrowExceptionAndWriteFileFalse_SetsPropertiesAndReturnsTestPersister() { // Setup - string filePath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsTestPersistenceFactoryTest)}.{nameof(CreateArchivePersister_ThrowExceptionAndWriteFalseFalse_SetsPropertiesAndReturnsTestPersister)}.ValidFile.stix"); + string filePath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsTestPersistenceFactoryTest)}.{nameof(CreateArchivePersister_ThrowExceptionAndWriteFileFalse_SetsPropertiesAndReturnsTestPersister)}.ValidFile.stix"); var persistableDataModel = new PersistableDataModel(); var persistenceFactory = new MacroStabilityInwardsTestPersistenceFactory(); @@ -79,7 +79,7 @@ // Assert var exception = Assert.Throws(Call); - Assert.AreEqual("Exception in persistor.", exception.Message); + Assert.AreEqual("Exception in persister.", exception.Message); } [Test] Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/MacroStabilityInwardsTestPersistenceFactory.cs =================================================================== diff -u -r3bf3b71d05219007bef7d8397ddb4ff2494eea8d -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/MacroStabilityInwardsTestPersistenceFactory.cs (.../MacroStabilityInwardsTestPersistenceFactory.cs) (revision 3bf3b71d05219007bef7d8397ddb4ff2494eea8d) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/MacroStabilityInwardsTestPersistenceFactory.cs (.../MacroStabilityInwardsTestPersistenceFactory.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -38,7 +38,7 @@ public PersistableDataModel PersistableDataModel { get; private set; } /// - /// Gets the FilePath. + /// Gets the file path. /// public string FilePath { get; private set; } @@ -61,7 +61,7 @@ { if (ThrowException) { - throw new Exception("Exception in persistor."); + throw new Exception("Exception in persister."); } FilePath = path; Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/MacroStabilityInwardsTestPersister.cs =================================================================== diff -u -r8baf1e4a72fd086748259c63e6f40f5d8de021e0 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/MacroStabilityInwardsTestPersister.cs (.../MacroStabilityInwardsTestPersister.cs) (revision 8baf1e4a72fd086748259c63e6f40f5d8de021e0) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/MacroStabilityInwardsTestPersister.cs (.../MacroStabilityInwardsTestPersister.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -29,7 +29,7 @@ public class MacroStabilityInwardsTestPersister : IPersister { /// - /// Gets whether persist is called. + /// Gets whether is called. /// public bool PersistCalled { get; private set; } Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/PersistableDataModelTestHelper.cs =================================================================== diff -u -r2695eb91bedfc91a17472f04054c7a756f0ea1e1 -rb9ceec3c71d972d3d467c1520033ac48cf77b2e9 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/PersistableDataModelTestHelper.cs (.../PersistableDataModelTestHelper.cs) (revision 2695eb91bedfc91a17472f04054c7a756f0ea1e1) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.TestUtil/PersistableDataModelTestHelper.cs (.../PersistableDataModelTestHelper.cs) (revision b9ceec3c71d972d3d467c1520033ac48cf77b2e9) @@ -198,11 +198,11 @@ } /// - /// Assert whether the contains the data + /// Asserts whether the contains the data /// that is representative for the . /// /// The distribution that contains the original data. - /// the + /// The /// that needs to be asserted. /// The expected value for . /// Thrown when the data in