Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverSectionResultRowTest.cs
===================================================================
diff -u -rdf6404d73835e364a4e1d99ad0f2cbdc4164bed6 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverSectionResultRowTest.cs (.../StabilityStoneCoverSectionResultRowTest.cs) (revision df6404d73835e364a4e1d99ad0f2cbdc4164bed6)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverSectionResultRowTest.cs (.../StabilityStoneCoverSectionResultRowTest.cs) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -170,7 +170,7 @@
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
calculator.ThrowExceptionOnCalculate = true;
@@ -259,7 +259,7 @@
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
random.NextDouble(),
@@ -302,7 +302,7 @@
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
calculator.ThrowExceptionOnCalculate = true;
@@ -431,7 +431,7 @@
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0, assemblyCategoryGroup);
calculator.DetailedAssessmentAssemblyGroupOutput = assemblyCategoryGroup;
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Ringtoets.WaveImpactAsphaltCover.Forms.csproj
===================================================================
diff -u -rd7696913d8f9239cb80eb2c3bac6cc0ccf23d479 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Ringtoets.WaveImpactAsphaltCover.Forms.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.csproj) (revision d7696913d8f9239cb80eb2c3bac6cc0ccf23d479)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Ringtoets.WaveImpactAsphaltCover.Forms.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.csproj) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -78,6 +78,16 @@
Core.Components.Gis
False
+
+ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
+ Ringtoets.AssemblyTool.Data
+ False
+
+
+ {22C5DDB8-2491-4BC6-BDC6-2A7B7EBF40C1}
+ Ringtoets.AssemblyTool.Forms
+ False
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs
===================================================================
diff -u -ref5806c808ecd8a1d443a647f3bde8c46d48dfe1 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision ef5806c808ecd8a1d443a647f3bde8c46d48dfe1)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -19,16 +19,10 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
-using System.Linq;
-using System.Windows.Forms;
using Core.Common.Base;
-using Core.Common.Util;
-using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.Builders;
using Ringtoets.Common.Forms.Views;
-using Ringtoets.Common.Primitives;
using Ringtoets.WaveImpactAsphaltCover.Data;
-using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
namespace Ringtoets.WaveImpactAsphaltCover.Forms.Views
{
@@ -38,69 +32,105 @@
public class WaveImpactAsphaltCoverFailureMechanismResultView : FailureMechanismResultView
{
+ private const int simpleAssessmentResultIndex = 1;
+ private const int detailedAssessmentResultForFactorizedSignalingNormIndex = 2;
+ private const int detailedAssessmentResultForSignalingNormIndex = 3;
+ private const int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = 4;
+ private const int detailedAssessmentResultForLowerLimitNormIndex = 5;
+ private const int detailedAssessmentResultForFactorizedLowerLimitNormIndex = 6;
+ private const int tailorMadeAssessmentResultIndex = 7;
+ private const int simpleAssemblyCategoryGroupIndex = 8;
+ private const int detailedAssemblyCategoryGroupIndex = 9;
+ private const int tailorMadeAssemblyCategoryGroupIndex = 10;
+ private const int combinedAssemblyCategoryGroupIndex = 11;
+ private const int manualAssemblyCategoryGroupIndex = 13;
+
///
///
/// Creates a new instance of .
///
- public WaveImpactAsphaltCoverFailureMechanismResultView(
- IObservableEnumerable failureMechanismSectionResults,
- WaveImpactAsphaltCoverFailureMechanism failureMechanism)
+ public WaveImpactAsphaltCoverFailureMechanismResultView(IObservableEnumerable failureMechanismSectionResults,
+ WaveImpactAsphaltCoverFailureMechanism failureMechanism)
: base(failureMechanismSectionResults, failureMechanism) {}
protected override WaveImpactAsphaltCoverFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult)
{
- return new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(sectionResult);
+ return new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(
+ sectionResult,
+ new WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ConstructionProperties
+ {
+ SimpleAssessmentResultIndex = simpleAssessmentResultIndex,
+ DetailedAssessmentResultForFactorizedSignalingNormIndex = detailedAssessmentResultForFactorizedSignalingNormIndex,
+ DetailedAssessmentResultForSignalingNormIndex = detailedAssessmentResultForSignalingNormIndex,
+ DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex,
+ DetailedAssessmentResultForLowerLimitNormIndex = detailedAssessmentResultForLowerLimitNormIndex,
+ DetailedAssessmentResultForFactorizedLowerLimitNormIndex = detailedAssessmentResultForFactorizedLowerLimitNormIndex,
+ TailorMadeAssessmentResultIndex = tailorMadeAssessmentResultIndex,
+ SimpleAssemblyCategoryGroupIndex = simpleAssemblyCategoryGroupIndex,
+ DetailedAssemblyCategoryGroupIndex = detailedAssemblyCategoryGroupIndex,
+ TailorMadeAssemblyCategoryGroupIndex = tailorMadeAssemblyCategoryGroupIndex,
+ CombinedAssemblyCategoryGroupIndex = combinedAssemblyCategoryGroupIndex,
+ ManualAssemblyCategoryGroupIndex = manualAssemblyCategoryGroupIndex
+ });
}
- protected override void Dispose(bool disposing)
+ protected override void AddDataGridColumns()
{
- DataGridViewControl.CellFormatting -= OnCellFormatting;
+ FailureMechanismSectionResultViewColumnBuilder.AddSectionNameColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.Name));
- base.Dispose(disposing);
- }
+ FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssessmentResultColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.SimpleAssessmentResult));
- protected override void AddDataGridColumns()
- {
- DataGridViewControl.AddTextBoxColumn(
- nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.Name),
- RingtoetsCommonFormsResources.Section_DisplayName,
- true);
+ FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedSignalingNormColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForFactorizedSignalingNorm));
- EnumDisplayWrapper[] simpleAssessmentDataSource =
- Enum.GetValues(typeof(SimpleAssessmentResultType))
- .OfType()
- .Select(sa => new EnumDisplayWrapper(sa))
- .ToArray();
+ FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForSignalingNormColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForSignalingNorm));
- DataGridViewControl.AddComboBoxColumn(
- nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.SimpleAssessmentResult),
- RingtoetsCommonFormsResources.FailureMechanismResultView_SimpleAssessmentResult_DisplayName,
- simpleAssessmentDataSource,
- nameof(EnumDisplayWrapper.Value),
- nameof(EnumDisplayWrapper.DisplayName));
- }
+ FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForMechanismSpecificLowerLimitNormColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm));
- protected override void BindEvents()
- {
- base.BindEvents();
+ FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForLowerLimitNormColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForLowerLimitNorm));
- DataGridViewControl.CellFormatting += OnCellFormatting;
- }
+ FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssessmentResultForFactorizedLowerLimitNormColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssessmentResultForFactorizedLowerLimitNorm));
- private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs)
- {
- if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex)
- {
- SimpleAssessmentResultType simpleAssessmentResult = GetDataAtRow(eventArgs.RowIndex).SimpleAssessmentResult;
- if (FailureMechanismSectionResultRowHelper.SimpleAssessmentIsSufficient(simpleAssessmentResult))
- {
- DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex);
- }
- else
- {
- DataGridViewControl.RestoreCell(eventArgs.RowIndex, eventArgs.ColumnIndex);
- }
- }
+ FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssessmentCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.TailorMadeAssessmentResult));
+
+ FailureMechanismSectionResultViewColumnBuilder.AddSimpleAssemblyCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.SimpleAssemblyCategoryGroup));
+
+ FailureMechanismSectionResultViewColumnBuilder.AddDetailedAssemblyCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.DetailedAssemblyCategoryGroup));
+
+ FailureMechanismSectionResultViewColumnBuilder.AddTailorMadeAssemblyCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.TailorMadeAssemblyCategoryGroup));
+
+ FailureMechanismSectionResultViewColumnBuilder.AddCombinedAssemblyCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.CombinedAssemblyCategoryGroup));
+
+ FailureMechanismSectionResultViewColumnBuilder.AddUseManualAssemblyCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.UseManualAssemblyCategoryGroup));
+
+ FailureMechanismSectionResultViewColumnBuilder.AddManualAssemblyCategoryGroupColumn(
+ DataGridViewControl,
+ nameof(WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ManualAssemblyCategoryGroup));
}
}
}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRow.cs
===================================================================
diff -u -ref5806c808ecd8a1d443a647f3bde8c46d48dfe1 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRow.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultRow.cs) (revision ef5806c808ecd8a1d443a647f3bde8c46d48dfe1)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRow.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultRow.cs) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -20,6 +20,11 @@
// All rights reserved.
using System;
+using Core.Common.Controls.DataGrid;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.Forms;
+using Ringtoets.Common.Data.Exceptions;
+using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.Views;
using Ringtoets.Common.Primitives;
using Ringtoets.WaveImpactAsphaltCover.Data;
@@ -31,15 +36,59 @@
///
public class WaveImpactAsphaltCoverFailureMechanismSectionResultRow : FailureMechanismSectionResultRow
{
+ private readonly int simpleAssessmentResultIndex;
+ private readonly int detailedAssessmentResultForFactorizedSignalingNormIndex;
+ private readonly int detailedAssessmentResultForSignalingNormIndex;
+ private readonly int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex;
+ private readonly int detailedAssessmentResultForLowerLimitNormIndex;
+ private readonly int detailedAssessmentResultForFactorizedLowerLimitNormIndex;
+ private readonly int tailorMadeAssessmentResultIndex;
+ private readonly int simpleAssemblyCategoryGroupIndex;
+ private readonly int detailedAssemblyCategoryGroupIndex;
+ private readonly int tailorMadeAssemblyCategoryGroupIndex;
+ private readonly int combinedAssemblyCategoryGroupIndex;
+ private readonly int manualAssemblyCategoryGroupIndex;
+
+ private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup;
+ private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup;
+ private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup;
+ private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup;
+
///
/// Creates a new instance of .
///
- /// The to wrap
- /// so that it can be displayed as a row.
- /// Thrown when is null.
- internal WaveImpactAsphaltCoverFailureMechanismSectionResultRow(WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult)
- : base(sectionResult) {}
+ /// The
+ /// to wrap so that it can be displayed as a row.
+ /// The property values required to create an instance of
+ /// .
+ /// Thrown when any parameter is null.
+ public WaveImpactAsphaltCoverFailureMechanismSectionResultRow(WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult,
+ ConstructionProperties constructionProperties)
+ : base(sectionResult)
+ {
+ if (constructionProperties == null)
+ {
+ throw new ArgumentNullException(nameof(constructionProperties));
+ }
+ simpleAssessmentResultIndex = constructionProperties.SimpleAssessmentResultIndex;
+ detailedAssessmentResultForFactorizedSignalingNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex;
+ detailedAssessmentResultForSignalingNormIndex = constructionProperties.DetailedAssessmentResultForSignalingNormIndex;
+ detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex;
+ detailedAssessmentResultForLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForLowerLimitNormIndex;
+ detailedAssessmentResultForFactorizedLowerLimitNormIndex = constructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex;
+ tailorMadeAssessmentResultIndex = constructionProperties.TailorMadeAssessmentResultIndex;
+ simpleAssemblyCategoryGroupIndex = constructionProperties.SimpleAssemblyCategoryGroupIndex;
+ detailedAssemblyCategoryGroupIndex = constructionProperties.DetailedAssemblyCategoryGroupIndex;
+ tailorMadeAssemblyCategoryGroupIndex = constructionProperties.TailorMadeAssemblyCategoryGroupIndex;
+ combinedAssemblyCategoryGroupIndex = constructionProperties.CombinedAssemblyCategoryGroupIndex;
+ manualAssemblyCategoryGroupIndex = constructionProperties.ManualAssemblyCategoryGroupIndex;
+
+ CreateColumnStateDefinitions();
+
+ Update();
+ }
+
///
/// Gets or sets the value representing the simple assessment result.
///
@@ -52,10 +101,402 @@
set
{
SectionResult.SimpleAssessmentResult = value;
- SectionResult.NotifyObservers();
+ UpdateInternalData();
}
}
- public override void Update() {}
+ ///
+ /// Gets or sets the value of the detailed assessment of safety per failure mechanism section
+ /// for the factorized signaling norm (Cat Iv - IIv).
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNorm
+ {
+ get
+ {
+ return SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm;
+ }
+ set
+ {
+ SectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = value;
+ UpdateInternalData();
+ }
+ }
+
+ ///
+ /// Gets or sets the value of the detailed assessment of safety per failure mechanism section
+ /// for the signaling norm (Cat IIv - IIIv).
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNorm
+ {
+ get
+ {
+ return SectionResult.DetailedAssessmentResultForSignalingNorm;
+ }
+ set
+ {
+ SectionResult.DetailedAssessmentResultForSignalingNorm = value;
+ UpdateInternalData();
+ }
+ }
+
+ ///
+ /// Gets or sets the value of the detailed assessment of safety per failure mechanism section
+ /// for the mechanism specific signaling norm (Cat IIIv - IVv).
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNorm
+ {
+ get
+ {
+ return SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm;
+ }
+ set
+ {
+ SectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = value;
+ UpdateInternalData();
+ }
+ }
+
+ ///
+ /// Gets or sets the value of the detailed assessment of safety per failure mechanism section
+ /// for the lower limit norm (Cat IVv - Vv).
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNorm
+ {
+ get
+ {
+ return SectionResult.DetailedAssessmentResultForLowerLimitNorm;
+ }
+ set
+ {
+ SectionResult.DetailedAssessmentResultForLowerLimitNorm = value;
+ UpdateInternalData();
+ }
+ }
+
+ ///
+ /// Gets or sets the value of the detailed assessment of safety per failure mechanism section
+ /// for the factorized lower limit norm (Cat Vv - VIv).
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNorm
+ {
+ get
+ {
+ return SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm;
+ }
+ set
+ {
+ SectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = value;
+ UpdateInternalData();
+ }
+ }
+
+ ///
+ /// Gets or sets the tailor made assessment result.
+ ///
+ public SelectableFailureMechanismSectionAssemblyCategoryGroup TailorMadeAssessmentResult
+ {
+ get
+ {
+ return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.TailorMadeAssessmentResult);
+ }
+ set
+ {
+ SectionResult.TailorMadeAssessmentResult = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value);
+ UpdateInternalData();
+ }
+ }
+
+ ///
+ /// Gets the simple assembly category group.
+ ///
+ public string SimpleAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(simpleAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the detailed assembly category group.
+ ///
+ public string DetailedAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(detailedAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the tailor made assembly category group.
+ ///
+ public string TailorMadeAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(tailorMadeAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the combined assembly category group.
+ ///
+ public string CombinedAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(combinedAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// 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.
+ ///
+ public SelectableFailureMechanismSectionAssemblyCategoryGroup ManualAssemblyCategoryGroup
+ {
+ get
+ {
+ return SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertTo(SectionResult.ManualAssemblyCategoryGroup);
+ }
+ set
+ {
+ SectionResult.ManualAssemblyCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(value);
+ UpdateInternalData();
+ }
+ }
+
+ public override void Update()
+ {
+ UpdateDerivedData();
+ UpdateColumnStateDefinitionStates();
+ }
+
+ private void CreateColumnStateDefinitions()
+ {
+ ColumnStateDefinitions.Add(simpleAssessmentResultIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedSignalingNormIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(detailedAssessmentResultForSignalingNormIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(detailedAssessmentResultForLowerLimitNormIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(detailedAssessmentResultForFactorizedLowerLimitNormIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(tailorMadeAssessmentResultIndex, new DataGridViewColumnStateDefinition());
+ ColumnStateDefinitions.Add(simpleAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition
+ {
+ ReadOnly = true
+ });
+ ColumnStateDefinitions.Add(detailedAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition
+ {
+ ReadOnly = true
+ });
+ ColumnStateDefinitions.Add(tailorMadeAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition
+ {
+ ReadOnly = true
+ });
+ ColumnStateDefinitions.Add(combinedAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition
+ {
+ ReadOnly = true
+ });
+ ColumnStateDefinitions.Add(manualAssemblyCategoryGroupIndex, new DataGridViewColumnStateDefinition());
+ }
+
+ private void UpdateDerivedData()
+ {
+ ResetErrorTexts();
+ TryGetSimpleAssemblyCategoryGroup();
+ TryGetDetailedAssemblyCategoryGroup();
+ TryGetTailorMadeAssemblyCategoryGroup();
+ TryGetCombinedAssemblyCategoryGroup();
+ }
+
+ private void ResetErrorTexts()
+ {
+ ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = string.Empty;
+ ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = string.Empty;
+ ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = string.Empty;
+ ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = string.Empty;
+ }
+
+ private void TryGetSimpleAssemblyCategoryGroup()
+ {
+ try
+ {
+ simpleAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(SectionResult);
+ }
+ catch (AssemblyException e)
+ {
+ simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message;
+ }
+ }
+
+ private void TryGetDetailedAssemblyCategoryGroup()
+ {
+ try
+ {
+ detailedAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssessment(SectionResult);
+ }
+ catch (AssemblyException e)
+ {
+ detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message;
+ }
+ }
+
+ private void TryGetTailorMadeAssemblyCategoryGroup()
+ {
+ try
+ {
+ tailorMadeAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(SectionResult);
+ }
+ catch (AssemblyException e)
+ {
+ tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message;
+ }
+ }
+
+ private void TryGetCombinedAssemblyCategoryGroup()
+ {
+ try
+ {
+ combinedAssemblyCategoryGroup = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(
+ SectionResult);
+ }
+ catch (AssemblyException e)
+ {
+ combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex].ErrorText = e.InnerException.Message;
+ }
+ }
+
+ ///
+ /// 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]);
+ }
+ else
+ {
+ FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[simpleAssemblyCategoryGroupIndex],
+ simpleAssemblyCategoryGroup);
+ FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[detailedAssemblyCategoryGroupIndex],
+ detailedAssemblyCategoryGroup);
+ FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[tailorMadeAssemblyCategoryGroupIndex],
+ tailorMadeAssemblyCategoryGroup);
+ FailureMechanismSectionResultRowHelper.SetAssemblyCategoryGroupStyle(ColumnStateDefinitions[combinedAssemblyCategoryGroupIndex],
+ combinedAssemblyCategoryGroup);
+ }
+
+ FailureMechanismSectionResultRowHelper.SetColumnState(ColumnStateDefinitions[manualAssemblyCategoryGroupIndex], !UseManualAssemblyCategoryGroup);
+ }
+
+ ///
+ /// Class holding the various construction parameters for .
+ ///
+ public class ConstructionProperties
+ {
+ ///
+ /// Sets the simple assessment result index.
+ ///
+ public int SimpleAssessmentResultIndex { internal get; set; }
+
+ ///
+ /// Sets the detailed assessment result for factorized signaling norm index.
+ ///
+ public int DetailedAssessmentResultForFactorizedSignalingNormIndex { internal get; set; }
+
+ ///
+ /// Sets the detailed assessment result for signaling norm index.
+ ///
+ public int DetailedAssessmentResultForSignalingNormIndex { internal get; set; }
+
+ ///
+ /// Sets the detailed assessment result for mechanism specific lower limit norm index.
+ ///
+ public int DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex { internal get; set; }
+
+ ///
+ /// Sets the detailed assessment result for lower limit norm index.
+ ///
+ public int DetailedAssessmentResultForLowerLimitNormIndex { internal get; set; }
+
+ ///
+ /// Sets the detailed assessment result for factorized lower limit norm index.
+ ///
+ public int DetailedAssessmentResultForFactorizedLowerLimitNormIndex { internal get; set; }
+
+ ///
+ /// Sets the tailor made assessment result index.
+ ///
+ public int TailorMadeAssessmentResultIndex { internal get; set; }
+
+ ///
+ /// Sets the simple assembly category group index.
+ ///
+ public int SimpleAssemblyCategoryGroupIndex { internal get; set; }
+
+ ///
+ /// Sets the detailed assembly category group index.
+ ///
+ public int DetailedAssemblyCategoryGroupIndex { internal get; set; }
+
+ ///
+ /// Sets the tailor made assembly category group index.
+ ///
+ public int TailorMadeAssemblyCategoryGroupIndex { internal get; set; }
+
+ ///
+ /// Sets the combined assembly category group index.
+ ///
+ public int CombinedAssemblyCategoryGroupIndex { internal get; set; }
+
+ ///
+ /// Sets the manual assembly category group index.
+ ///
+ public int ManualAssemblyCategoryGroupIndex { internal get; set; }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactoryTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactoryTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -37,6 +37,8 @@
[TestFixture]
public class WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactoryTest
{
+ #region Simple Assembly
+
[Test]
public void AssembleSimpleAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
{
@@ -85,11 +87,11 @@
FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
// Call
- FailureMechanismSectionAssembly actualOutput = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(sectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(sectionResult);
// Assert
- FailureMechanismSectionAssembly calculatorOutput = calculator.SimpleAssessmentAssemblyOutput;
- Assert.AreSame(calculatorOutput, actualOutput);
+ Assert.AreEqual(calculator.SimpleAssessmentAssemblyOutput.Group, actualOutput);
}
}
@@ -116,5 +118,274 @@
Assert.AreEqual(innerException.Message, exception.Message);
}
}
+
+ #endregion
+
+ #region Detailed Assembly
+
+ [Test]
+ public void AssembleDetailedAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssessment(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanismSectionResult", exception.ParamName);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_WithSectionResult_SetsInputOnCalculator()
+ {
+ // Setup
+ var random = new Random(21);
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(failureMechanismSection)
+ {
+ DetailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue(),
+ DetailedAssessmentResultForSignalingNorm = random.NextEnumValue(),
+ DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue(),
+ DetailedAssessmentResultForLowerLimitNorm = random.NextEnumValue(),
+ DetailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue()
+ };
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssessment(sectionResult);
+
+ // Assert
+ Assert.AreEqual(sectionResult.DetailedAssessmentResultForFactorizedSignalingNorm, calculator.DetailedAssesmentResultForFactorizedSignalingNormInput);
+ Assert.AreEqual(sectionResult.DetailedAssessmentResultForSignalingNorm, calculator.DetailedAssesmentResultForSignalingNormInput);
+ Assert.AreEqual(sectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm, calculator.DetailedAssesmentResultForMechanismSpecificLowerLimitNormInput);
+ Assert.AreEqual(sectionResult.DetailedAssessmentResultForLowerLimitNorm, calculator.DetailedAssesmentResultForLowerLimitNormInput);
+ Assert.AreEqual(sectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm, calculator.DetailedAssesmentResultForFactorizedLowerLimitNormInput);
+ }
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_AssemblyRan_ReturnsOutput()
+ {
+ // Setup
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(failureMechanismSection);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssessment(sectionResult);
+
+ // Assert
+ Assert.AreEqual(calculator.DetailedAssessmentAssemblyGroupOutput, actualOutput);
+ }
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_CalculatorThrowsExceptions_ThrowsAssemblyException()
+ {
+ // Setup
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(failureMechanismSection);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculate = true;
+
+ // Call
+ TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssessment(sectionResult);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
+ }
+ }
+
+ #endregion
+
+ #region Tailor Made Assembly
+
+ [Test]
+ public void AssembleTailorMadeAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanismSectionResult", exception.ParamName);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessment_WithSectionResult_SetsInputOnCalculator()
+ {
+ // Setup
+ var random = new Random(21);
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(failureMechanismSection)
+ {
+ TailorMadeAssessmentResult = random.NextEnumValue()
+ };
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(sectionResult);
+
+ // Assert
+ Assert.AreEqual(sectionResult.TailorMadeAssessmentResult, calculator.TailorMadeAssessmentResultInput);
+ }
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessment_AssemblyRan_ReturnsOutput()
+ {
+ // Setup
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(failureMechanismSection);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(sectionResult);
+
+ // Assert
+ Assert.AreEqual(calculator.TailorMadeAssemblyCategoryOutput, actualOutput);
+ }
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessment_CalculatorThrowsExceptions_ThrowsAssemblyException()
+ {
+ // Setup
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(failureMechanismSection);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculate = true;
+
+ // Call
+ TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(sectionResult);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
+ }
+ }
+
+ #endregion
+
+ #region Combined Assembly
+
+ [Test]
+ public void AssembleCombinedAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanismSectionResult", exception.ParamName);
+ }
+
+ [Test]
+ public void AssembleCombinedAssessment_WithInput_SetsInputOnCalculator()
+ {
+ // Setup
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(
+ sectionResult);
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup expectedSimpleAssembly = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(
+ sectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup expectedDetailedAssembly = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssessment(
+ sectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup expectedTailorMadeAssembly = WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(
+ sectionResult);
+
+ Assert.AreEqual(expectedSimpleAssembly, calculator.CombinedSimpleAssemblyGroupInput);
+ Assert.AreEqual(expectedDetailedAssembly, calculator.CombinedDetailedAssemblyGroupInput);
+ Assert.AreEqual(expectedTailorMadeAssembly, calculator.CombinedTailorMadeAssemblyGroupInput);
+ }
+ }
+
+ [Test]
+ public void AssembleCombinedAssessment_AssemblyRan_ReturnsOutput()
+ {
+ // Setup
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
+ WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(
+ sectionResult);
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup? calculatorOutput = calculator.CombinedAssemblyCategoryOutput;
+ Assert.AreEqual(calculatorOutput, actualOutput);
+ }
+ }
+
+ [Test]
+ public void AssembleCombinedAssessment_CalculatorThrowsExceptions_ThrowsAssemblyException()
+ {
+ // Setup
+ var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculateCombinedAssembly = true;
+
+ // Call
+ TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(
+ sectionResult);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
+ }
+ }
+
+ #endregion
}
}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj
===================================================================
diff -u -rd7696913d8f9239cb80eb2c3bac6cc0ccf23d479 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj) (revision d7696913d8f9239cb80eb2c3bac6cc0ccf23d479)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Forms.Test.csproj) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -74,6 +74,22 @@
{318ba582-88c9-4816-a54a-a7e431461de3}
Core.Components.Gis
+
+ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
+ Ringtoets.AssemblyTool.Data
+
+
+ {22C5DDB8-2491-4BC6-BDC6-2A7B7EBF40C1}
+ Ringtoets.AssemblyTool.Forms
+
+
+ {358B6DA2-A1DF-477F-B6AC-C30204265CB0}
+ Ringtoets.AssemblyTool.KernelWrapper
+
+
+ {0AB432BB-E2CC-42EA-A72C-7AFEF7536B38}
+ Ringtoets.AssemblyTool.KernelWrapper.TestUtil
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs
===================================================================
diff -u -ref5806c808ecd8a1d443a647f3bde8c46d48dfe1 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs) (revision ef5806c808ecd8a1d443a647f3bde8c46d48dfe1)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -19,8 +19,14 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Windows.Forms;
+using NUnit.Extensions.Forms;
using NUnit.Framework;
+using Ringtoets.AssemblyTool.Forms;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.Views;
+using Ringtoets.Common.Primitives;
using Ringtoets.WaveImpactAsphaltCover.Data;
using Ringtoets.WaveImpactAsphaltCover.Forms.Views;
@@ -29,6 +35,22 @@
[TestFixture]
public class WaveImpactAsphaltCoverFailureMechanismResultViewTest
{
+ private const int nameColumnIndex = 0;
+ private const int simpleAssessmentResultIndex = 1;
+ private const int detailedAssessmentResultForFactorizedSignalingNormIndex = 2;
+ private const int detailedAssessmentResultForSignalingNormIndex = 3;
+ private const int detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = 4;
+ private const int detailedAssessmentResultForLowerLimitNormIndex = 5;
+ private const int detailedAssessmentResultForFactorizedLowerLimitNormIndex = 6;
+ private const int tailorMadeResultIndex = 7;
+ private const int simpleAssemblyCategoryGroupIndex = 8;
+ private const int detailedAssemblyCategoryGroupIndex = 9;
+ private const int tailorMadeAssemblyCategoryGroupIndex = 10;
+ private const int combinedAssemblyCategoryGroupIndex = 11;
+ private const int useManualAssemblyCategoryGroupIndex = 12;
+ private const int manualAssemblyCategoryGroupIndex = 13;
+ private const int columnCount = 14;
+
[Test]
public void Constructor_ExpectedValues()
{
@@ -45,5 +67,98 @@
Assert.AreSame(failureMechanism, view.FailureMechanism);
}
}
+
+ [Test]
+ public void GivenFormWithFailureMechanismResultView_ThenExpectedColumnsAreVisible()
+ {
+ // Given
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ using (var form = new Form())
+ using (var view = new WaveImpactAsphaltCoverFailureMechanismResultView(failureMechanism.SectionResults, failureMechanism))
+ {
+ form.Controls.Add(view);
+
+ // When
+ form.Show();
+
+ // Then
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
+
+ Assert.AreEqual(columnCount, dataGridView.ColumnCount);
+
+ Assert.IsInstanceOf(dataGridView.Columns[nameColumnIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[simpleAssessmentResultIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentResultForFactorizedSignalingNormIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentResultForSignalingNormIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentResultForLowerLimitNormIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentResultForFactorizedLowerLimitNormIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[tailorMadeResultIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[simpleAssemblyCategoryGroupIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[detailedAssemblyCategoryGroupIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[tailorMadeAssemblyCategoryGroupIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[combinedAssemblyCategoryGroupIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[useManualAssemblyCategoryGroupIndex]);
+ Assert.IsInstanceOf(dataGridView.Columns[manualAssemblyCategoryGroupIndex]);
+
+ Assert.AreEqual("Eenvoudige toets", dataGridView.Columns[simpleAssessmentResultIndex].HeaderText);
+ Assert.AreEqual("Gedetailleerde toets\r\nper vak\r\nCat. Iv - IIv", dataGridView.Columns[detailedAssessmentResultForFactorizedSignalingNormIndex].HeaderText);
+ Assert.AreEqual("Gedetailleerde toets\r\nper vak\r\nCat. IIv - IIIv", dataGridView.Columns[detailedAssessmentResultForSignalingNormIndex].HeaderText);
+ Assert.AreEqual("Gedetailleerde toets\r\nper vak\r\nCat. IIIv - IVv", dataGridView.Columns[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex].HeaderText);
+ Assert.AreEqual("Gedetailleerde toets\r\nper vak\r\nCat. IVv - Vv", dataGridView.Columns[detailedAssessmentResultForLowerLimitNormIndex].HeaderText);
+ Assert.AreEqual("Gedetailleerde toets\r\nper vak\r\nCat. Vv - VIv", dataGridView.Columns[detailedAssessmentResultForFactorizedLowerLimitNormIndex].HeaderText);
+ Assert.AreEqual("Toets op maat", dataGridView.Columns[tailorMadeResultIndex].HeaderText);
+ Assert.AreEqual("Assemblageresultaat\r\neenvoudige toets", dataGridView.Columns[simpleAssemblyCategoryGroupIndex].HeaderText);
+ Assert.AreEqual("Assemblageresultaat\r\ngedetailleerde toets per vak", dataGridView.Columns[detailedAssemblyCategoryGroupIndex].HeaderText);
+ Assert.AreEqual("Assemblageresultaat\r\ntoets op maat", dataGridView.Columns[tailorMadeAssemblyCategoryGroupIndex].HeaderText);
+ Assert.AreEqual("Assemblageresultaat\r\ngecombineerd", dataGridView.Columns[combinedAssemblyCategoryGroupIndex].HeaderText);
+ Assert.AreEqual("Overschrijf\r\nassemblageresultaat", dataGridView.Columns[useManualAssemblyCategoryGroupIndex].HeaderText);
+ Assert.AreEqual("Assemblageresultaat\r\nhandmatig", dataGridView.Columns[manualAssemblyCategoryGroupIndex].HeaderText);
+
+ Assert.AreEqual(DataGridViewAutoSizeColumnsMode.AllCells, dataGridView.AutoSizeColumnsMode);
+ Assert.AreEqual(DataGridViewContentAlignment.MiddleCenter, dataGridView.ColumnHeadersDefaultCellStyle.Alignment);
+ }
+ }
+
+ [Test]
+ public void FailureMechanismResultsView_AllDataSet_DataGridViewCorrectlyInitialized()
+ {
+ // Setup
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1"));
+
+ // Call
+ using (var form = new Form())
+ using (new AssemblyToolCalculatorFactoryConfig())
+ using (var view = new WaveImpactAsphaltCoverFailureMechanismResultView(failureMechanism.SectionResults, failureMechanism))
+ {
+ form.Controls.Add(view);
+ form.Show();
+
+ // Assert
+ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
+
+ DataGridViewRowCollection rows = dataGridView.Rows;
+ Assert.AreEqual(1, rows.Count);
+
+ DataGridViewCellCollection cells = rows[0].Cells;
+ Assert.AreEqual(columnCount, cells.Count);
+ Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue);
+ Assert.AreEqual(SimpleAssessmentResultType.None, cells[simpleAssessmentResultIndex].Value);
+ Assert.AreEqual(DetailedAssessmentResultType.None, cells[detailedAssessmentResultForFactorizedSignalingNormIndex].Value);
+ Assert.AreEqual(DetailedAssessmentResultType.None, cells[detailedAssessmentResultForSignalingNormIndex].Value);
+ Assert.AreEqual(DetailedAssessmentResultType.None, cells[detailedAssessmentResultForMechanismSpecificLowerLimitNormIndex].Value);
+ Assert.AreEqual(DetailedAssessmentResultType.None, cells[detailedAssessmentResultForLowerLimitNormIndex].Value);
+ Assert.AreEqual(DetailedAssessmentResultType.None, cells[detailedAssessmentResultForFactorizedLowerLimitNormIndex].Value);
+ Assert.AreEqual(SelectableFailureMechanismSectionAssemblyCategoryGroup.None, cells[tailorMadeResultIndex].Value);
+ Assert.AreEqual("VIIv", cells[simpleAssemblyCategoryGroupIndex].Value);
+ Assert.AreEqual("IIv", cells[detailedAssemblyCategoryGroupIndex].Value);
+ Assert.AreEqual("Iv", cells[tailorMadeAssemblyCategoryGroupIndex].Value);
+ Assert.AreEqual("Iv", cells[combinedAssemblyCategoryGroupIndex].Value);
+ Assert.AreEqual(false, cells[useManualAssemblyCategoryGroupIndex].Value);
+ Assert.AreEqual(SelectableFailureMechanismSectionAssemblyCategoryGroup.None, cells[manualAssemblyCategoryGroupIndex].Value);
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -ref5806c808ecd8a1d443a647f3bde8c46d48dfe1 -r7150f912536e96fc66e4c0fb549eb07ae097d4c2
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs) (revision ef5806c808ecd8a1d443a647f3bde8c46d48dfe1)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest.cs) (revision 7150f912536e96fc66e4c0fb549eb07ae097d4c2)
@@ -20,12 +20,22 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
+using System.Drawing;
using Core.Common.Base;
+using Core.Common.Controls.DataGrid;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.Forms;
+using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Common.Forms.Views;
using Ringtoets.Common.Primitives;
using Ringtoets.WaveImpactAsphaltCover.Data;
@@ -36,22 +46,421 @@
[TestFixture]
public class WaveImpactAsphaltCoverFailureMechanismSectionResultRowTest
{
+ private static WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ConstructionProperties ConstructionProperties
+ {
+ get
+ {
+ return new WaveImpactAsphaltCoverFailureMechanismSectionResultRow.ConstructionProperties
+ {
+ SimpleAssessmentResultIndex = 1,
+ DetailedAssessmentResultForFactorizedSignalingNormIndex = 2,
+ DetailedAssessmentResultForSignalingNormIndex = 3,
+ DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex = 4,
+ DetailedAssessmentResultForLowerLimitNormIndex = 5,
+ DetailedAssessmentResultForFactorizedLowerLimitNormIndex = 6,
+ TailorMadeAssessmentResultIndex = 7,
+ SimpleAssemblyCategoryGroupIndex = 8,
+ DetailedAssemblyCategoryGroupIndex = 9,
+ TailorMadeAssemblyCategoryGroupIndex = 10,
+ CombinedAssemblyCategoryGroupIndex = 11,
+ ManualAssemblyCategoryGroupIndex = 13
+ };
+ }
+ }
+
[Test]
- public void Constructor_WithParameters_ExpectedValues()
+ public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException()
{
// Setup
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
// Call
- var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result);
+ TestDelegate call = () => new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, null);
// Assert
- Assert.IsInstanceOf>(row);
- Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult);
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("constructionProperties", exception.ParamName);
}
[Test]
+ public void Constructor_WithParameters_ExpectedValues()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ // Call
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Assert
+ Assert.IsInstanceOf>(row);
+ Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult);
+ Assert.AreEqual(result.DetailedAssessmentResultForFactorizedSignalingNorm, row.DetailedAssessmentResultForFactorizedSignalingNorm);
+ Assert.AreEqual(result.DetailedAssessmentResultForSignalingNorm, row.DetailedAssessmentResultForSignalingNorm);
+ Assert.AreEqual(result.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm, row.DetailedAssessmentResultForSignalingNorm);
+ Assert.AreEqual(result.DetailedAssessmentResultForLowerLimitNorm, row.DetailedAssessmentResultForLowerLimitNorm);
+ 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);
+
+ IDictionary columnStateDefinitions = row.ColumnStateDefinitions;
+ Assert.AreEqual(12, columnStateDefinitions.Count);
+
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.SimpleAssessmentResultIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.DetailedAssessmentResultForFactorizedSignalingNormIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.DetailedAssessmentResultForSignalingNormIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.DetailedAssessmentResultForMechanismSpecificLowerLimitNormIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.DetailedAssessmentResultForLowerLimitNormIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.DetailedAssessmentResultForFactorizedLowerLimitNormIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.TailorMadeAssessmentResultIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.SimpleAssemblyCategoryGroupIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.DetailedAssemblyCategoryGroupIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.TailorMadeAssemblyCategoryGroupIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.CombinedAssemblyCategoryGroupIndex);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnStateDefinition(columnStateDefinitions, ConstructionProperties.ManualAssemblyCategoryGroupIndex);
+ }
+ }
+
+ [Test]
+ public void Constructor_AssemblyRan_ReturnCategoryGroups()
+ {
+ // Setup
+ var random = new Random(39);
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.DetailedAssessmentAssemblyGroupOutput = random.NextEnumValue();
+ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue();
+ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue();
+
+ // Call
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+ // Assert
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.SimpleAssessmentAssemblyOutput.Group),
+ row.SimpleAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.DetailedAssessmentAssemblyGroupOutput.Value),
+ row.DetailedAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.TailorMadeAssemblyCategoryOutput.Value),
+ row.TailorMadeAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.CombinedAssemblyCategoryOutput.Value),
+ row.CombinedAssemblyCategoryGroup);
+ }
+ }
+
+ [Test]
+ public void Constructor_AssemblyThrowsException_ExpectedColumnStates()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculate = true;
+
+ // Call
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Assert
+ IDictionary columnStateDefinitions = row.ColumnStateDefinitions;
+ const string expectedErrorText = "Message";
+
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.SimpleAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.DetailedAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.TailorMadeAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.CombinedAssemblyCategoryGroupIndex].ErrorText);
+ }
+ }
+
+ [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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ bool newValue = !result.UseManualAssemblyCategoryGroup;
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // 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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.ManualAssemblyCategoryGroup = newValue;
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup expectedCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(newValue);
+ Assert.AreEqual(expectedCategoryGroup, result.ManualAssemblyCategoryGroup);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void GivenRowWithoutAssemblyErrors_WhenUpdatingAndAssemblyThrowsException_ThenAssemblyGroupSetToNone()
+ {
+ // Given
+ var random = new Random(39);
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.DetailedAssessmentAssemblyGroupOutput = random.NextEnumValue();
+ calculator.TailorMadeAssemblyCategoryOutput = random.NextEnumValue();
+ calculator.CombinedAssemblyCategoryOutput = random.NextEnumValue();
+
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Precondition
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.SimpleAssessmentAssemblyOutput.Group),
+ row.SimpleAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.DetailedAssessmentAssemblyGroupOutput.Value),
+ row.DetailedAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.TailorMadeAssemblyCategoryOutput.Value),
+ row.TailorMadeAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.CombinedAssemblyCategoryOutput.Value),
+ row.CombinedAssemblyCategoryGroup);
+
+ // When
+ calculator.ThrowExceptionOnCalculate = true;
+ row.SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther;
+
+ // Then
+ string expectedAssemblyDisplayName = FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(FailureMechanismSectionAssemblyCategoryGroup.None);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.SimpleAssemblyCategoryGroup);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.DetailedAssemblyCategoryGroup);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.TailorMadeAssemblyCategoryGroup);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.CombinedAssemblyCategoryGroup);
+ }
+ }
+
+ [Test]
+ public void GivenRowWithAssemblyErrors_WhenUpdatingAndAssemblyDoesNotThrowException_ThenExpectedColumnStates()
+ {
+ // Given
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculate = true;
+
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Precondition
+ IDictionary columnStateDefinitions = row.ColumnStateDefinitions;
+ const string expectedErrorText = "Message";
+
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.SimpleAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.DetailedAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.TailorMadeAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(expectedErrorText, columnStateDefinitions[ConstructionProperties.CombinedAssemblyCategoryGroupIndex].ErrorText);
+
+ // When
+ calculator.ThrowExceptionOnCalculate = false;
+ row.SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther;
+
+ // Then
+ Assert.AreEqual(string.Empty, columnStateDefinitions[ConstructionProperties.SimpleAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(string.Empty, columnStateDefinitions[ConstructionProperties.DetailedAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(string.Empty, columnStateDefinitions[ConstructionProperties.TailorMadeAssemblyCategoryGroupIndex].ErrorText);
+ Assert.AreEqual(string.Empty, columnStateDefinitions[ConstructionProperties.CombinedAssemblyCategoryGroupIndex].ErrorText);
+ }
+ }
+
+ #region Column States
+
+ [Test]
+ [TestCase(SimpleAssessmentResultType.None, true)]
+ [TestCase(SimpleAssessmentResultType.ProbabilityNegligible, false)]
+ [TestCase(SimpleAssessmentResultType.NotApplicable, false)]
+ [TestCase(SimpleAssessmentResultType.AssessFurther, true)]
+ public void Constructor_WithSimpleAssessmentResultSet_ExpectedColumnStates(SimpleAssessmentResultType simpleAssessmentResult,
+ bool cellsEnabled)
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section)
+ {
+ SimpleAssessmentResult = simpleAssessmentResult
+ };
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ // Call
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section)
+ {
+ UseManualAssemblyCategoryGroup = useManualAssemblyCategoryGroup
+ };
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ // Call
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(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);
+ }
+ }
+
+ [Test]
+ [TestCaseSource(typeof(FailureMechanismSectionResultRowTestHelper), nameof(FailureMechanismSectionResultRowTestHelper.CategoryGroupColorCases))]
+ public void Constructor_WithAssemblyCategoryGroupsSet_ExpectedColumnStates(FailureMechanismSectionAssemblyCategoryGroup assemblyCategoryGroup,
+ Color expectedBackgroundColor)
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0, assemblyCategoryGroup);
+ calculator.DetailedAssessmentAssemblyGroupOutput = assemblyCategoryGroup;
+ calculator.TailorMadeAssemblyCategoryOutput = assemblyCategoryGroup;
+ calculator.CombinedAssemblyCategoryOutput = assemblyCategoryGroup;
+
+ // Call
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Assert
+ IDictionary columnStateDefinitions = row.ColumnStateDefinitions;
+
+ FailureMechanismSectionResultRowTestHelper.AssertColumnWithColorState(columnStateDefinitions[ConstructionProperties.SimpleAssemblyCategoryGroupIndex],
+ expectedBackgroundColor);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnWithColorState(columnStateDefinitions[ConstructionProperties.DetailedAssemblyCategoryGroupIndex],
+ expectedBackgroundColor);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnWithColorState(columnStateDefinitions[ConstructionProperties.TailorMadeAssemblyCategoryGroupIndex],
+ expectedBackgroundColor);
+ FailureMechanismSectionResultRowTestHelper.AssertColumnWithColorState(columnStateDefinitions[ConstructionProperties.CombinedAssemblyCategoryGroupIndex],
+ expectedBackgroundColor);
+ }
+ }
+
+ #endregion
+
+ #region Registration
+
+ [Test]
public void SimpleAssessmentResult_SetNewValue_NotifyObserversAndPropertyChanged()
{
// Setup
@@ -67,14 +476,194 @@
var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
result.Attach(observer);
- var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
- // Call
- row.SimpleAssessmentResult = newValue;
+ // Call
+ row.SimpleAssessmentResult = newValue;
- // Assert
- Assert.AreEqual(newValue, result.SimpleAssessmentResult);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreEqual(newValue, result.SimpleAssessmentResult);
+ mocks.VerifyAll();
+ }
}
+
+ [Test]
+ public void DetailedAssessmentResultForFactorizedSignalingNorm_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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.DetailedAssessmentResultForFactorizedSignalingNorm = newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.DetailedAssessmentResultForFactorizedSignalingNorm);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void DetailedAssessmentResultForSignalingNorm_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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.DetailedAssessmentResultForSignalingNorm = newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.DetailedAssessmentResultForSignalingNorm);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void DetailedAssessmentResultForMechanismSpecificLowerLimitNorm_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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void DetailedAssessmentResultForLowerLimitNorm_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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.DetailedAssessmentResultForLowerLimitNorm = newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.DetailedAssessmentResultForLowerLimitNorm);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void DetailedAssessmentResultForFactorizedLowerLimitNorm_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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.DetailedAssessmentResultForFactorizedLowerLimitNorm = newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.DetailedAssessmentResultForFactorizedLowerLimitNorm);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void TailorMadeAssessmentResult_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 WaveImpactAsphaltCoverFailureMechanismSectionResult(section);
+ result.Attach(observer);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new WaveImpactAsphaltCoverFailureMechanismSectionResultRow(result, ConstructionProperties);
+
+ // Call
+ row.TailorMadeAssessmentResult = newValue;
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup expectedCategoryGroup = SelectableFailureMechanismSectionAssemblyCategoryGroupConverter.ConvertFrom(newValue);
+ Assert.AreEqual(expectedCategoryGroup, result.TailorMadeAssessmentResult);
+ mocks.VerifyAll();
+ }
+ }
+
+ #endregion
}
}
\ No newline at end of file