Index: Riskeer/Piping/src/Riskeer.Piping.Plugin/ImportInfos/PipingImportInfoFactory.cs
===================================================================
diff -u -r82247f1951bfa0cf5a813f684d2cc05019bbe917 -r846617fdda8ea9d53df0439343bb521c2729c760
--- Riskeer/Piping/src/Riskeer.Piping.Plugin/ImportInfos/PipingImportInfoFactory.cs (.../PipingImportInfoFactory.cs) (revision 82247f1951bfa0cf5a813f684d2cc05019bbe917)
+++ Riskeer/Piping/src/Riskeer.Piping.Plugin/ImportInfos/PipingImportInfoFactory.cs (.../PipingImportInfoFactory.cs) (revision 846617fdda8ea9d53df0439343bb521c2729c760)
@@ -25,7 +25,9 @@
using Core.Common.Util;
using Riskeer.Common.IO.FileImporters;
using Riskeer.Common.IO.FileImporters.MessageProviders;
+using Riskeer.Piping.Data;
using Riskeer.Piping.Forms.PresentationObjects;
+using Riskeer.Piping.Plugin.FileImporter;
using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
using RiskeerCommonIOResources = Riskeer.Common.IO.Properties.Resources;
@@ -39,19 +41,9 @@
///
/// Creates a object for a .
///
- /// The
- /// to use in the importer.
/// An object.
- /// Thrown when
- /// is null.
- public static ImportInfo CreateFailureMechanismSectionsImportInfo(
- IFailureMechanismSectionUpdateStrategy updateStrategy)
+ public static ImportInfo CreateFailureMechanismSectionsImportInfo()
{
- if (updateStrategy == null)
- {
- throw new ArgumentNullException(nameof(updateStrategy));
- }
-
return new ImportInfo
{
Name = RiskeerCommonFormsResources.FailureMechanismSections_DisplayName,
@@ -62,7 +54,8 @@
IsEnabled = context => context.AssessmentSection.ReferenceLine.Points.Any(),
CreateFileImporter = (context, filePath) => new FailureMechanismSectionsImporter(
context.WrappedData, context.AssessmentSection.ReferenceLine,
- filePath, updateStrategy, new ImportMessageProvider())
+ filePath, new PipingFailureMechanismSectionReplaceStrategy((PipingFailureMechanism) context.WrappedData),
+ new ImportMessageProvider())
};
}
}
Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ImportInfos/PipingImportInfoFactoryTest.cs
===================================================================
diff -u -r82247f1951bfa0cf5a813f684d2cc05019bbe917 -r846617fdda8ea9d53df0439343bb521c2729c760
--- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ImportInfos/PipingImportInfoFactoryTest.cs (.../PipingImportInfoFactoryTest.cs) (revision 82247f1951bfa0cf5a813f684d2cc05019bbe917)
+++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ImportInfos/PipingImportInfoFactoryTest.cs (.../PipingImportInfoFactoryTest.cs) (revision 846617fdda8ea9d53df0439343bb521c2729c760)
@@ -19,13 +19,11 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using Core.Common.Base.Geometry;
using Core.Common.Gui.Plugin;
using Core.Common.TestUtil;
using Core.Common.Util;
using NUnit.Framework;
-using Rhino.Mocks;
using Riskeer.Common.Data.TestUtil;
using Riskeer.Common.IO.FileImporters;
using Riskeer.Piping.Data;
@@ -39,26 +37,11 @@
public class PipingImportInfoFactoryTest
{
[Test]
- public void CreateFailureMechanismSectionsImportInfo_UpdateStrategyNull_ThrowsArgumentNullException()
- {
- // Call
- void Call() => PipingImportInfoFactory.CreateFailureMechanismSectionsImportInfo(null);
-
- // Assert
- var exception = Assert.Throws(Call);
- Assert.AreEqual("updateStrategy", exception.ParamName);
- }
-
- [Test]
[TestCase(true)]
[TestCase(false)]
public void CreateFailureMechanismSectionsImportInfo_WithData_ReturnsImportInfo(bool isEnabled)
{
// Setup
- var mocks = new MockRepository();
- var updateStrategy = mocks.Stub();
- mocks.ReplayAll();
-
var assessmentSection = new AssessmentSectionStub();
if (isEnabled)
{
@@ -69,7 +52,7 @@
}
// Call
- ImportInfo importInfo = PipingImportInfoFactory.CreateFailureMechanismSectionsImportInfo(updateStrategy);
+ ImportInfo importInfo = PipingImportInfoFactory.CreateFailureMechanismSectionsImportInfo();
// Assert
Assert.AreEqual("Vakindeling", importInfo.Name);
@@ -83,8 +66,6 @@
var context = new PipingFailureMechanismSectionsContext(new PipingFailureMechanism(), assessmentSection);
Assert.AreEqual(isEnabled, importInfo.IsEnabled(context));
Assert.IsInstanceOf(importInfo.CreateFileImporter(context, ""));
-
- mocks.VerifyAll();
}
}
}
\ No newline at end of file