Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Data.TestUtil.Test/TestClosingStructureCalculationScenarioTest.cs =================================================================== diff -u -re3e3433c92e142f37d6a5ed931a70ad582c240bc -r736139a117a677f68c445003d4b47100bbf5f9bf --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Data.TestUtil.Test/TestClosingStructureCalculationScenarioTest.cs (.../TestClosingStructureCalculationScenarioTest.cs) (revision e3e3433c92e142f37d6a5ed931a70ad582c240bc) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Data.TestUtil.Test/TestClosingStructureCalculationScenarioTest.cs (.../TestClosingStructureCalculationScenarioTest.cs) (revision 736139a117a677f68c445003d4b47100bbf5f9bf) @@ -40,6 +40,8 @@ // Assert Assert.IsInstanceOf>(calculation); Assert.AreEqual("Nieuwe berekening", calculation.Name); + Assert.AreEqual(1, calculation.Contribution); + Assert.IsTrue(calculation.IsRelevant); Assert.IsNotNull(calculation.InputParameters); Assert.IsNull(calculation.Comments.Body); Assert.IsFalse(calculation.HasOutput); Fisheye: Tag 736139a117a677f68c445003d4b47100bbf5f9bf refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ExportInfos/ClosingStructuresCalculationContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ExportInfos/ClosingStructuresCalculationScenarioContextExportInfoTest.cs =================================================================== diff -u --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ExportInfos/ClosingStructuresCalculationScenarioContextExportInfoTest.cs (revision 0) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ExportInfos/ClosingStructuresCalculationScenarioContextExportInfoTest.cs (revision 736139a117a677f68c445003d4b47100bbf5f9bf) @@ -0,0 +1,123 @@ +// 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.ClosingStructures.Data; +using Riskeer.ClosingStructures.Data.TestUtil; +using Riskeer.ClosingStructures.Forms.PresentationObjects; +using Riskeer.ClosingStructures.IO.Configurations; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.Calculation; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + +namespace Riskeer.ClosingStructures.Plugin.Test.ExportInfos +{ + [TestFixture] + public class ClosingStructuresCalculationScenarioContextExportInfoTest + { + private ClosingStructuresPlugin 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 ClosingStructuresPlugin + { + Gui = gui + }; + + info = plugin.GetExportInfos().First(ei => ei.DataType == typeof(ClosingStructuresCalculationScenarioContext)); + } + + [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 ClosingStructuresCalculationScenarioContext(new TestClosingStructuresCalculationScenario(), + new CalculationGroup(), + new ClosingStructuresFailureMechanism(), + 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 ClosingStructuresCalculationScenarioContext(new TestClosingStructuresCalculationScenario(), + new CalculationGroup(), + new ClosingStructuresFailureMechanism(), + assessmentSection); + + // Call + bool isEnabled = info.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + } +} \ No newline at end of file