Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs (revision 0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs (revision 67fd73b4f1a8f32897b92a30489d85e8ae92b608) @@ -0,0 +1,108 @@ +// 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 NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Structures; +using Ringtoets.Common.Forms.Helpers; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.StabilityPointStructures.Data; +using Ringtoets.StabilityPointStructures.Forms.PresentationObjects; +using Ringtoets.StabilityPointStructures.Forms.PropertyClasses; + +namespace Ringtoets.StabilityPointStructures.Forms.Test.PropertyClasses +{ + [TestFixture] + public class StabilityPointStructuresInputContextPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new StabilityPointStructuresInputContextProperties(); + + // Assert + Assert.IsInstanceOf, StabilityPointStructuresFailureMechanism>>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void Data_SetNewInputContextInstance_ReturnCorrectPropertyValues() + { + // Setup + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + var calculation = new StructuresCalculation(); + var properties = new StabilityPointStructuresInputContextProperties(); + + var inputContext = new StabilityPointStructuresInputContext(calculation.InputParameters, + calculation, + failureMechanism, + assessmentSectionStub); + + // Call + properties.Data = inputContext; + + // Assert + StabilityPointStructuresInput input = calculation.InputParameters; + var expectedFailureProbabilityRepairClosure = ProbabilityFormattingHelper.Format(input.FailureProbabilityRepairClosure); + var expectedProbabilityCollisionSecondaryStructure = ProbabilityFormattingHelper.Format(input.ProbabilityCollisionSecondaryStructure); + + Assert.AreEqual(input.VolumicWeightWater, properties.VolumicWeightWater); + Assert.AreSame(input.InsideWaterLevelFailureConstruction, properties.InsideWaterLevelFailureConstruction.Data); + Assert.AreSame(input.InsideWaterLevel, properties.InsideWaterLevel.Data); + Assert.AreSame(input.DrainCoefficient, properties.DrainCoefficient.Data); + Assert.AreEqual(input.FactorStormDurationOpenStructure, properties.FactorStormDurationOpenStructure); + Assert.AreSame(input.FlowVelocityStructureClosable, properties.FlowVelocityStructureClosable.Data); + Assert.AreEqual(input.InflowModelType, properties.InflowModelType); + Assert.AreEqual(input.LoadSchematizationType, properties.LoadSchematizationType); + Assert.AreSame(input.LevelCrestStructure, properties.LevelCrestStructure.Data); + Assert.AreSame(input.ThresholdHeightOpenWeir, properties.ThresholdHeightOpenWeir.Data); + Assert.AreSame(input.AreaFlowApertures, properties.AreaFlowApertures.Data); + Assert.AreSame(input.ConstructiveStrengthLinearLoadModel, properties.ConstructiveStrengthLinearLoadModel.Data); + Assert.AreSame(input.ConstructiveStrengthQuadraticLoadModel, properties.ConstructiveStrengthQuadraticLoadModel.Data); + Assert.AreSame(input.StabilityLinearLoadModel, properties.StabilityLinearLoadModel.Data); + Assert.AreSame(input.StabilityQuadraticLoadModel, properties.StabilityQuadraticLoadModel.Data); + Assert.AreEqual(expectedFailureProbabilityRepairClosure, properties.FailureProbabilityRepairClosure); + Assert.AreSame(input.FailureCollisionEnergy, properties.FailureCollisionEnergy.Data); + Assert.AreSame(input.ShipMass, properties.ShipMass.Data); + Assert.AreSame(input.ShipVelocity, properties.ShipVelocity.Data); + Assert.AreEqual(input.LevellingCount, properties.LevellingCount); + Assert.AreEqual(expectedProbabilityCollisionSecondaryStructure, properties.ProbabilityCollisionSecondaryStructure); + Assert.AreSame(input.BankWidth, properties.BankWidth.Data); + Assert.AreEqual(input.EvaluationLevel, properties.EvaluationLevel); + Assert.AreEqual(input.VerticalDistance, properties.VerticalDistance); + + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj =================================================================== diff -u -r6af0f01bd9b9b6da145bea0b4f8b8b1b4b09e02b -r67fd73b4f1a8f32897b92a30489d85e8ae92b608 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision 6af0f01bd9b9b6da145bea0b4f8b8b1b4b09e02b) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision 67fd73b4f1a8f32897b92a30489d85e8ae92b608) @@ -70,6 +70,7 @@ +