Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/FileImporters/AdoptableFailureMechanismSectionResultUpdateStrategy.cs
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/FileImporters/AdoptableFailureMechanismSectionResultUpdateStrategy.cs (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/FileImporters/AdoptableFailureMechanismSectionResultUpdateStrategy.cs (revision 281a969c7c5ad62b9cf607c99a076287ad651c42)
@@ -0,0 +1,53 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.IO.FileImporters;
+
+namespace Riskeer.Integration.Plugin.FileImporters
+{
+ ///
+ /// An update strategy that can be used to update a
+ /// instance with data from an old instance.
+ ///
+ public class AdoptableFailureMechanismSectionResultUpdateStrategy : IFailureMechanismSectionResultUpdateStrategy
+ {
+ public void UpdateSectionResult(AdoptableFailureMechanismSectionResult origin, AdoptableFailureMechanismSectionResult target)
+ {
+ if (origin == null)
+ {
+ throw new ArgumentNullException(nameof(origin));
+ }
+
+ if (target == null)
+ {
+ throw new ArgumentNullException(nameof(target));
+ }
+
+ target.IsRelevant = origin.IsRelevant;
+ target.InitialFailureMechanismResultType = origin.InitialFailureMechanismResultType;
+ target.ManualInitialFailureMechanismResultSectionProbability = origin.ManualInitialFailureMechanismResultSectionProbability;
+ target.FurtherAnalysisNeeded = origin.FurtherAnalysisNeeded;
+ target.RefinedSectionProbability = origin.RefinedSectionProbability;
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/FileImporters/AdoptableFailureMechanismSectionResultUpdateStrategyTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/FileImporters/AdoptableFailureMechanismSectionResultUpdateStrategyTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/FileImporters/AdoptableFailureMechanismSectionResultUpdateStrategyTest.cs (revision 281a969c7c5ad62b9cf607c99a076287ad651c42)
@@ -0,0 +1,63 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Common.Plugin.TestUtil.FileImporters;
+using Riskeer.Integration.Plugin.FileImporters;
+
+namespace Riskeer.Integration.Plugin.Test.FileImporters
+{
+ [TestFixture]
+ public class AdoptableFailureMechanismSectionResultUpdateStrategyTest : FailureMechanismSectionResultUpdateStrategyTestFixture<
+ AdoptableFailureMechanismSectionResultUpdateStrategy, AdoptableFailureMechanismSectionResult>
+ {
+ protected override AdoptableFailureMechanismSectionResult CreateEmptySectionResult()
+ {
+ return new AdoptableFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+ }
+
+ protected override AdoptableFailureMechanismSectionResult CreateConfiguredSectionResult()
+ {
+ var random = new Random(39);
+ return new AdoptableFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ IsRelevant = random.NextBoolean(),
+ InitialFailureMechanismResultType = random.NextEnumValue(),
+ ManualInitialFailureMechanismResultSectionProbability = random.NextDouble(),
+ FurtherAnalysisNeeded = random.NextBoolean(),
+ RefinedSectionProbability = random.NextDouble()
+ };
+ }
+
+ protected override void AssertSectionResult(AdoptableFailureMechanismSectionResult originResult, AdoptableFailureMechanismSectionResult targetResult)
+ {
+ Assert.AreEqual(originResult.IsRelevant, targetResult.IsRelevant);
+ Assert.AreEqual(originResult.InitialFailureMechanismResultType, targetResult.InitialFailureMechanismResultType);
+ Assert.AreEqual(originResult.ManualInitialFailureMechanismResultSectionProbability, targetResult.ManualInitialFailureMechanismResultSectionProbability);
+ Assert.AreEqual(originResult.FurtherAnalysisNeeded, targetResult.FurtherAnalysisNeeded);
+ Assert.AreEqual(originResult.RefinedSectionProbability, targetResult.RefinedSectionProbability);
+ }
+ }
+}
\ No newline at end of file