Index: Riskeer/Common/src/Riskeer.Common.Forms/Providers/FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/Providers/FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/Providers/FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider.cs (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -0,0 +1,112 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base.Geometry; +using Riskeer.Common.Data.Calculation; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Data.Helpers; +using Riskeer.Common.Forms.Properties; + +namespace Riskeer.Common.Forms.Providers +{ + /// + /// This class provides error messages about the failure mechanism result rows that contains calculated probabilities. + /// + /// The type of calculation scenario. + public class FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider : FailureMechanismSectionResultRowErrorProvider, + IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider + where T : ICalculationScenario + { + private readonly FailureMechanismSectionResult sectionResult; + private readonly IEnumerable calculationScenarios; + private readonly Func, bool> intersectionFunc; + + /// + /// Creates a new instance of . + /// + /// The to validate for. + /// The calculation scenarios to validate. + /// The function to determine whether a scenario is belonging + /// to the given . + /// Thrown when any parameter is null. + public FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider(FailureMechanismSectionResult sectionResult, + IEnumerable calculationScenarios, + Func, bool> intersectionFunc) + { + if (sectionResult == null) + { + throw new ArgumentNullException(nameof(sectionResult)); + } + + if (calculationScenarios == null) + { + throw new ArgumentNullException(nameof(calculationScenarios)); + } + + if (intersectionFunc == null) + { + throw new ArgumentNullException(nameof(intersectionFunc)); + } + + this.sectionResult = sectionResult; + this.calculationScenarios = calculationScenarios; + this.intersectionFunc = intersectionFunc; + } + + /// + /// Thrown when + /// is null. + public string GetCalculatedProbabilityValidationError(Func getProbabilityFunc) + { + if (getProbabilityFunc == null) + { + throw new ArgumentNullException(nameof(getProbabilityFunc)); + } + + T[] relevantScenarios = sectionResult.GetRelevantCalculationScenarios(calculationScenarios, intersectionFunc).ToArray(); + + if (relevantScenarios.Length == 0) + { + return Resources.InitialFailureMechanismResultErrorProvider_No_relevant_calculation_scenarios_present; + } + + if (Math.Abs(CalculationScenarioHelper.GetTotalContribution(relevantScenarios) - 1.0) > 1e-6) + { + return Resources.InitialFailureMechanismResultErrorProvider_Scenario_contribution_for_this_section_not_100; + } + + if (!relevantScenarios.All(s => s.HasOutput)) + { + return Resources.InitialFailureMechanismResultErrorProvider_Not_all_relevant_calculation_scenarios_have_been_executed; + } + + if (double.IsNaN(getProbabilityFunc())) + { + return Resources.InitialFailureMechanismResultErrorProvider_All_relevant_calculation_scenarios_must_have_valid_output; + } + + return string.Empty; + } + } +} \ No newline at end of file Index: Riskeer/Common/src/Riskeer.Common.Forms/Providers/IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Forms/Providers/IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Forms/Providers/IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider.cs (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -0,0 +1,40 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; + +namespace Riskeer.Common.Forms.Providers +{ + /// + /// Interface for providing error messages about the failure mechanism section result rows + /// that contain calculated probabilities. + /// + public interface IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider : IFailureMechanismSectionResultRowErrorProvider + { + /// + /// Gets the calculated probability validation error. + /// + /// The function to get the probability to validate. + /// An error message when the validation fails; + /// or when there are no errors. + string GetCalculatedProbabilityValidationError(Func getProbabilityFunc); + } +} \ No newline at end of file Fisheye: Tag e55b0df15fe406aed1091a906aa7d9d4c5f2ae34 refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Providers/IWithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e55b0df15fe406aed1091a906aa7d9d4c5f2ae34 refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Providers/WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/src/Riskeer.Common.Forms/Views/AdoptableFailureMechanismSectionResultRow.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/Common/src/Riskeer.Common.Forms/Views/AdoptableFailureMechanismSectionResultRow.cs (.../AdoptableFailureMechanismSectionResultRow.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/Common/src/Riskeer.Common.Forms/Views/AdoptableFailureMechanismSectionResultRow.cs (.../AdoptableFailureMechanismSectionResultRow.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -45,7 +45,7 @@ private readonly int assemblyGroupIndex; private readonly Func calculateInitialFailureMechanismResultProbabilityFunc; - private readonly IWithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider failureMechanismSectionResultRowErrorProvider; + private readonly IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider failureMechanismSectionResultRowErrorProvider; private readonly IAssessmentSection assessmentSection; /// @@ -63,7 +63,7 @@ /// Throw when any parameter is null. public AdoptableFailureMechanismSectionResultRow(AdoptableFailureMechanismSectionResult sectionResult, Func calculateInitialFailureMechanismResultProbabilityFunc, - IWithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider failureMechanismSectionResultRowErrorProvider, + IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider failureMechanismSectionResultRowErrorProvider, IAssessmentSection assessmentSection, ConstructionProperties constructionProperties) : base(sectionResult) Index: Riskeer/Common/src/Riskeer.Common.Forms/Views/AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/Common/src/Riskeer.Common.Forms/Views/AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.cs (.../AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/Common/src/Riskeer.Common.Forms/Views/AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.cs (.../AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -51,7 +51,7 @@ private readonly int assemblyGroupIndex; private readonly IFailureMechanismSectionResultCalculateProbabilityStrategy calculateProbabilityStrategy; - private readonly IWithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider failureMechanismSectionResultRowErrorProvider; + private readonly IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider failureMechanismSectionResultRowErrorProvider; private readonly ILengthEffectProvider lengthEffectProvider; private readonly IAssessmentSection assessmentSection; @@ -70,7 +70,7 @@ /// Throw when any parameter is null. public AdoptableWithProfileProbabilityFailureMechanismSectionResultRow(AdoptableWithProfileProbabilityFailureMechanismSectionResult sectionResult, IFailureMechanismSectionResultCalculateProbabilityStrategy calculateProbabilityStrategy, - IWithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider failureMechanismSectionResultRowErrorProvider, + IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider failureMechanismSectionResultRowErrorProvider, ILengthEffectProvider lengthEffectProvider, IAssessmentSection assessmentSection, ConstructionProperties constructionProperties) Index: Riskeer/Common/src/Riskeer.Common.Forms/Views/StructuresFailureMechanismResultView.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/Common/src/Riskeer.Common.Forms/Views/StructuresFailureMechanismResultView.cs (.../StructuresFailureMechanismResultView.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/Common/src/Riskeer.Common.Forms/Views/StructuresFailureMechanismResultView.cs (.../StructuresFailureMechanismResultView.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -171,10 +171,10 @@ nameof(AdoptableFailureMechanismSectionResultRow.AssemblyGroup)); } - private static WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider> CreateErrorProvider( + private static FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider> CreateErrorProvider( FailureMechanismSectionResult sectionResult, IEnumerable> calculationScenarios) { - return new WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider>( + return new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider>( sectionResult, calculationScenarios, (scenario, lineSegments) => scenario.IsStructureIntersectionWithReferenceLineInSection(lineSegments)); } Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProviderTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProviderTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProviderTest.cs (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -0,0 +1,247 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using Core.Common.Base.Data; +using NUnit.Framework; +using Riskeer.Common.Data.Calculation; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Data.TestUtil; +using Riskeer.Common.Forms.Providers; + +namespace Riskeer.Common.Forms.Test.Providers +{ + [TestFixture] + public class FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProviderTest + { + [Test] + public void Constructor_SectionResultNull_ThrowsArgumentNullException() + { + // Call + void Call() => new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + null, Enumerable.Empty(), (scenario, segments) => false); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("sectionResult", exception.ParamName); + } + + [Test] + public void Constructor_CalculationScenariosNull_ThrowsArgumentNullException() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + // Call + void Call() => new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, null, (scenario, segments) => false); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("calculationScenarios", exception.ParamName); + } + + [Test] + public void Constructor_IntersectionFuncNull_ThrowsArgumentNullException() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + // Call + void Call() => new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, Enumerable.Empty(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("intersectionFunc", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + // Call + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, Enumerable.Empty(), (scenario, segments) => false); + + // Assert + Assert.IsInstanceOf(errorProvider); + Assert.IsInstanceOf(errorProvider); + } + + [Test] + public void GetCalculatedProbabilityValidationError_GetProbabilityFuncNull_ThrowsArgumentNullException() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, Enumerable.Empty(), (scenario, segments) => false); + + // Call + void Call() => errorProvider.GetCalculatedProbabilityValidationError(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("getProbabilityFunc", exception.ParamName); + } + + [Test] + public void GetCalculatedProbabilityValidationError_NoRelevantScenarios_ReturnsErrorMessage() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + var calculationScenarios = new[] + { + new TestCalculationScenario(), + new TestCalculationScenario() + }; + + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, calculationScenarios, (scenario, segments) => false); + + // Call + string errorMessage = errorProvider.GetCalculatedProbabilityValidationError(() => double.NaN); + + // Assert + Assert.AreEqual("Er moet minimaal één maatgevende berekening voor dit vak worden gedefinieerd.", errorMessage); + } + + [Test] + [TestCase(0.043)] + [TestCase(0.689)] + public void GetCalculatedProbabilityValidationError_TotalContributionNotOne_ReturnsErrorMessage(double contribution) + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + var calculationScenarios = new[] + { + new TestCalculationScenario + { + Contribution = (RoundedDouble) 0.5 + }, + new TestCalculationScenario + { + Contribution = (RoundedDouble) contribution + } + }; + + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, calculationScenarios, (scenario, segments) => true); + + // Call + string errorMessage = errorProvider.GetCalculatedProbabilityValidationError(() => double.NaN); + + // Assert + Assert.AreEqual("De bijdragen van de maatgevende scenario's voor dit vak moeten opgeteld gelijk zijn aan 100%.", errorMessage); + } + + [Test] + public void GetCalculatedProbabilityValidationError_CalculationScenarioWithoutOutput_ReturnsErrorMessage() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + var calculationScenarios = new[] + { + new TestCalculationScenario() + }; + + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, calculationScenarios, (scenario, segments) => true); + + // Call + string errorMessage = errorProvider.GetCalculatedProbabilityValidationError(() => double.NaN); + + // Assert + Assert.AreEqual("Alle maatgevende berekeningen voor dit vak moeten uitgevoerd zijn.", errorMessage); + } + + [Test] + public void GetCalculatedProbabilityValidationError_CalculationScenarioWithInvalidOutput_ReturnsErrorMessage() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + var calculationScenarios = new[] + { + new TestCalculationScenario + { + Output = new object() + } + }; + + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, calculationScenarios, (scenario, segments) => true); + + // Call + string errorMessage = errorProvider.GetCalculatedProbabilityValidationError(() => double.NaN); + + // Assert + Assert.AreEqual("Alle maatgevende berekeningen voor dit vak moeten een geldige uitkomst hebben.", errorMessage); + } + + [Test] + public void GetCalculatedProbabilityValidationError_ValidCalculationScenarios_ReturnsEmptyMessage() + { + // Setup + var random = new Random(39); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var sectionResult = new TestFailureMechanismSectionResult(section); + + var calculationScenarios = new[] + { + new TestCalculationScenario + { + Contribution = (RoundedDouble) 0.5, + Output = new object() + }, + new TestCalculationScenario + { + Contribution = (RoundedDouble) 0.5, + Output = new object() + } + }; + + var errorProvider = new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( + sectionResult, calculationScenarios, (scenario, segments) => true); + + // Call + string errorMessage = errorProvider.GetCalculatedProbabilityValidationError(() => random.NextDouble()); + + // Assert + Assert.AreEqual(string.Empty, errorMessage); + } + } +} \ No newline at end of file Fisheye: Tag e55b0df15fe406aed1091a906aa7d9d4c5f2ae34 refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.Forms.Test/Providers/WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProviderTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/AdoptableFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/AdoptableFailureMechanismSectionResultRowTest.cs (.../AdoptableFailureMechanismSectionResultRowTest.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/AdoptableFailureMechanismSectionResultRowTest.cs (.../AdoptableFailureMechanismSectionResultRowTest.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -62,7 +62,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -99,7 +99,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -120,7 +120,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -141,7 +141,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -191,7 +191,7 @@ { // Given var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -223,7 +223,7 @@ // Given const string errorText = "error"; var mocks = new MockRepository(); - var errorProvider = mocks.StrictMock(); + var errorProvider = mocks.StrictMock(); errorProvider.Expect(ep => ep.GetCalculatedProbabilityValidationError(null)) .IgnoreArguments() .Return(errorText); @@ -255,7 +255,7 @@ { // Given var mocks = new MockRepository(); - var errorProvider = mocks.StrictMock(); + var errorProvider = mocks.StrictMock(); errorProvider.Stub(ep => ep.GetCalculatedProbabilityValidationError(null)) .IgnoreArguments() .Return("error message"); @@ -357,7 +357,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var observer = mocks.StrictMock(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); @@ -386,7 +386,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -419,7 +419,7 @@ const double initialSectionProbability = 0.2; var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); var assessmentSection = new AssessmentSectionStub(); @@ -454,7 +454,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); var random = new Random(39); @@ -491,7 +491,7 @@ { // Given var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); var random = new Random(39); @@ -534,7 +534,7 @@ { // Given var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -572,7 +572,7 @@ { // Given var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -615,7 +615,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -644,7 +644,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -686,7 +686,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); errorProvider.Stub(ep => ep.GetCalculatedProbabilityValidationError(null)) .IgnoreArguments() .Return(string.Empty); @@ -721,7 +721,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -753,7 +753,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/AdoptableWithProfileProbabilityFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/AdoptableWithProfileProbabilityFailureMechanismSectionResultRowTest.cs (.../AdoptableWithProfileProbabilityFailureMechanismSectionResultRowTest.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/AdoptableWithProfileProbabilityFailureMechanismSectionResultRowTest.cs (.../AdoptableWithProfileProbabilityFailureMechanismSectionResultRowTest.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -68,7 +68,7 @@ { // Setup var mocks = new MockRepository(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -113,7 +113,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -135,7 +135,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -157,7 +157,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); @@ -185,7 +185,7 @@ var calculateStrategy = mocks.Stub(); calculateStrategy.Stub(c => c.CalculateProfileProbability()).Return(profileProbability); calculateStrategy.Stub(c => c.CalculateSectionProbability()).Return(sectionProbability); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -258,7 +258,7 @@ var calculateStrategy = mocks.Stub(); calculateStrategy.Stub(c => c.CalculateProfileProbability()).Return(profileProbability); calculateStrategy.Stub(c => c.CalculateSectionProbability()).Return(sectionProbability); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -292,7 +292,7 @@ // Given var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -328,7 +328,7 @@ const string errorText = "error"; var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.StrictMock(); + var errorProvider = mocks.StrictMock(); errorProvider.Expect(ep => ep.GetCalculatedProbabilityValidationError(null)) .IgnoreArguments() .Return(errorText) @@ -363,7 +363,7 @@ // Given var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.StrictMock(); + var errorProvider = mocks.StrictMock(); errorProvider.Stub(ep => ep.GetCalculatedProbabilityValidationError(null)) .IgnoreArguments() .Return("error message"); @@ -513,7 +513,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); var observer = mocks.StrictMock(); observer.Expect(o => o.UpdateObserver()); @@ -543,7 +543,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -580,7 +580,7 @@ var calculateStrategy = mocks.Stub(); calculateStrategy.Stub(c => c.CalculateProfileProbability()).Return(initialProfileProbability); calculateStrategy.Stub(c => c.CalculateSectionProbability()).Return(initialSectionProbability); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); lengthEffectProvider.Stub(lep => lep.UseLengthEffect).Return(false); mocks.ReplayAll(); @@ -627,7 +627,7 @@ var calculateStrategy = mocks.Stub(); calculateStrategy.Stub(c => c.CalculateProfileProbability()).Return(initialProfileProbability); calculateStrategy.Stub(c => c.CalculateSectionProbability()).Return(initialSectionProbability); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); lengthEffectProvider.Stub(lep => lep.UseLengthEffect).Return(true); lengthEffectProvider.Stub(lep => lep.SectionN).Return(n); @@ -674,7 +674,7 @@ var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -714,7 +714,7 @@ var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -756,7 +756,7 @@ // Given var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -799,7 +799,7 @@ // Given var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -847,7 +847,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -881,7 +881,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -931,7 +931,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); errorProvider.Stub(ep => ep.GetCalculatedProbabilityValidationError(null)) .IgnoreArguments() .Return(string.Empty); @@ -969,7 +969,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -1010,7 +1010,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); @@ -1046,7 +1046,7 @@ // Setup var mocks = new MockRepository(); var calculateStrategy = mocks.Stub(); - var errorProvider = mocks.Stub(); + var errorProvider = mocks.Stub(); var lengthEffectProvider = mocks.Stub(); mocks.ReplayAll(); Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -215,10 +215,10 @@ sectionResult, calculationScenarios); } - private static WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider CreateErrorProvider( + private static FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider CreateErrorProvider( FailureMechanismSectionResult sectionResult, IEnumerable calculationScenarios) { - return new WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider( + return new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( sectionResult, calculationScenarios, (scenario, lineSegments) => scenario.IsDikeProfileIntersectionWithReferenceLineInSection(lineSegments)); } Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs (.../MacroStabilityInwardsFailureMechanismResultView.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs (.../MacroStabilityInwardsFailureMechanismResultView.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -197,10 +197,10 @@ sectionResult, calculationScenarios, FailureMechanism); } - private static WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider CreateErrorProvider( + private static FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider CreateErrorProvider( FailureMechanismSectionResult sectionResult, IEnumerable calculationScenarios) { - return new WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider( + return new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider( sectionResult, calculationScenarios, (scenario, lineSegments) => scenario.IsSurfaceLineIntersectionWithReferenceLineInSection(lineSegments)); } Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismResultView.cs =================================================================== diff -u -rb8d023bcd60a8554c83aad12344c7d4597f946d5 -re55b0df15fe406aed1091a906aa7d9d4c5f2ae34 --- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision b8d023bcd60a8554c83aad12344c7d4597f946d5) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision e55b0df15fe406aed1091a906aa7d9d4c5f2ae34) @@ -199,14 +199,14 @@ nameof(AdoptableWithProfileProbabilityFailureMechanismSectionResultRow.AssemblyGroup)); } - private IWithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider CreateErrorProvider( + private IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider CreateErrorProvider( FailureMechanismSectionResult sectionResult, PipingScenarioConfigurationPerFailureMechanismSection scenarioConfigurationForSection) { IEnumerable> calculationScenarios = ScenarioConfigurationTypeIsSemiProbabilistic(scenarioConfigurationForSection) ? (IEnumerable>) FailureMechanism.Calculations.OfType() : FailureMechanism.Calculations.OfType(); - return new WithCalculatedProbabilityFailureMechanismSectionResultRowErrorProvider>( + return new FailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider>( sectionResult, calculationScenarios, (scenario, lineSegments) => scenario.IsSurfaceLineIntersectionWithReferenceLineInSection(lineSegments)); }