public void Constructor_WithOrWithoutStructure_CorrectReadOnlyForStructureDependentProperties(bool hasStructure)
        {
            // Setup
            var handler = mockRepository.Stub <IObservablePropertyChangeHandler>();

            mockRepository.ReplayAll();

            var failureMechanism = new HeightStructuresFailureMechanism();
            var calculation      = new StructuresCalculation <HeightStructuresInput>();
            var inputContext     = new HeightStructuresInputContext(calculation.InputParameters,
                                                                    calculation,
                                                                    failureMechanism,
                                                                    assessmentSection);

            if (hasStructure)
            {
                calculation.InputParameters.Structure = new TestHeightStructure();
            }

            // Call
            var properties = new HeightStructuresInputContextProperties(inputContext, handler);

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
            bool expectedReadOnly = !hasStructure;

            PropertyDescriptor failureProbabilityStructureWithErosionProperty = dynamicProperties[failureProbabilityStructureWithErosionPropertyIndex];

            Assert.AreEqual(expectedReadOnly, failureProbabilityStructureWithErosionProperty.IsReadOnly);

            DistributionPropertiesTestHelper.AssertPropertiesAreReadOnly(properties.LevelCrestStructure, expectedReadOnly, expectedReadOnly);

            mockRepository.VerifyAll();
        }
        public void Constructor_WithData_ExpectedValues()
        {
            // Setup
            var handler = mockRepository.Stub <IObservablePropertyChangeHandler>();

            mockRepository.ReplayAll();

            var failureMechanism = new HeightStructuresFailureMechanism();
            var calculation      = new StructuresCalculation <HeightStructuresInput>
            {
                InputParameters =
                {
                    HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(),
                    Structure        = new TestHeightStructure(),
                    ForeshoreProfile = new TestForeshoreProfile()
                }
            };

            var inputContext = new HeightStructuresInputContext(calculation.InputParameters,
                                                                calculation,
                                                                failureMechanism,
                                                                assessmentSection);

            // Call
            var properties = new HeightStructuresInputContextProperties(inputContext, handler);

            // Assert
            Assert.IsInstanceOf <StructuresInputBaseProperties <HeightStructure, HeightStructuresInput, StructuresCalculation <HeightStructuresInput>,
                                                                HeightStructuresFailureMechanism> >(properties);
            Assert.AreSame(inputContext, properties.Data);

            HeightStructuresInput input = calculation.InputParameters;

            Assert.AreSame(input.Structure, properties.Structure);
            Assert.AreEqual(input.Structure.Location.X, properties.StructureLocation.X, 1);
            Assert.AreEqual(input.Structure.Location.Y, properties.StructureLocation.Y, 1);
            Assert.AreSame(input.HydraulicBoundaryLocation, properties.SelectedHydraulicBoundaryLocation.HydraulicBoundaryLocation);

            Assert.AreSame(input.ModelFactorSuperCriticalFlow, properties.ModelFactorSuperCriticalFlow.Data);

            Assert.AreEqual(input.StructureNormalOrientation, properties.StructureNormalOrientation);
            Assert.AreSame(input.LevelCrestStructure, properties.LevelCrestStructure.Data);
            Assert.AreSame(input.WidthFlowApertures, properties.WidthFlowApertures.Data);
            Assert.AreSame(input.StormDuration, properties.StormDuration.Data);

            Assert.AreSame(input.CriticalOvertoppingDischarge, properties.CriticalOvertoppingDischarge.Data);
            Assert.AreSame(input.FlowWidthAtBottomProtection, properties.FlowWidthAtBottomProtection.Data);
            Assert.AreEqual(input.FailureProbabilityStructureWithErosion, properties.FailureProbabilityStructureWithErosion);

            Assert.AreSame(input.StorageStructureArea, properties.StorageStructureArea.Data);
            Assert.AreSame(input.AllowedLevelIncreaseStorage, properties.AllowedLevelIncreaseStorage.Data);

            Assert.AreSame(input.ForeshoreProfile, properties.ForeshoreProfile);
            Assert.IsInstanceOf <UseBreakWaterProperties>(properties.UseBreakWater);
            Assert.IsInstanceOf <UseForeshoreProperties>(properties.UseForeshore);

            Assert.AreEqual(input.ShouldIllustrationPointsBeCalculated, properties.ShouldIllustrationPointsBeCalculated);

            TestHelper.AssertTypeConverter <HeightStructuresInputContextProperties, NoProbabilityValueDoubleConverter>(
                nameof(HeightStructuresInputContextProperties.FailureProbabilityStructureWithErosion));

            DistributionPropertiesTestHelper.AssertPropertiesAreReadOnly(properties.ModelFactorSuperCriticalFlow, false, true);

            mockRepository.VerifyAll();
        }