Index: Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/EmptyProbabilisticOutput.cs =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/EmptyProbabilisticOutput.cs (.../EmptyProbabilisticOutput.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/EmptyProbabilisticOutput.cs (.../EmptyProbabilisticOutput.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -24,7 +24,7 @@ namespace Ringtoets.Common.Data.Calculation { /// - /// This class represents the placeholder for a for a + /// This class represents the placeholder for a for a /// that has not been calculated yet. /// public class EmptyProbabilisticOutput {} Fisheye: Tag a08078c06de7ad327ed2b518276288e4d4f0e3a8 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilisticOutput.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityOutput.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityOutput.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityOutput.cs (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -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 ProbabilityOutput : 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 ProbabilityOutput(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 Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -44,7 +44,7 @@ - + Fisheye: Tag a08078c06de7ad327ed2b518276288e4d4f0e3a8 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilisticOutputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityOutputTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityOutputTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/ProbabilityOutputTest.cs (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -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 ProbabilityOutputTest + { + [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 ProbabilityOutput(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 Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -r49084c971c0de5668befdcf5c8d6b65debf0b659 -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 49084c971c0de5668befdcf5c8d6b65debf0b659) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -59,7 +59,7 @@ - + Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs =================================================================== diff -u -r54a4d89e3e07a6ff825c5ba2d2322a77d31e995e -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 54a4d89e3e07a6ff825c5ba2d2322a77d31e995e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -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 ProbabilisticOutput Output { get; set; } + public ProbabilityOutput Output { get; set; } public string Comments { get; set; } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -30,9 +30,9 @@ 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 -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -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 -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsOutputCalculationService.cs (.../GrassCoverErosionInwardsOutputCalculationService.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsOutputCalculationService.cs (.../GrassCoverErosionInwardsOutputCalculationService.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -21,14 +21,13 @@ using System; using MathNet.Numerics.Distributions; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Probability; using Ringtoets.GrassCoverErosionInwards.Data; 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 { @@ -53,7 +52,7 @@ } /// - /// Calculates the given the and . + /// Calculates the given the and . /// /// The calculation which is used. /// The reliability result. @@ -72,11 +71,11 @@ calculator.Calculate(); - calculation.Output = new ProbabilisticOutput(1/calculator.requiredProbability, - calculator.requiredReliability, - 1/calculator.probability, - calculator.reliability, - calculator.factorOfSafety); + calculation.Output = new ProbabilityOutput(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 -r54a4d89e3e07a6ff825c5ba2d2322a77d31e995e -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision 54a4d89e3e07a6ff825c5ba2d2322a77d31e995e) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -126,7 +126,7 @@ var probabilityAssessmentInput = new ProbabilityAssessmentInput(); var calculation = new GrassCoverErosionInwardsCalculation(generalInput, probabilityAssessmentInput) { - Output = new TestProbabilisticOutput() + Output = new TestGrassCoverErosionInwardsOutput() }; // Call @@ -159,7 +159,7 @@ var probabilityAssessmentInput = new ProbabilityAssessmentInput(); var calculation = new GrassCoverErosionInwardsCalculation(generalInput, probabilityAssessmentInput) { - Output = new TestProbabilisticOutput() + Output = new TestGrassCoverErosionInwardsOutput() }; // Call & Assert @@ -206,7 +206,7 @@ public void GetObservableOutput_Always_ReturnsOutput() { // Setup - var output = new ProbabilisticOutput(2.0, 3.0, 1.4, 50.3, 16.3); + var output = new ProbabilityOutput(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,9 +243,9 @@ Assert.AreEqual(10, inputParameters.DikeHeight.Value); } - private class TestProbabilisticOutput : ProbabilisticOutput + private class TestGrassCoverErosionInwardsOutput : ProbabilityOutput { - public TestProbabilisticOutput() : base(0, 0, 0, 0, 0) {} + public TestGrassCoverErosionInwardsOutput() : base(0, 0, 0, 0, 0) {} } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -24,7 +24,6 @@ using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Probability; using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; @@ -48,7 +47,7 @@ var properties = new GrassCoverErosionInwardsOutputProperties(); // Assert - Assert.IsInstanceOf>(properties); + Assert.IsInstanceOf>(properties); Assert.IsNull(properties.Data); } @@ -64,7 +63,7 @@ double reliability = random.NextDouble(); double factorOfSafety = random.NextDouble(); - var output = new ProbabilisticOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); + var output = new ProbabilityOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); // Call var properties = new GrassCoverErosionInwardsOutputProperties @@ -92,7 +91,7 @@ double reliability = random.NextDouble(); double factorOfSafety = random.NextDouble(); - var output = new ProbabilisticOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); + var output = new ProbabilityOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); // Call var properties = new GrassCoverErosionInwardsOutputProperties @@ -110,7 +109,7 @@ public void PropertyAttributes_ReturnExpectedValues() { // Setup - var output = new ProbabilisticOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + var output = new ProbabilityOutput(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 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -82,7 +82,7 @@ - + Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r49084c971c0de5668befdcf5c8d6b65debf0b659 -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 49084c971c0de5668befdcf5c8d6b65debf0b659) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -140,7 +140,7 @@ var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput(), new ProbabilityAssessmentInput()) { - Output = new ProbabilisticOutput(0, 0, 0, 0, 0) + Output = new ProbabilityOutput(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 ProbabilisticOutput; + var output = children[2] as ProbabilityOutput; Assert.IsNotNull(output); mocks.VerifyAll(); @@ -449,7 +449,7 @@ var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput(), new ProbabilityAssessmentInput()) { - Output = new ProbabilisticOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), + Output = new ProbabilityOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation Fisheye: Tag a08078c06de7ad327ed2b518276288e4d4f0e3a8 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityOutputTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityOutputTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityOutputTreeNodeInfoTest.cs (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -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 ProbabilityOutputTreeNodeInfoTest + { + 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(ProbabilityOutput)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(ProbabilityOutput), 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 Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -83,7 +83,7 @@ Assert.IsNull(inputContextProperties.GetObjectPropertiesData); Assert.IsNull(inputContextProperties.AfterCreate); - var outputContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(ProbabilisticOutput)); + var outputContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(ProbabilityOutput)); Assert.AreEqual(typeof(GrassCoverErosionInwardsOutputProperties), outputContextProperties.PropertyObjectType); Assert.IsNull(outputContextProperties.AdditionalDataCheck); Assert.IsNull(outputContextProperties.GetObjectPropertiesData); @@ -121,7 +121,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(EmptyProbabilisticOutput))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticOutput))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityOutput))); } mocks.VerifyAll(); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs =================================================================== diff -u -r54a4d89e3e07a6ff825c5ba2d2322a77d31e995e -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision 54a4d89e3e07a6ff825c5ba2d2322a77d31e995e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -66,9 +66,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 ProbabilisticOutput Output { get; set; } + public ProbabilityOutput Output { get; set; } public string Name { get; set; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -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 -r54a4d89e3e07a6ff825c5ba2d2322a77d31e995e -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision 54a4d89e3e07a6ff825c5ba2d2322a77d31e995e) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -182,7 +182,7 @@ Assert.AreEqual(1, inputParameters.FailureProbabilityOfStructureGivenErosion.Value); } - private class TestHeightStructuresOutput : ProbabilisticOutput + private class TestHeightStructuresOutput : ProbabilityOutput { public TestHeightStructuresOutput() : base(0, 0, 0, 0, 0) {} } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r3c1ed9049be26ab9460bf2192c55149c45fbba3c -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 3c1ed9049be26ab9460bf2192c55149c45fbba3c) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -160,7 +160,7 @@ Assert.IsNotNull(heightStructuresInputContext); Assert.AreSame(calculationContext.WrappedData.InputParameters, heightStructuresInputContext.WrappedData); - var output = children[2] as ProbabilisticOutput; + var output = children[2] as ProbabilityOutput; Assert.IsNotNull(output); mocks.VerifyAll(); @@ -439,7 +439,7 @@ var calculation = new HeightStructuresCalculation(new GeneralHeightStructuresInput(), new ProbabilityAssessmentInput()) { - Output = new ProbabilisticOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), + Output = new ProbabilityOutput(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 : ProbabilisticOutput + private class TestHeightStructuresOutput : ProbabilityOutput { public TestHeightStructuresOutput() : base(0, 0, 0, 0, 0) {} } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs =================================================================== diff -u -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs (.../ProbabilisticOutputTreeNodeInfoTest.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs (.../ProbabilisticOutputTreeNodeInfoTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -45,14 +45,14 @@ { mocksRepository = new MockRepository(); plugin = new HeightStructuresGuiPlugin(); - info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilisticOutput)); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityOutput)); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(ProbabilisticOutput), info.TagType); + Assert.AreEqual(typeof(ProbabilityOutput), 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 -r539c8246735ec295942d90a7abfb08a9cfffaa9f -ra08078c06de7ad327ed2b518276288e4d4f0e3a8 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision 539c8246735ec295942d90a7abfb08a9cfffaa9f) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision a08078c06de7ad327ed2b518276288e4d4f0e3a8) @@ -108,7 +108,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(ProbabilisticOutput))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyProbabilisticOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); }