Fisheye: Tag df283d00ed70c88f186219ff90aedb23b07ea83b refers to a dead (removed) revision in file `Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/PipingInputContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag df283d00ed70c88f186219ff90aedb23b07ea83b refers to a dead (removed) revision in file `Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/PipingOutputPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/Probabilistic/ProbabilisticPipingInputContextPropertyInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/Probabilistic/ProbabilisticPipingInputContextPropertyInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/Probabilistic/ProbabilisticPipingInputContextPropertyInfoTest.cs (revision df283d00ed70c88f186219ff90aedb23b07ea83b) @@ -0,0 +1,150 @@ +// 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.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Riskeer.Common.Data.Contribution; +using Riskeer.Common.Data.TestUtil; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.Probabilistic; +using Riskeer.Piping.Data.SoilProfile; +using Riskeer.Piping.Forms.PresentationObjects.Probabilistic; +using Riskeer.Piping.Forms.PropertyClasses.Probabilistic; +using Riskeer.Piping.Primitives; + +namespace Riskeer.Piping.Plugin.Test.PropertyInfos.Probabilistic +{ + [TestFixture] + public class ProbabilisticPipingInputContextPropertyInfoTest + { + private PipingPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new PipingPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(ProbabilisticPipingInputContextProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(ProbabilisticPipingInputContext), info.DataType); + Assert.AreEqual(typeof(ProbabilisticPipingInputContextProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_WithContextAndNormTypeSignaling_ExpectedProperties() + { + // Setup + var assessmentSection = new AssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = NormType.Signaling + } + }; + + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var scenario = new ProbabilisticPipingCalculation(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + var failureMechanism = new PipingFailureMechanism(); + var context = new ProbabilisticPipingInputContext( + scenario.InputParameters, + scenario, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, + assessmentSection); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] + { + hydraulicBoundaryLocation + }, true); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + } + + [Test] + public void CreateInstance_WithContextAndNormTypeLowerLimit_ExpectedProperties() + { + // Setup + var assessmentSection = new AssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = NormType.LowerLimit + } + }; + + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var scenario = new ProbabilisticPipingCalculation(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + var failureMechanism = new PipingFailureMechanism(); + var context = new ProbabilisticPipingInputContext( + scenario.InputParameters, + scenario, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, + assessmentSection); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] + { + hydraulicBoundaryLocation + }, true); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + } + } +} Fisheye: Tag df283d00ed70c88f186219ff90aedb23b07ea83b refers to a dead (removed) revision in file `Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/ProbabilisticPipingInputContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/SemiProbabilistic/SemiProbabilisticPipingInputContextPropertyInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/SemiProbabilistic/SemiProbabilisticPipingInputContextPropertyInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/SemiProbabilistic/SemiProbabilisticPipingInputContextPropertyInfoTest.cs (revision df283d00ed70c88f186219ff90aedb23b07ea83b) @@ -0,0 +1,156 @@ +// 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.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Riskeer.Common.Data.Contribution; +using Riskeer.Common.Data.TestUtil; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.SemiProbabilistic; +using Riskeer.Piping.Data.SoilProfile; +using Riskeer.Piping.Forms.PresentationObjects.SemiProbabilistic; +using Riskeer.Piping.Forms.PropertyClasses.SemiProbabilistic; +using Riskeer.Piping.Primitives; + +namespace Riskeer.Piping.Plugin.Test.PropertyInfos.SemiProbabilistic +{ + [TestFixture] + public class SemiProbabilisticPipingInputContextPropertyInfoTest + { + private PipingPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new PipingPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(SemiProbabilisticPipingInputContextProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(SemiProbabilisticPipingInputContext), info.DataType); + Assert.AreEqual(typeof(SemiProbabilisticPipingInputContextProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_WithContextAndNormTypeSignaling_ExpectedProperties() + { + // Setup + var assessmentSection = new AssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = NormType.Signaling + } + }; + + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var scenario = new SemiProbabilisticPipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + var failureMechanism = new PipingFailureMechanism(); + var context = new SemiProbabilisticPipingInputContext( + scenario.InputParameters, + scenario, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, + assessmentSection); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] + { + hydraulicBoundaryLocation + }, true); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + + double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForSignalingNorm.ElementAt(0).Output.Result; + Assert.AreEqual(expectedAssessmentLevel, ((SemiProbabilisticPipingInputContextProperties) objectProperties).AssessmentLevel); + } + + [Test] + public void CreateInstance_WithContextAndNormTypeLowerLimit_ExpectedProperties() + { + // Setup + var assessmentSection = new AssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = NormType.LowerLimit + } + }; + + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var scenario = new SemiProbabilisticPipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + var failureMechanism = new PipingFailureMechanism(); + var context = new SemiProbabilisticPipingInputContext( + scenario.InputParameters, + scenario, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, + assessmentSection); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] + { + hydraulicBoundaryLocation + }, true); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + + double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0).Output.Result; + Assert.AreEqual(expectedAssessmentLevel, ((SemiProbabilisticPipingInputContextProperties) objectProperties).AssessmentLevel); + } + } +} \ No newline at end of file Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/SemiProbabilistic/SemiProbabilisticPipingOutputPropertyInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/SemiProbabilistic/SemiProbabilisticPipingOutputPropertyInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PropertyInfos/SemiProbabilistic/SemiProbabilisticPipingOutputPropertyInfoTest.cs (revision df283d00ed70c88f186219ff90aedb23b07ea83b) @@ -0,0 +1,85 @@ +// 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.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.TestUtil; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.SemiProbabilistic; +using Riskeer.Piping.Data.TestUtil; +using Riskeer.Piping.Forms.PresentationObjects.SemiProbabilistic; +using Riskeer.Piping.Forms.PropertyClasses.SemiProbabilistic; + +namespace Riskeer.Piping.Plugin.Test.PropertyInfos.SemiProbabilistic +{ + [TestFixture] + public class SemiProbabilisticPipingOutputPropertyInfoTest + { + private PipingPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new PipingPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(SemiProbabilisticPipingOutputProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(SemiProbabilisticPipingOutputContext), info.DataType); + } + + [Test] + public void CreateInstance_ValidData_NewPropertiesWithPipingOutputAsData() + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + SemiProbabilisticPipingOutput output = PipingTestDataGenerator.GetRandomSemiProbabilisticPipingOutput(); + var context = new SemiProbabilisticPipingOutputContext(output, failureMechanism, assessmentSection); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(output, objectProperties.Data); + mocks.VerifyAll(); + } + } +} \ No newline at end of file