Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresInputBasePropertiesTest.cs =================================================================== diff -u -r0eef796eb9da995e56fd1e4a61296ec3c25dcfad -r8cd6600dd3e505a336f657b1e63362ac3b94943c --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresInputBasePropertiesTest.cs (.../StructuresInputBasePropertiesTest.cs) (revision 0eef796eb9da995e56fd1e4a61296ec3c25dcfad) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresInputBasePropertiesTest.cs (.../StructuresInputBasePropertiesTest.cs) (revision 8cd6600dd3e505a336f657b1e63362ac3b94943c) @@ -90,7 +90,12 @@ // Setup mockRepository.ReplayAll(); - StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties constructionProperties = GetRandomConstructionProperties(); + StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties constructionProperties = GetRandomConstructionProperties(); // Call TestDelegate call = () => new SimpleStructuresInputProperties(null, constructionProperties, handler); @@ -105,7 +110,12 @@ public void Constructor_ChangeHandlerIsNull_ThrowsArgumentNullException() { // Setup - StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties constructionProperties = GetRandomConstructionProperties(); + StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties constructionProperties = GetRandomConstructionProperties(); var calculation = new StructuresCalculation(); var inputContext = new SimpleInputContext(calculation.InputParameters, calculation, @@ -126,7 +136,12 @@ // Setup mockRepository.ReplayAll(); - StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties constructionProperties = GetRandomConstructionProperties(); + StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties constructionProperties = GetRandomConstructionProperties(); var calculation = new StructuresCalculation(); var inputContext = new SimpleInputContext(calculation.InputParameters, calculation, @@ -285,7 +300,12 @@ assessmentSection); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), handler); SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = null; @@ -328,7 +348,12 @@ var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), handler); // Call @@ -372,7 +397,12 @@ var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), handler); // Call @@ -422,7 +452,12 @@ var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), handler); // When @@ -463,7 +498,12 @@ assessmentSection); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), handler); // Call @@ -511,7 +551,12 @@ assessmentSection); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), handler); // Call @@ -564,11 +609,16 @@ var newStructure = new SimpleStructure(new Point2D(0, 190)); CalculationInputSetPropertyValueAfterConfirmationParameterTester customHandler = - CreateCustomHandlerForCalculationReturningNoObservables(calculation, newStructure); + CreateCustomHandlerForCalculationReturningNoObservables(); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), customHandler); IEnumerable originalList = properties.GetSelectableHydraulicBoundaryLocations() @@ -618,7 +668,12 @@ var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), new ObservablePropertyChangeHandler(inputContext.Calculation, calculation.InputParameters)); inputContext.Attach(observerMock); @@ -772,11 +827,16 @@ assessmentSection); CalculationInputSetPropertyValueAfterConfirmationParameterTester customHandler = - CreateCustomHandlerForCalculationReturningNoObservables(calculation, null); + CreateCustomHandlerForCalculationReturningNoObservables(); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), customHandler); // Precondition @@ -803,11 +863,16 @@ var newStructure = new SimpleStructure(); CalculationInputSetPropertyValueAfterConfirmationParameterTester customHandler = - CreateCustomHandlerForCalculationReturningNoObservables(calculation, newStructure); + CreateCustomHandlerForCalculationReturningNoObservables(); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), customHandler); // Precondition @@ -836,11 +901,16 @@ string newStringValue = newValue.ToString(CultureInfo.InvariantCulture); CalculationInputSetPropertyValueAfterConfirmationParameterTester customHandler = - CreateCustomHandlerForCalculationReturningNoObservables(calculation, newStringValue); + CreateCustomHandlerForCalculationReturningNoObservables(); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), customHandler); // Call @@ -868,11 +938,16 @@ assessmentSection); CalculationInputSetPropertyValueAfterConfirmationParameterTester customHandler = - CreateCustomHandlerForCalculationReturningNoObservables(calculation, newValue); + CreateCustomHandlerForCalculationReturningNoObservables(); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), customHandler); // Call @@ -898,11 +973,16 @@ assessmentSection); CalculationInputSetPropertyValueAfterConfirmationParameterTester customHandler = - CreateCustomHandlerForCalculationReturningNoObservables(calculation, null); + CreateCustomHandlerForCalculationReturningNoObservables(); var properties = new SimpleStructuresInputProperties( inputContext, - new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties(), + new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties(), customHandler); // Call @@ -915,13 +995,18 @@ mockRepository.VerifyAll(); } - private static CalculationInputSetPropertyValueAfterConfirmationParameterTester CreateCustomHandlerForCalculationReturningNoObservables( - StructuresCalculation calculation, T expectedValue) + private static CalculationInputSetPropertyValueAfterConfirmationParameterTester CreateCustomHandlerForCalculationReturningNoObservables() { return new CalculationInputSetPropertyValueAfterConfirmationParameterTester(Enumerable.Empty()); } - private static StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties GetRandomConstructionProperties() + private static StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties + GetRandomConstructionProperties() { var structureObject = new object(); var structureLocationObject = new object(); @@ -960,24 +1045,29 @@ }.OrderBy(p => random.Next()) .ToList(); - return new StructuresInputBaseProperties, IFailureMechanism>.ConstructionProperties - { - StructurePropertyIndex = randomObjectLookup.IndexOf(structureObject), - StructureLocationPropertyIndex = randomObjectLookup.IndexOf(structureLocationObject), - StructureNormalOrientationPropertyIndex = randomObjectLookup.IndexOf(structureNormalOrientationObject), - FlowWidthAtBottomProtectionPropertyIndex = randomObjectLookup.IndexOf(flowWidthAtBottomProtectionObject), - WidthFlowAperturesPropertyIndex = randomObjectLookup.IndexOf(widthFlowAperturesObject), - StorageStructureAreaPropertyIndex = randomObjectLookup.IndexOf(storageStructureAreaObject), - AllowedLevelIncreaseStoragePropertyIndex = randomObjectLookup.IndexOf(allowedLevelIncreaseStorageObject), - CriticalOvertoppingDischargePropertyIndex = randomObjectLookup.IndexOf(criticalOvertoppingDischargeObject), - FailureProbabilityStructureWithErosionPropertyIndex = randomObjectLookup.IndexOf(failureProbabilityStructureWithErosionObject), - ForeshoreProfilePropertyIndex = randomObjectLookup.IndexOf(foreshoreProfileObject), - UseBreakWaterPropertyIndex = randomObjectLookup.IndexOf(useBreakWaterObject), - UseForeshorePropertyIndex = randomObjectLookup.IndexOf(useForeshoreObject), - ModelFactorSuperCriticalFlowPropertyIndex = randomObjectLookup.IndexOf(modelFactorSuperCriticalFlowObject), - HydraulicBoundaryLocationPropertyIndex = randomObjectLookup.IndexOf(hydraulicBoundaryLocationObject), - StormDurationPropertyIndex = randomObjectLookup.IndexOf(stormDurationObject) - }; + return new StructuresInputBaseProperties< + SimpleStructure, + SimpleStructureInput, + StructuresCalculation, + IFailureMechanism> + .ConstructionProperties + { + StructurePropertyIndex = randomObjectLookup.IndexOf(structureObject), + StructureLocationPropertyIndex = randomObjectLookup.IndexOf(structureLocationObject), + StructureNormalOrientationPropertyIndex = randomObjectLookup.IndexOf(structureNormalOrientationObject), + FlowWidthAtBottomProtectionPropertyIndex = randomObjectLookup.IndexOf(flowWidthAtBottomProtectionObject), + WidthFlowAperturesPropertyIndex = randomObjectLookup.IndexOf(widthFlowAperturesObject), + StorageStructureAreaPropertyIndex = randomObjectLookup.IndexOf(storageStructureAreaObject), + AllowedLevelIncreaseStoragePropertyIndex = randomObjectLookup.IndexOf(allowedLevelIncreaseStorageObject), + CriticalOvertoppingDischargePropertyIndex = randomObjectLookup.IndexOf(criticalOvertoppingDischargeObject), + FailureProbabilityStructureWithErosionPropertyIndex = randomObjectLookup.IndexOf(failureProbabilityStructureWithErosionObject), + ForeshoreProfilePropertyIndex = randomObjectLookup.IndexOf(foreshoreProfileObject), + UseBreakWaterPropertyIndex = randomObjectLookup.IndexOf(useBreakWaterObject), + UseForeshorePropertyIndex = randomObjectLookup.IndexOf(useForeshoreObject), + ModelFactorSuperCriticalFlowPropertyIndex = randomObjectLookup.IndexOf(modelFactorSuperCriticalFlowObject), + HydraulicBoundaryLocationPropertyIndex = randomObjectLookup.IndexOf(hydraulicBoundaryLocationObject), + StormDurationPropertyIndex = randomObjectLookup.IndexOf(stormDurationObject) + }; } private static HydraulicBoundaryLocation CreateHydraulicBoundaryLocation() @@ -1003,7 +1093,11 @@ StructuresCalculation, IFailureMechanism> { - public SimpleStructuresInputProperties(SimpleInputContext context, ConstructionProperties constructionProperties, IObservablePropertyChangeHandler handler) : base(context, constructionProperties, handler) {} + public SimpleStructuresInputProperties( + SimpleInputContext context, + ConstructionProperties constructionProperties, + IObservablePropertyChangeHandler handler) + : base(context, constructionProperties, handler) {} [Browsable(false)] public bool AfterSettingStructureCalled { get; private set; } @@ -1024,9 +1118,14 @@ } } - private class SimpleInputContext : InputContextBase, IFailureMechanism> + private class SimpleInputContext + : InputContextBase, IFailureMechanism> { - public SimpleInputContext(SimpleStructureInput wrappedData, StructuresCalculation calculation, IFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + public SimpleInputContext( + SimpleStructureInput wrappedData, + StructuresCalculation calculation, + IFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) : base(wrappedData, calculation, failureMechanism, assessmentSection) {} }