Index: Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r41dd0e1b8c5d9c0bf94e4ebca9f5d867583ba85d -ra13bd1b93f177cf300337fd36b3a6ac3b948ecce --- Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 41dd0e1b8c5d9c0bf94e4ebca9f5d867583ba85d) +++ Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision a13bd1b93f177cf300337fd36b3a6ac3b948ecce) @@ -193,6 +193,13 @@ context.WrappedData }, filePath), GetInquiryHelper()); + + yield return RiskeerExportInfoFactory.CreateCalculationConfigurationExportInfo( + (context, filePath) => new PipingCalculationConfigurationExporter(new[] + { + context.WrappedData + }, filePath), + GetInquiryHelper()); } public override IEnumerable GetUpdateInfos() Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/ProbabilisticPipingCalculationScenarioContextExportInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/ProbabilisticPipingCalculationScenarioContextExportInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ExportInfos/ProbabilisticPipingCalculationScenarioContextExportInfoTest.cs (revision a13bd1b93f177cf300337fd36b3a6ac3b948ecce) @@ -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.Probabilistic; +using Riskeer.Piping.Data.SoilProfile; +using Riskeer.Piping.Forms.PresentationObjects.Probabilistic; +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 ProbabilisticPipingCalculationScenarioContextExportInfoTest + { + 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(ProbabilisticPipingCalculationScenarioContext)); + } + + [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 ProbabilisticPipingCalculationScenarioContext(new ProbabilisticPipingCalculationScenario(), + 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 ProbabilisticPipingCalculationScenarioContext(new ProbabilisticPipingCalculationScenario(), + 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.Plugin.Test/PipingPluginTest.cs =================================================================== diff -u -r6f9faf2191aaab7e438551794102cbdadf386b1e -ra13bd1b93f177cf300337fd36b3a6ac3b948ecce --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision 6f9faf2191aaab7e438551794102cbdadf386b1e) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision a13bd1b93f177cf300337fd36b3a6ac3b948ecce) @@ -291,9 +291,10 @@ ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray(); // Assert - Assert.AreEqual(2, exportInfos.Length); + Assert.AreEqual(3, exportInfos.Length); Assert.IsTrue(exportInfos.Any(tni => tni.DataType == typeof(PipingCalculationGroupContext))); Assert.IsTrue(exportInfos.Any(tni => tni.DataType == typeof(SemiProbabilisticPipingCalculationScenarioContext))); + Assert.IsTrue(exportInfos.Any(tni => tni.DataType == typeof(ProbabilisticPipingCalculationScenarioContext))); } mocks.VerifyAll();