Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs =================================================================== diff -u -r85c24f25efa5c7d92df2c952bcf1de53dc15276f -r4bcead3f76f6dce4ac4d13ce5dda2f1f6d1d0b2c --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs) (revision 85c24f25efa5c7d92df2c952bcf1de53dc15276f) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRow.cs) (revision 4bcead3f76f6dce4ac4d13ce5dda2f1f6d1d0b2c) @@ -225,6 +225,42 @@ } } + /// + /// Gets or sets the indicator whether the combined assembly should be overwritten by . + /// + /// Thrown when + /// is a valid value, but unsupported. + public bool UseManualAssemblyCategoryGroup + { + get + { + return SectionResult.UseManualAssemblyCategoryGroup; + } + set + { + SectionResult.UseManualAssemblyCategoryGroup = value; + UpdateInternalData(); + } + } + + /// + /// Gets or sets the manually selected assembly category group. + /// + /// Thrown when + /// is a valid value, but unsupported. + public SelectableFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup + { + get + { + return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.ManualAssemblyCategoryGroup); + } + set + { + SectionResult.ManualAssemblyCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value); + UpdateInternalData(); + } + } + public override void Update() { UpdateDerivedData(); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r85c24f25efa5c7d92df2c952bcf1de53dc15276f -r4bcead3f76f6dce4ac4d13ce5dda2f1f6d1d0b2c --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs) (revision 85c24f25efa5c7d92df2c952bcf1de53dc15276f) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultRowTest.cs) (revision 4bcead3f76f6dce4ac4d13ce5dda2f1f6d1d0b2c) @@ -64,6 +64,9 @@ Assert.AreEqual(result.DetailedAssessmentResultForFactorizedLowerLimitNorm, row.DetailedAssessmentResultForFactorizedLowerLimitNorm); Assert.AreEqual(SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(result.TailorMadeAssessmentResult), row.TailorMadeAssessmentResult); + Assert.AreEqual(result.UseManualAssemblyCategoryGroup, row.UseManualAssemblyCategoryGroup); + Assert.AreEqual(SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(result.ManualAssemblyCategoryGroup), + row.ManualAssemblyCategoryGroup); } } @@ -101,6 +104,67 @@ } } + [Test] + public void UseManualAssemblyCategoryGroup_SetNewValue_NotifyObserversAndPropertyChanged() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section); + result.Attach(observer); + + bool newValue = !result.UseManualAssemblyCategoryGroup; + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result); + + // Precondition + Assert.IsFalse(result.UseManualAssemblyCategoryGroup); + + // Call + row.UseManualAssemblyCategoryGroup = newValue; + + // Assert + Assert.AreEqual(newValue, result.UseManualAssemblyCategoryGroup); + mocks.VerifyAll(); + } + } + + [Test] + public void ManualAssemblyCategoryGroup_SetNewValue_NotifyObserversAndPropertyChanged() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var random = new Random(39); + var newValue = random.NextEnumValue(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section); + result.Attach(observer); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var row = new GrassCoverErosionOutwardsFailureMechanismSectionResultRow(result); + + // Call + row.ManualAssemblyCategoryGroup = newValue; + + // Assert + FailureMechanismSectionAssemblyCategoryGroup expectedCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(newValue); + Assert.AreEqual(expectedCategoryGroup, result.ManualAssemblyCategoryGroup); + mocks.VerifyAll(); + } + } + #region Registration [Test]