Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs =================================================================== diff -u -r8da4704f43ae462b1eeae911f401e9b41cb3ce50 -raf3a45afddc78175220ee97da11e78a9d0350dc2 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 8da4704f43ae462b1eeae911f401e9b41cb3ce50) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision af3a45afddc78175220ee97da11e78a9d0350dc2) @@ -40,7 +40,6 @@ using Riskeer.Integration.Plugin.Properties; using Riskeer.MacroStabilityInwards.Data; using Riskeer.Piping.Data; -using Riskeer.Piping.Data.SemiProbabilistic; using Riskeer.Revetment.Data; using Riskeer.StabilityPointStructures.Data; using Riskeer.StabilityStoneCover.Data; @@ -212,7 +211,7 @@ if (mergeData.MergePiping) { targetAssessmentSection.Piping = sourceAssessmentSection.Piping; - UpdateCalculationHydraulicBoundaryLocationReferences( + UpdateCalculationHydraulicBoundaryLocationReferences, PipingInput>( targetAssessmentSection.Piping, hydraulicBoundaryLocations); LogMergeMessage(targetAssessmentSection.Piping); } Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs =================================================================== diff -u -r8da4704f43ae462b1eeae911f401e9b41cb3ce50 -raf3a45afddc78175220ee97da11e78a9d0350dc2 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 8da4704f43ae462b1eeae911f401e9b41cb3ce50) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision af3a45afddc78175220ee97da11e78a9d0350dc2) @@ -42,8 +42,7 @@ using Riskeer.Integration.Data.Merge; using Riskeer.Integration.Plugin.Merge; using Riskeer.MacroStabilityInwards.Data; -using Riskeer.Piping.Data; -using Riskeer.Piping.Data.SemiProbabilistic; +using Riskeer.Piping.Data.TestUtil; using Riskeer.StabilityPointStructures.Data; using Riskeer.StabilityStoneCover.Data; using Riskeer.WaveImpactAsphaltCover.Data; @@ -384,7 +383,7 @@ AssessmentSection targetAssessmentSection = CreateAssessmentSection(targetLocations); AssessmentSection sourceAssessmentSection = CreateAssessmentSection(sourceLocations); - sourceAssessmentSection.Piping.CalculationsGroup.Children.Add(new SemiProbabilisticPipingCalculationScenario(new GeneralPipingInput()) + sourceAssessmentSection.Piping.CalculationsGroup.Children.Add(new TestPipingCalculation { InputParameters = { @@ -473,7 +472,7 @@ })); // Then - var pipingCalculation = (SemiProbabilisticPipingCalculationScenario) targetAssessmentSection.Piping.Calculations.Single(); + var pipingCalculation = (TestPipingCalculation) targetAssessmentSection.Piping.Calculations.Single(); Assert.AreSame(targetLocations[0], pipingCalculation.InputParameters.HydraulicBoundaryLocation); var grassInwardsCalculation = (GrassCoverErosionInwardsCalculationScenario) targetAssessmentSection.GrassCoverErosionInwards.Calculations.Single(); Fisheye: Tag af3a45afddc78175220ee97da11e78a9d0350dc2 refers to a dead (removed) revision in file `Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/PipingCalculationContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/SemiProbabilisticPipingCalculationScenarioContextExportInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/SemiProbabilisticPipingCalculationScenarioContextExportInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/SemiProbabilisticPipingCalculationScenarioContextExportInfoTest.cs (revision af3a45afddc78175220ee97da11e78a9d0350dc2) @@ -0,0 +1,129 @@ +// Copyright (C) Stichting Deltares 2019. 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.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui; +using Core.Common.Gui.Forms.MainWindow; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Calculation; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.SemiProbabilistic; +using Riskeer.Piping.Data.SoilProfile; +using Riskeer.Piping.Forms.PresentationObjects.SemiProbabilistic; +using Riskeer.Piping.IO.Configurations; +using Riskeer.Piping.Primitives; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + +namespace Riskeer.Piping.Plugin.Test.ExportInfos +{ + [TestFixture] + public class SemiProbabilisticPipingCalculationScenarioContextExportInfoTest + { + private PipingPlugin plugin; + private ExportInfo info; + private MockRepository mocks; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + var mainWindow = mocks.Stub(); + var gui = mocks.Stub(); + gui.Stub(g => g.MainWindow).Return(mainWindow); + mocks.Replay(gui); + mocks.Replay(mainWindow); + + plugin = new PipingPlugin + { + Gui = gui + }; + + info = plugin.GetExportInfos().First(ei => ei.DataType == typeof(SemiProbabilisticPipingCalculationScenarioContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(info.CreateFileExporter); + Assert.IsNotNull(info.IsEnabled); + Assert.AreEqual("Riskeer berekeningenconfiguratie", info.Name); + Assert.AreEqual("xml", info.Extension); + Assert.AreEqual("Algemeen", info.Category); + TestHelper.AssertImagesAreEqual(CoreCommonGuiResources.ExportIcon, info.Image); + Assert.IsNotNull(info.GetExportPath); + } + + [Test] + public void CreateFileExporter_Always_ReturnFileExporter() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var context = new SemiProbabilisticPipingCalculationScenarioContext(new SemiProbabilisticPipingCalculationScenario(new GeneralPipingInput()), + new CalculationGroup(), + Enumerable.Empty(), + Enumerable.Empty(), + new PipingFailureMechanism(), + assessmentSection); + + // Call + IFileExporter fileExporter = info.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + } + + [Test] + public void IsEnabled_Always_ReturnTrue() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var context = new SemiProbabilisticPipingCalculationScenarioContext(new SemiProbabilisticPipingCalculationScenario(new GeneralPipingInput()), + new CalculationGroup(), + Enumerable.Empty(), + Enumerable.Empty(), + new PipingFailureMechanism(), + assessmentSection); + + // Call + bool isEnabled = info.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + } +} \ No newline at end of file Index: Riskeer/Piping/test/Riskeer.Piping.Service.Test/PipingDataSynchronizationServiceTest.cs =================================================================== diff -u -r9b781d1ba8c9a11d9ec8582f93f33df6e12cf270 -raf3a45afddc78175220ee97da11e78a9d0350dc2 --- Riskeer/Piping/test/Riskeer.Piping.Service.Test/PipingDataSynchronizationServiceTest.cs (.../PipingDataSynchronizationServiceTest.cs) (revision 9b781d1ba8c9a11d9ec8582f93f33df6e12cf270) +++ Riskeer/Piping/test/Riskeer.Piping.Service.Test/PipingDataSynchronizationServiceTest.cs (.../PipingDataSynchronizationServiceTest.cs) (revision af3a45afddc78175220ee97da11e78a9d0350dc2) @@ -504,9 +504,9 @@ .Cast>(); PipingStochasticSoilProfile profileToDelete = null; - foreach (IPipingCalculation pipingCalculationScenario in calculations) + foreach (IPipingCalculation calculation in calculations) { - PipingInput input = pipingCalculationScenario.InputParameters; + PipingInput input = calculation.InputParameters; PipingStochasticSoilProfile currentProfile = input.StochasticSoilProfile; if (profileToDelete == null) { @@ -537,9 +537,9 @@ var expectedInputs = new List(); - foreach (IPipingCalculation pipingCalculationScenario in calculations) + foreach (IPipingCalculation calculation in calculations) { - PipingInput input = pipingCalculationScenario.InputParameters; + PipingInput input = calculation.InputParameters; PipingStochasticSoilProfile currentProfile = input.StochasticSoilProfile; if (profileToDelete == null) { @@ -548,7 +548,7 @@ if (profileToDelete != null && ReferenceEquals(profileToDelete, currentProfile)) { - pipingCalculationScenario.ClearOutput(); + calculation.ClearOutput(); expectedInputs.Add(input); } } @@ -573,9 +573,9 @@ PipingStochasticSoilProfile profileToDelete = null; - foreach (IPipingCalculation pipingCalculationScenario in calculations) + foreach (IPipingCalculation calculation in calculations) { - PipingInput input = pipingCalculationScenario.InputParameters; + PipingInput input = calculation.InputParameters; PipingStochasticSoilProfile currentProfile = input.StochasticSoilProfile; if (profileToDelete == null) { @@ -584,9 +584,9 @@ if (profileToDelete != null && ReferenceEquals(profileToDelete, currentProfile)) { - if (pipingCalculationScenario.HasOutput) + if (calculation.HasOutput) { - expectedAffectedObjects.Add(pipingCalculationScenario); + expectedAffectedObjects.Add(calculation); } expectedAffectedObjects.Add(input); @@ -639,9 +639,9 @@ .Cast>(); PipingStochasticSoilProfile profileToDelete = null; - foreach (IPipingCalculation pipingCalculationScenario in calculations) + foreach (IPipingCalculation calculation in calculations) { - PipingInput input = pipingCalculationScenario.InputParameters; + PipingInput input = calculation.InputParameters; PipingStochasticSoilProfile currentProfile = input.StochasticSoilProfile; if (profileToDelete == null) { @@ -672,9 +672,9 @@ var expectedInputs = new List(); - foreach (IPipingCalculation pipingCalculationScenario in calculations) + foreach (IPipingCalculation calculation in calculations) { - PipingInput input = pipingCalculationScenario.InputParameters; + PipingInput input = calculation.InputParameters; PipingStochasticSoilProfile currentProfile = input.StochasticSoilProfile; if (profileToDelete == null) { @@ -683,7 +683,7 @@ if (profileToDelete != null && ReferenceEquals(profileToDelete, currentProfile)) { - pipingCalculationScenario.ClearOutput(); + calculation.ClearOutput(); expectedInputs.Add(input); } } @@ -708,9 +708,9 @@ PipingStochasticSoilProfile profileToDelete = null; - foreach (IPipingCalculation pipingCalculationScenario in calculations) + foreach (IPipingCalculation calculation in calculations) { - PipingInput input = pipingCalculationScenario.InputParameters; + PipingInput input = calculation.InputParameters; PipingStochasticSoilProfile currentProfile = input.StochasticSoilProfile; if (profileToDelete == null) { @@ -719,9 +719,9 @@ if (profileToDelete != null && ReferenceEquals(profileToDelete, currentProfile)) { - if (pipingCalculationScenario.HasOutput) + if (calculation.HasOutput) { - expectedAffectedObjects.Add(pipingCalculationScenario); + expectedAffectedObjects.Add(calculation); } expectedAffectedObjects.Add(input);