Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probability/EmptyProbabilityAssessmentOutput.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/Common/src/Ringtoets.Common.Data/Probability/EmptyProbabilityAssessmentOutput.cs (.../EmptyProbabilityAssessmentOutput.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probability/EmptyProbabilityAssessmentOutput.cs (.../EmptyProbabilityAssessmentOutput.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -24,7 +24,7 @@ namespace Ringtoets.Common.Data.Probability { /// - /// This class represents a placeholder of a for a + /// This class represents a placeholder of a for a /// that has not been calculated yet. /// public class EmptyProbabilityAssessmentOutput {} Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -0,0 +1,75 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Core.Common.Base; +using Core.Common.Base.Data; +using Ringtoets.Common.Data.Calculation; + +namespace Ringtoets.Common.Data.Probability +{ + /// + /// This class contains the results of a probabilistic assessment calculation. + /// + public class ProbabilityAssessmentOutput : Observable, ICalculationOutput + { + /// + /// Creates a new instance of . + /// + /// The required (maximum allowed) probability of failure. + /// The required (maximum allowed) reliability of the failure mechanism. + /// The probability of failure. + /// The reliability of the failure mechanism. + /// The factor of safety of the failure mechanism. + public ProbabilityAssessmentOutput(double requiredProbability, double requiredReliability, double probability, double reliability, double factorOfSafety) + { + RequiredProbability = new RoundedDouble(2, requiredProbability); + RequiredReliability = new RoundedDouble(3, requiredReliability); + Probability = new RoundedDouble(2, probability); + Reliability = new RoundedDouble(3, reliability); + FactorOfSafety = new RoundedDouble(3, factorOfSafety); + } + + /// + /// Gets the required (maximum allowed) probability of failure. + /// + public RoundedDouble RequiredProbability { get; private set; } + + /// + /// Get the required (maximum allowed) reliability of the failure mechanism. + /// + public RoundedDouble RequiredReliability { get; private set; } + + /// + /// Gets the probability of failure. + /// + public RoundedDouble Probability { get; private set; } + + /// + /// Gets the reliability of the failure mechanism. + /// + public RoundedDouble Reliability { get; private set; } + + /// + /// Gets the factor of safety of the failure mechanism. + /// + public RoundedDouble FactorOfSafety { get; private set; } + } +} \ No newline at end of file Fisheye: Tag 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityOutput.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -44,7 +44,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityAssessmentOutputTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityAssessmentOutputTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityAssessmentOutputTest.cs (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.Base; +using Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Probability; + +namespace Ringtoets.Common.Data.Test.Calculation +{ + [TestFixture] + public class ProbabilityAssessmentOutputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var random = new Random(5); + var requiredProbability = new RoundedDouble(2, random.NextDouble()); + var requiredReliability = new RoundedDouble(3, random.NextDouble()); + var probability = new RoundedDouble(2, random.NextDouble()); + var reliability = new RoundedDouble(3, random.NextDouble()); + var factorOfSafety = new RoundedDouble(3, random.NextDouble()); + + // Call + var output = new ProbabilityAssessmentOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); + + // Assert + Assert.IsInstanceOf(output); + Assert.IsInstanceOf(output); + Assert.IsNotNull(output); + Assert.AreEqual(requiredProbability, output.RequiredProbability); + Assert.AreEqual(requiredReliability, output.RequiredReliability); + Assert.AreEqual(probability, output.Probability); + Assert.AreEqual(reliability, output.Reliability); + Assert.AreEqual(factorOfSafety, output.FactorOfSafety); + } + } +} \ No newline at end of file Fisheye: Tag 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityOutputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -59,7 +59,7 @@ - + Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -69,9 +69,9 @@ public ProbabilityAssessmentInput ProbabilityAssessmentInput { get; private set; } /// - /// Gets or sets , which contains the results of a probabilistic calculation. + /// Gets or sets , which contains the results of a probabilistic calculation. /// - public ProbabilityOutput Output { get; set; } + public ProbabilityAssessmentOutput Output { get; set; } public string Comments { get; set; } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -23,16 +23,15 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Probability; using Ringtoets.GrassCoverErosionInwards.Forms.Properties; namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses { /// - /// ViewModel of for properties panel. + /// ViewModel of for properties panel. /// - public class GrassCoverErosionInwardsOutputProperties : ObjectProperties + public class GrassCoverErosionInwardsOutputProperties : ObjectProperties { [PropertyOrder(1)] [ResourcesCategory(typeof(Resources), "Categories_GrassCoverErosionInwards")] Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -65,7 +65,7 @@ yield return new PropertyInfo(); yield return new PropertyInfo(); yield return new PropertyInfo(); - yield return new PropertyInfo(); + yield return new PropertyInfo(); } public override IEnumerable GetViewInfos() @@ -123,7 +123,7 @@ .Build() }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = output => RingtoetsCommonFormsResources.CalculationOutput_DisplayName, Image = output => RingtoetsCommonFormsResources.GeneralOutputIcon, Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsOutputCalculationService.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsOutputCalculationService.cs (.../GrassCoverErosionInwardsOutputCalculationService.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsOutputCalculationService.cs (.../GrassCoverErosionInwardsOutputCalculationService.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -27,7 +27,7 @@ namespace Ringtoets.GrassCoverErosionInwards.Service { /// - /// This class is responsible for calculating the parameters required for . + /// This class is responsible for calculating the parameters required for . /// public class GrassCoverErosionInwardsOutputCalculationService { @@ -52,7 +52,7 @@ } /// - /// Calculates the given the and . + /// Calculates the given the and . /// /// The calculation which is used. /// The reliability result. @@ -71,11 +71,11 @@ calculator.Calculate(); - calculation.Output = new ProbabilityOutput(1/calculator.requiredProbability, - calculator.requiredReliability, - 1/calculator.probability, - calculator.reliability, - calculator.factorOfSafety); + calculation.Output = new ProbabilityAssessmentOutput(1/calculator.requiredProbability, + calculator.requiredReliability, + 1/calculator.probability, + calculator.reliability, + calculator.factorOfSafety); } private void Calculate() Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -206,7 +206,7 @@ public void GetObservableOutput_Always_ReturnsOutput() { // Setup - var output = new ProbabilityOutput(2.0, 3.0, 1.4, 50.3, 16.3); + var output = new ProbabilityAssessmentOutput(2.0, 3.0, 1.4, 50.3, 16.3); var generalInput = new GeneralGrassCoverErosionInwardsInput(); var probabilityAssessmentInput = new ProbabilityAssessmentInput(); var calculation = new GrassCoverErosionInwardsCalculation(generalInput, probabilityAssessmentInput) @@ -243,7 +243,7 @@ Assert.AreEqual(10, inputParameters.DikeHeight.Value); } - private class TestGrassCoverErosionInwardsOutput : ProbabilityOutput + private class TestGrassCoverErosionInwardsOutput : ProbabilityAssessmentOutput { public TestGrassCoverErosionInwardsOutput() : base(0, 0, 0, 0, 0) {} } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -47,7 +47,7 @@ var properties = new GrassCoverErosionInwardsOutputProperties(); // Assert - Assert.IsInstanceOf>(properties); + Assert.IsInstanceOf>(properties); Assert.IsNull(properties.Data); } @@ -63,7 +63,7 @@ double reliability = random.NextDouble(); double factorOfSafety = random.NextDouble(); - var output = new ProbabilityOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); + var output = new ProbabilityAssessmentOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); // Call var properties = new GrassCoverErosionInwardsOutputProperties @@ -91,7 +91,7 @@ double reliability = random.NextDouble(); double factorOfSafety = random.NextDouble(); - var output = new ProbabilityOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); + var output = new ProbabilityAssessmentOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); // Call var properties = new GrassCoverErosionInwardsOutputProperties @@ -109,7 +109,7 @@ public void PropertyAttributes_ReturnExpectedValues() { // Setup - var output = new ProbabilityOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + var output = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); // Call var properties = new GrassCoverErosionInwardsOutputProperties Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -82,7 +82,7 @@ - + Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -140,7 +140,7 @@ var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput(), new ProbabilityAssessmentInput()) { - Output = new ProbabilityOutput(0, 0, 0, 0, 0) + Output = new ProbabilityAssessmentOutput(0, 0, 0, 0, 0) }; var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var calculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock); @@ -159,7 +159,7 @@ Assert.IsNotNull(grassCoverErosionInwardsInputContext); Assert.AreSame(calculationContext.WrappedData.InputParameters, grassCoverErosionInwardsInputContext.WrappedData); - var output = children[2] as ProbabilityOutput; + var output = children[2] as ProbabilityAssessmentOutput; Assert.IsNotNull(output); mocks.VerifyAll(); @@ -449,7 +449,7 @@ var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput(), new ProbabilityAssessmentInput()) { - Output = new ProbabilityOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), + Output = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityAssessmentOutputTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityAssessmentOutputTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityAssessmentOutputTreeNodeInfoTest.cs (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -0,0 +1,120 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Probability; +using Ringtoets.GrassCoverErosionInwards.Plugin; +using GrassCoverErosionInwardsFormsResources = Ringtoets.GrassCoverErosionInwards.Forms.Properties.Resources; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class ProbabilityAssessmentOutputTreeNodeInfoTest + { + private MockRepository mocksRepository; + private GrassCoverErosionInwardsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocksRepository = new MockRepository(); + plugin = new GrassCoverErosionInwardsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityAssessmentOutput)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(ProbabilityAssessmentOutput), info.TagType); + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsFromResource() + { + // Call + var text = info.Text(null); + + // Assert + Assert.AreEqual(RingtoetsCommonFormsResources.CalculationOutput_DisplayName, text); + } + + [Test] + public void Image_Always_ReturnsGeneralOutputIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralOutputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var guiMock = mocksRepository.StrictMock(); + var menuBuilderMock = mocksRepository.StrictMock(); + var treeViewControlMock = mocksRepository.StrictMock(); + + menuBuilderMock.Expect(mb => mb.AddExportItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + guiMock.Expect(cmp => cmp.Get(null, treeViewControlMock)).Return(menuBuilderMock); + mocksRepository.ReplayAll(); + + plugin.Gui = guiMock; + + // Call + info.ContextMenuStrip(null, null, treeViewControlMock); + + // Assert + mocksRepository.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityOutputTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -82,7 +82,7 @@ Assert.IsNull(inputContextProperties.GetObjectPropertiesData); Assert.IsNull(inputContextProperties.AfterCreate); - var outputContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(ProbabilityOutput)); + var outputContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(ProbabilityAssessmentOutput)); Assert.AreEqual(typeof(GrassCoverErosionInwardsOutputProperties), outputContextProperties.PropertyObjectType); Assert.IsNull(outputContextProperties.AdditionalDataCheck); Assert.IsNull(outputContextProperties.GetObjectPropertiesData); @@ -120,7 +120,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionInwardsInputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyProbabilityAssessmentOutput))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityOutput))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityAssessmentOutput))); } mocks.VerifyAll(); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs =================================================================== diff -u -rd943445f75d5e37e2285136f19913fbf90e525f4 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision d943445f75d5e37e2285136f19913fbf90e525f4) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -67,9 +67,9 @@ public ProbabilityAssessmentInput ProbabilityAssessmentInput { get; private set; } /// - /// Gets or sets , which contains the results of a height structures calculation. + /// Gets or sets , which contains the results of a height structures calculation. /// - public ProbabilityOutput Output { get; set; } + public ProbabilityAssessmentOutput Output { get; set; } public string Name { get; set; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -110,7 +110,7 @@ .Build() }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = output => RingtoetsCommonFormsResources.CalculationOutput_DisplayName, Image = output => RingtoetsCommonFormsResources.GeneralOutputIcon, Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -182,7 +182,7 @@ Assert.AreEqual(1, inputParameters.FailureProbabilityOfStructureGivenErosion.Value); } - private class TestHeightStructuresOutput : ProbabilityOutput + private class TestHeightStructuresOutput : ProbabilityAssessmentOutput { public TestHeightStructuresOutput() : base(0, 0, 0, 0, 0) {} } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -160,7 +160,7 @@ Assert.IsNotNull(heightStructuresInputContext); Assert.AreSame(calculationContext.WrappedData.InputParameters, heightStructuresInputContext.WrappedData); - var output = children[2] as ProbabilityOutput; + var output = children[2] as ProbabilityAssessmentOutput; Assert.IsNotNull(output); mocks.VerifyAll(); @@ -439,7 +439,7 @@ var calculation = new HeightStructuresCalculation(new GeneralHeightStructuresInput(), new ProbabilityAssessmentInput()) { - Output = new ProbabilityOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), + Output = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation @@ -521,7 +521,7 @@ private const int contextMenuCalculateIndex = 0; private const int contextMenuClearIndex = 1; - private class TestHeightStructuresOutput : ProbabilityOutput + private class TestHeightStructuresOutput : ProbabilityAssessmentOutput { public TestHeightStructuresOutput() : base(0, 0, 0, 0, 0) {} } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs =================================================================== diff -u -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs (.../ProbabilisticOutputTreeNodeInfoTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs (.../ProbabilisticOutputTreeNodeInfoTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -45,14 +45,14 @@ { mocksRepository = new MockRepository(); plugin = new HeightStructuresGuiPlugin(); - info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityOutput)); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityAssessmentOutput)); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(ProbabilityOutput), info.TagType); + Assert.AreEqual(typeof(ProbabilityAssessmentOutput), info.TagType); Assert.IsNotNull(info.Text); Assert.IsNotNull(info.Image); Assert.IsNotNull(info.ContextMenuStrip); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs =================================================================== diff -u -rcfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37 -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision cfbc63bdf527a3b6b51c6bfb5442eecd8c7a9c37) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) @@ -107,7 +107,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HeightStructuresCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HeightStructuresCalculationContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HeightStructuresInputContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityOutput))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityAssessmentOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyProbabilityAssessmentOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); }