Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/FileImporter/MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/FileImporter/MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/FileImporter/MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.cs (revision 70121130d7242b6fa172d6e1aaefc01e3c75266f) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.IO.SoilProfiles; + +namespace Ringtoets.MacroStabilityInwards.Plugin.FileImporter +{ + /// + /// Factory for creating valid configurations for the . + /// for macro stability inwards. + /// + public static class MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory + { + /// + /// Creates a configuration to replace the current stochastic soil models on + /// with imported stochastic soil models. + /// + /// The failure mechanism to replace the stochastic soil models for. + /// The configuration for the replace operation. + /// Thrown when is null. + public static StochasticSoilModelImporterConfiguration CreateReplaceStrategyConfiguration( + MacroStabilityInwardsFailureMechanism failureMechanism) + { + return new StochasticSoilModelImporterConfiguration( + new MacroStabilityInwardsStochasticSoilModelTransformer(), + new MacroStabilityInwardsStochasticSoilModelFilter(), + new MacroStabilityInwardsStochasticSoilModelReplaceDataStrategy(failureMechanism)); + } + + /// + /// Creates a configuration to update the current stochastic soil models on + /// with imported stochastic soil models. + /// + /// The failure mechanism to update the stochastic soil models for. + /// The configuration for the update operation. + /// Thrown when is null. + public static StochasticSoilModelImporterConfiguration CreateUpdateStrategyConfiguration( + MacroStabilityInwardsFailureMechanism failureMechanism) + { + return new StochasticSoilModelImporterConfiguration( + new MacroStabilityInwardsStochasticSoilModelTransformer(), + new MacroStabilityInwardsStochasticSoilModelFilter(), + new MacroStabilityInwardsStochasticSoilModelUpdateDataStrategy(failureMechanism)); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/Ringtoets.MacroStabilityInwards.Plugin.csproj =================================================================== diff -u -r86e6c6985b6841357f600bff63c169a92b528640 -r70121130d7242b6fa172d6e1aaefc01e3c75266f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/Ringtoets.MacroStabilityInwards.Plugin.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.csproj) (revision 86e6c6985b6841357f600bff63c169a92b528640) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/Ringtoets.MacroStabilityInwards.Plugin.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.csproj) (revision 70121130d7242b6fa172d6e1aaefc01e3c75266f) @@ -48,6 +48,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactoryTest.cs (revision 70121130d7242b6fa172d6e1aaefc01e3c75266f) @@ -0,0 +1,83 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.IO.SoilProfiles; +using Ringtoets.MacroStabilityInwards.Plugin.FileImporter; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.FileImporter +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactoryTest + { + [Test] + public void CreateUpdateStrategyConfiguration_WithoutFailureMechanism_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void CreateUpdateStrategyConfiguration_ValidArgument_ReturnsUpdateStrategyAndTransformerForMacroStabilityInwards() + { + // Call + StochasticSoilModelImporterConfiguration result = + MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(new MacroStabilityInwardsFailureMechanism()); + + // Assert + Assert.IsNotNull(result); + Assert.IsInstanceOf(result.Transformer); + Assert.IsInstanceOf(result.MechanismFilter); + Assert.IsInstanceOf(result.UpdateStrategy); + } + + [Test] + public void CreateReplaceStrategyConfiguration_WithoutFailureMechanism_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void CreateReplaceStrategyConfiguration_ValidArgument_ReturnsReplaceStrategyAndTransformerForMacroStabilityInwards() + { + // Call + StochasticSoilModelImporterConfiguration result = + MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(new MacroStabilityInwardsFailureMechanism()); + + // Assert + Assert.IsNotNull(result); + Assert.IsInstanceOf(result.Transformer); + Assert.IsInstanceOf(result.MechanismFilter); + Assert.IsInstanceOf(result.UpdateStrategy); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj =================================================================== diff -u -r86e6c6985b6841357f600bff63c169a92b528640 -r70121130d7242b6fa172d6e1aaefc01e3c75266f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 86e6c6985b6841357f600bff63c169a92b528640) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 70121130d7242b6fa172d6e1aaefc01e3c75266f) @@ -67,6 +67,7 @@ + Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingStochasticSoilModelImporterConfigurationFactory.cs =================================================================== diff -u -r09693d79085118c47709b7059ab7c1ef459ad2aa -r70121130d7242b6fa172d6e1aaefc01e3c75266f --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingStochasticSoilModelImporterConfigurationFactory.cs (.../PipingStochasticSoilModelImporterConfigurationFactory.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingStochasticSoilModelImporterConfigurationFactory.cs (.../PipingStochasticSoilModelImporterConfigurationFactory.cs) (revision 70121130d7242b6fa172d6e1aaefc01e3c75266f) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.SoilProfile; @@ -37,6 +38,7 @@ /// /// The failure mechanism to replace the stochastic soil models for. /// The configuration for the replace operation. + /// Thrown when is null. public static StochasticSoilModelImporterConfiguration CreateReplaceStrategyConfiguration( PipingFailureMechanism failureMechanism) { @@ -52,6 +54,7 @@ /// /// The failure mechanism to update the stochastic soil models for. /// The configuration for the update operation. + /// Thrown when is null. public static StochasticSoilModelImporterConfiguration CreateUpdateStrategyConfiguration( PipingFailureMechanism failureMechanism) {