Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/MacroStabilityInwardsExportRegistry.cs =================================================================== diff -u -r39badf1bffd27f78e31ce928a4918c0633af5c43 -rab93864f0b8a15f2d9a62722ab00fffb8cf609ed --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/MacroStabilityInwardsExportRegistry.cs (.../MacroStabilityInwardsExportRegistry.cs) (revision 39badf1bffd27f78e31ce928a4918c0633af5c43) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Factories/MacroStabilityInwardsExportRegistry.cs (.../MacroStabilityInwardsExportRegistry.cs) (revision ab93864f0b8a15f2d9a62722ab00fffb8cf609ed) @@ -37,6 +37,7 @@ private readonly Dictionary> geometryLayers; private readonly Dictionary soilLayers; private readonly Dictionary waternets; + private readonly Dictionary waternetCreatorSettings; /// /// Creates a new instance of . @@ -49,6 +50,7 @@ geometryLayers = new Dictionary>(); soilLayers = new Dictionary(); waternets = new Dictionary(); + waternetCreatorSettings = new Dictionary(); } /// @@ -80,6 +82,11 @@ /// Gets the waternets and their unique identifiers. /// public IReadOnlyDictionary Waternets => waternets; + + /// + /// Gets the waternet creator settings and their unique identifiers. + /// + public IReadOnlyDictionary WaternetCreatorSettings => waternetCreatorSettings; /// /// Adds calculation settings to the registry. @@ -187,6 +194,21 @@ } /// + /// Adds waternet creator settings to the register. + /// + /// The + /// to register the waternet creator settings for. + /// The id of the waternet creator settings. + /// Thrown when + /// has an invalid value. + public void AddWaternetCreatorSettings(MacroStabilityInwardsExportStageType stageType, string id) + { + ValidateStageType(stageType); + + waternetCreatorSettings.Add(stageType, id); + } + + /// /// Validates the . /// /// The stage type to validate. Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Factories/MacroStabilityInwardsExportRegistryTest.cs =================================================================== diff -u -r39badf1bffd27f78e31ce928a4918c0633af5c43 -rab93864f0b8a15f2d9a62722ab00fffb8cf609ed --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Factories/MacroStabilityInwardsExportRegistryTest.cs (.../MacroStabilityInwardsExportRegistryTest.cs) (revision 39badf1bffd27f78e31ce928a4918c0633af5c43) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Factories/MacroStabilityInwardsExportRegistryTest.cs (.../MacroStabilityInwardsExportRegistryTest.cs) (revision ab93864f0b8a15f2d9a62722ab00fffb8cf609ed) @@ -47,6 +47,7 @@ CollectionAssert.IsEmpty(registry.GeometryLayers); CollectionAssert.IsEmpty(registry.SoilLayers); CollectionAssert.IsEmpty(registry.Waternets); + CollectionAssert.IsEmpty(registry.WaternetCreatorSettings); } [Test] @@ -306,5 +307,38 @@ Assert.AreEqual(stageType, registeredWaternets.Key); Assert.AreEqual(id, registeredWaternets.Value); } + + [Test] + public void AddWaternetCreatorSettings_InvalidStageType_ThrowsInvalidEnumArgumentException() + { + // Setup + var registry = new MacroStabilityInwardsExportRegistry(); + const MacroStabilityInwardsExportStageType stageType = (MacroStabilityInwardsExportStageType)99; + + // Call + void Call() => registry.AddWaternetCreatorSettings(stageType, "1"); + + // Assert + string expectedMessage = $"The value of argument '{nameof(stageType)}' ({stageType}) is invalid for Enum type '{nameof(MacroStabilityInwardsExportStageType)}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); + } + + [Test] + public void AddWaternetCreatorSettings_WithWaternetCreatorSettings_AddsWaternetCreatorSettings() + { + // Setup + var registry = new MacroStabilityInwardsExportRegistry(); + var stageType = new Random(21).NextEnumValue(); + const string id = "1"; + + // Call + registry.AddWaternetCreatorSettings(stageType, id); + + // Assert + Assert.AreEqual(1, registry.WaternetCreatorSettings.Count); + KeyValuePair registeredWaternetCreatorSettings = registry.WaternetCreatorSettings.Single(); + Assert.AreEqual(stageType, registeredWaternetCreatorSettings.Key); + Assert.AreEqual(id, registeredWaternetCreatorSettings.Value); + } } } \ No newline at end of file