// 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(); } } }