Index: Riskeer/Common/src/Riskeer.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs =================================================================== diff -u -r6811f4155d92f0a1318764695159893c2b7db99f -r7b7731a59cf0e7174ed0de97dac62c4252549580 --- Riskeer/Common/src/Riskeer.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs (.../AssessmentSectionExtensions.cs) (revision 6811f4155d92f0a1318764695159893c2b7db99f) +++ Riskeer/Common/src/Riskeer.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs (.../AssessmentSectionExtensions.cs) (revision 7b7731a59cf0e7174ed0de97dac62c4252549580) @@ -97,37 +97,6 @@ } /// - /// Gets the for a - /// based on . - /// The assessment section to get the from. - /// The hydraulic boundary location to get the for. - /// The category type to use while obtaining the . - /// The , or null when: - /// - /// is null; - /// is not part of . - /// - /// - /// Thrown when - /// is null. - /// Thrown when - /// is an invalid . - /// Thrown when - /// is a valid but unsupported . - public static HydraulicBoundaryLocationCalculation GetHydraulicBoundaryLocationCalculation(this IAssessmentSection assessmentSection, - HydraulicBoundaryLocation hydraulicBoundaryLocation, - AssessmentSectionCategoryType categoryType) - { - if (assessmentSection == null) - { - throw new ArgumentNullException(nameof(assessmentSection)); - } - - return GetHydraulicBoundaryLocationCalculationFromCalculations(hydraulicBoundaryLocation, - GetHydraulicBoundaryLocationCalculations(assessmentSection, categoryType)); - } - - /// /// Gets the relevant collection of based on the of the /// assessment section. /// @@ -167,50 +136,6 @@ return calculations; } - /// - /// Gets the collection of that belongs to - /// the given . - /// - /// The assessment section to get the calculations from. - /// The used to determine which calculations to return. - /// A collection of . - /// Thrown when - /// is an invalid . - /// Thrown when - /// is a valid but unsupported . - private static IEnumerable GetHydraulicBoundaryLocationCalculations(IAssessmentSection assessmentSection, - AssessmentSectionCategoryType categoryType) - { - if (!Enum.IsDefined(typeof(AssessmentSectionCategoryType), categoryType)) - { - throw new InvalidEnumArgumentException(nameof(categoryType), - (int) categoryType, - typeof(AssessmentSectionCategoryType)); - } - - IEnumerable calculations; - - switch (categoryType) - { - case AssessmentSectionCategoryType.FactorizedSignalingNorm: - calculations = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm; - break; - case AssessmentSectionCategoryType.SignalingNorm: - calculations = assessmentSection.WaterLevelCalculationsForSignalingNorm; - break; - case AssessmentSectionCategoryType.LowerLimitNorm: - calculations = assessmentSection.WaterLevelCalculationsForLowerLimitNorm; - break; - case AssessmentSectionCategoryType.FactorizedLowerLimitNorm: - calculations = assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm; - break; - default: - throw new NotSupportedException(); - } - - return calculations; - } - private static HydraulicBoundaryLocationCalculation GetHydraulicBoundaryLocationCalculationFromCalculations(HydraulicBoundaryLocation hydraulicBoundaryLocation, IEnumerable calculations) { Index: Riskeer/Common/test/Riskeer.Common.Data.Test/AssessmentSection/AssessmentSectionExtensionsTest.cs =================================================================== diff -u -r6811f4155d92f0a1318764695159893c2b7db99f -r7b7731a59cf0e7174ed0de97dac62c4252549580 --- Riskeer/Common/test/Riskeer.Common.Data.Test/AssessmentSection/AssessmentSectionExtensionsTest.cs (.../AssessmentSectionExtensionsTest.cs) (revision 6811f4155d92f0a1318764695159893c2b7db99f) +++ Riskeer/Common/test/Riskeer.Common.Data.Test/AssessmentSection/AssessmentSectionExtensionsTest.cs (.../AssessmentSectionExtensionsTest.cs) (revision 7b7731a59cf0e7174ed0de97dac62c4252549580) @@ -148,84 +148,6 @@ } [Test] - public void GetHydraulicBoundaryLocationCalculation_AssessmentSectionNull_ThrowsArgumentNullException() - { - // Call - void Call() => AssessmentSectionExtensions.GetHydraulicBoundaryLocationCalculation(null, new TestHydraulicBoundaryLocation(), - AssessmentSectionCategoryType.FactorizedLowerLimitNorm); - - // Assert - string paramName = Assert.Throws(Call).ParamName; - Assert.AreEqual("assessmentSection", paramName); - } - - [Test] - public void GetHydraulicBoundaryLocationCalculation_InvalidAssessmentSectionCategoryType_ThrowsInvalidEnumArgumentException() - { - // Setup - const int invalidValue = 9999; - - var assessmentSection = new AssessmentSectionStub(); - - // Call - void Call() => assessmentSection.GetHydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation(), - (AssessmentSectionCategoryType) invalidValue); - - // Assert - var expectedMessage = $"The value of argument 'categoryType' ({invalidValue}) is invalid for Enum type '{nameof(AssessmentSectionCategoryType)}'."; - string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage).ParamName; - Assert.AreEqual("categoryType", parameterName); - } - - [Test] - public void GetHydraulicBoundaryLocationCalculation_HydraulicBoundaryLocationNull_ReturnsNull() - { - // Setup - var assessmentSection = new AssessmentSectionStub(); - - // Call - HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation = assessmentSection.GetHydraulicBoundaryLocationCalculation( - null, - new Random(32).NextEnumValue()); - - // Assert - Assert.IsNull(hydraulicBoundaryLocationCalculation); - } - - [Test] - public void GetHydraulicBoundaryLocationCalculation_NoCorrespondingCalculation_ReturnsNull() - { - // Setup - var assessmentSection = new AssessmentSectionStub(); - - // Call - HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation = assessmentSection.GetHydraulicBoundaryLocationCalculation( - new TestHydraulicBoundaryLocation(), - new Random(32).NextEnumValue()); - - // Assert - Assert.IsNull(hydraulicBoundaryLocationCalculation); - } - - [Test] - [TestCaseSource( - typeof(AssessmentSectionTestHelper), - nameof(AssessmentSectionTestHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerAssessmentSectionCategoryType))] - public void GetHydraulicBoundaryLocationCalculation_HydraulicBoundaryLocationWithOutput_ReturnsCorrespondingHydraulicBoundaryLocationCalculation( - IAssessmentSection assessmentSection, - HydraulicBoundaryLocation hydraulicBoundaryLocation, - AssessmentSectionCategoryType categoryType, - HydraulicBoundaryLocationCalculation expectedHydraulicBoundaryLocationCalculation) - { - // Call - HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation = assessmentSection.GetHydraulicBoundaryLocationCalculation( - hydraulicBoundaryLocation, categoryType); - - // Assert - Assert.AreSame(expectedHydraulicBoundaryLocationCalculation, hydraulicBoundaryLocationCalculation); - } - - [Test] public void GetNormativeHydraulicBoundaryLocationCalculation_AssessmentSectionNull_ThrowsArgumentNullException() { // Call