Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs =================================================================== diff -u -rbd73023d5f8926a411da214fb5ce522056a0e30a -r3b8d36552602400aa233012ab988a1b06a829dbe --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision bd73023d5f8926a411da214fb5ce522056a0e30a) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision 3b8d36552602400aa233012ab988a1b06a829dbe) @@ -181,101 +181,6 @@ } [Test] - public void Calculate_InvalidInFlowModelType_ThrowsInvalidEnumArgumentException() - { - // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - var assessmentSectionStub = mockRepository.Stub(); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestStabilityPointStructuresCalculation() - { - InputParameters = - { - InflowModelType = (StabilityPointStructureInflowModelType) 100 - } - }; - - var service = new StabilityPointStructuresCalculationService(); - - // Call - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; - - // Call - TestDelegate call = () => service.Calculate(calculation, - assessmentSectionStub, - stabilityPointStructuresFailureMechanism, - testDataPath); - - StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); - - // Assert - Assert.AreEqual(0, calculationInputs.Length); - var exception = Assert.Throws(call); - Assert.AreEqual("calculation", exception.ParamName); - StringAssert.StartsWith("The value of argument 'calculation' (100) is invalid for Enum type 'StabilityPointStructureInflowModelType'.", exception.Message); - } - mockRepository.VerifyAll(); - } - - [Test] - public void Calculate_InvalidLoadSchematizationType_ThrowsInvalidEnumArgumentException() - { - // Setup - var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); - - var mockRepository = new MockRepository(); - var assessmentSectionStub = mockRepository.Stub(); - mockRepository.ReplayAll(); - - stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestStabilityPointStructuresCalculation() - { - InputParameters = - { - LoadSchematizationType = (LoadSchematizationType) 100 - } - }; - - var service = new StabilityPointStructuresCalculationService(); - - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; - - // Call - TestDelegate call = () => service.Calculate(calculation, - assessmentSectionStub, - stabilityPointStructuresFailureMechanism, - testDataPath); - - StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); - - // Assert - Assert.AreEqual(0, calculationInputs.Length); - var exception = Assert.Throws(call); - Assert.AreEqual("calculation", exception.ParamName); - StringAssert.StartsWith("The value of argument 'calculation' (100) is invalid for Enum type 'LoadSchematizationType'.", exception.Message); - } - mockRepository.VerifyAll(); - } - - [Test] [Combinatorial] public void Validate_UseBreakWaterWithInvalidBreakWaterHeight_LogStartAndEndAndErrorMessageAndThrowsException( [Values(StabilityPointStructureInflowModelType.FloodedCulvert, StabilityPointStructureInflowModelType.LowSill)] StabilityPointStructureInflowModelType inflowModelType, @@ -692,7 +597,7 @@ Name = name, InputParameters = { - InflowModelType = (StabilityPointStructureInflowModelType) 100, + InflowModelType = (StabilityPointStructureInflowModelType) 100 } }; @@ -708,7 +613,9 @@ } [Test] - public void Validate_InvalidLoadSchematizationType_ThrowsInvalidEnumArgumentException() + [TestCase(StabilityPointStructureInflowModelType.FloodedCulvert)] + [TestCase(StabilityPointStructureInflowModelType.LowSill)] + public void Validate_InvalidLoadSchematizationType_ThrowsInvalidEnumArgumentException(StabilityPointStructureInflowModelType inflowModelType) { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -730,6 +637,7 @@ Name = name, InputParameters = { + InflowModelType = inflowModelType, LoadSchematizationType = (LoadSchematizationType) 100 } }; @@ -747,6 +655,104 @@ } [Test] + public void Calculate_InvalidInFlowModelType_ThrowsInvalidEnumArgumentException() + { + // Setup + var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + })); + + var calculation = new TestStabilityPointStructuresCalculation() + { + InputParameters = + { + InflowModelType = (StabilityPointStructureInflowModelType) 100 + } + }; + + var service = new StabilityPointStructuresCalculationService(); + + // Call + using (new HydraRingCalculatorFactoryConfig()) + { + var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; + + // Call + TestDelegate call = () => service.Calculate(calculation, + assessmentSectionStub, + stabilityPointStructuresFailureMechanism, + testDataPath); + + StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + + // Assert + Assert.AreEqual(0, calculationInputs.Length); + var exception = Assert.Throws(call); + Assert.AreEqual("calculation", exception.ParamName); + StringAssert.StartsWith("The value of argument 'calculation' (100) is invalid for Enum type 'StabilityPointStructureInflowModelType'.", exception.Message); + } + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(StabilityPointStructureInflowModelType.FloodedCulvert)] + [TestCase(StabilityPointStructureInflowModelType.LowSill)] + public void Calculate_InvalidLoadSchematizationType_ThrowsInvalidEnumArgumentException(StabilityPointStructureInflowModelType inflowModelType) + { + // Setup + var stabilityPointStructuresFailureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + var assessmentSectionStub = mockRepository.Stub(); + mockRepository.ReplayAll(); + + stabilityPointStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + })); + + var calculation = new TestStabilityPointStructuresCalculation() + { + InputParameters = + { + InflowModelType = inflowModelType, + LoadSchematizationType = (LoadSchematizationType) 100 + } + }; + + var service = new StabilityPointStructuresCalculationService(); + + using (new HydraRingCalculatorFactoryConfig()) + { + var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; + + // Call + TestDelegate call = () => service.Calculate(calculation, + assessmentSectionStub, + stabilityPointStructuresFailureMechanism, + testDataPath); + + StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + + // Assert + Assert.AreEqual(0, calculationInputs.Length); + var exception = Assert.Throws(call); + Assert.AreEqual("calculation", exception.ParamName); + StringAssert.StartsWith("The value of argument 'calculation' (100) is invalid for Enum type 'LoadSchematizationType'.", exception.Message); + } + mockRepository.VerifyAll(); + } + + [Test] [TestCase(true, false)] [TestCase(true, true)] [TestCase(false, false)]