Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs =================================================================== diff -u -re1f407b3d93adfa477726ede6ba785c3a7eac991 -rc2c538a297cf459a535a8525ca0f3614bb0e7c39 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs) (revision e1f407b3d93adfa477726ede6ba785c3a7eac991) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs) (revision c2c538a297cf459a535a8525ca0f3614bb0e7c39) @@ -303,6 +303,7 @@ public override void Update() { UpdateDerivedData(); + UpdateColumnStateDefinitionStates(); } private void CreateColumnStateDefinitions() @@ -404,6 +405,40 @@ } /// + /// Updates the column state definitions. + /// + /// Thrown when + /// is a valid value, but unsupported. + private void UpdateColumnStateDefinitionStates() + { + bool simpleAssessmentSufficient = FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(SimpleAssessmentResult); + + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[simpleAssessmentResultIndex], UseManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForSignalingNormIndex], + simpleAssessmentSufficient || UseManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[detailedAssessmentResultForFactorizedLowerLimitNormIndex], + simpleAssessmentSufficient || UseManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[tailorMadeAssessmentResultIndex], + simpleAssessmentSufficient || UseManualAssemblyCategoryGroup); + + if (UseManualAssemblyCategoryGroup) + { + FailureMechanismSectionResultRowHelper.DisableColumn(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex]); + FailureMechanismSectionResultRowHelper.DisableColumn(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex]); + FailureMechanismSectionResultRowHelper.DisableColumn(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex]); + FailureMechanismSectionResultRowHelper.DisableColumn(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex]); + } + + FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssemblyCategoryGroup); + } + + /// /// Class holding the various construction parameters for . /// public class ConstructionProperties Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -re1f407b3d93adfa477726ede6ba785c3a7eac991 -rc2c538a297cf459a535a8525ca0f3614bb0e7c39 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs) (revision e1f407b3d93adfa477726ede6ba785c3a7eac991) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs) (revision c2c538a297cf459a535a8525ca0f3614bb0e7c39) @@ -313,6 +313,100 @@ } } + #region Column States + + [Test] + [TestCase(SimpleAssessmentResultType.None, true)] + [TestCase(SimpleAssessmentResultType.AssessFurther, true)] + [TestCase(SimpleAssessmentResultType.NotApplicable, false)] + [TestCase(SimpleAssessmentResultType.ProbabilityNegligible, false)] + public void Constructor_WithSimpleAssessmentResultSet_ExpectedColumnStates(SimpleAssessmentResultType simpleAssessmentResult, + bool cellsEnabled) + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = simpleAssessmentResult + }; + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + + // Assert + IDictionary columnStateDefinitions = row.ColumnStateDefinitions; + + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex], + cellsEnabled); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForSignalingNormIndex], + cellsEnabled); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + cellsEnabled); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForLowerLimitNormIndex], + cellsEnabled); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex], + cellsEnabled); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.TailorMadeAssessmentResultIndex], + cellsEnabled); + } + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Constructor_WithUseManualAssemblyCategoryGroupSet_ExpectedColumnStates(bool useManualAssemblyCategoryGroup) + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section) + { + UseManualAssemblyCategoryGroup = useManualAssemblyCategoryGroup + }; + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result, ConstructionProperties); + + // Assert + IDictionary columnStateDefinitions = row.ColumnStateDefinitions; + + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.SimpleAssessmentResultIndex], + !useManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex], + !useManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForSignalingNormIndex], + !useManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex], + !useManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForLowerLimitNormIndex], + !useManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex], + !useManualAssemblyCategoryGroup); + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.TailorMadeAssessmentResultIndex], + !useManualAssemblyCategoryGroup); + + if (useManualAssemblyCategoryGroup) + { + FailureMechanismSectionResultRowTestHelper.AssertColumnStateIsDisabled( + columnStateDefinitions[ConstructionProperties.SimpleAssemblyCategoryGroupIndex]); + FailureMechanismSectionResultRowTestHelper.AssertColumnStateIsDisabled( + columnStateDefinitions[ConstructionProperties.DetailedAssemblyCategoryGroupIndex]); + FailureMechanismSectionResultRowTestHelper.AssertColumnStateIsDisabled( + columnStateDefinitions[ConstructionProperties.TailorMadeAssemblyCategoryGroupIndex]); + FailureMechanismSectionResultRowTestHelper.AssertColumnStateIsDisabled( + columnStateDefinitions[ConstructionProperties.CombinedAssemblyCategoryGroupIndex]); + } + + FailureMechanismSectionResultRowTestHelper.AssertColumnState(columnStateDefinitions[ConstructionProperties.ManualAssemblyCategoryGroupIndex], + useManualAssemblyCategoryGroup); + } + } + + #endregion + #region Registration [Test]