Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/PropertyClasses/RegistrationState/MacroStabilityInwardsFailureMechanismProperties.cs =================================================================== diff -u -r6a29395620a9ccb1c1e96767f8a137848ae8900a -r62c19d9cf7388d38773b99878b127b5fc5bedbdb --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/PropertyClasses/RegistrationState/MacroStabilityInwardsFailureMechanismProperties.cs (.../MacroStabilityInwardsFailureMechanismProperties.cs) (revision 6a29395620a9ccb1c1e96767f8a137848ae8900a) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/PropertyClasses/RegistrationState/MacroStabilityInwardsFailureMechanismProperties.cs (.../MacroStabilityInwardsFailureMechanismProperties.cs) (revision 62c19d9cf7388d38773b99878b127b5fc5bedbdb) @@ -35,8 +35,7 @@ private const int namePropertyIndex = 1; private const int codePropertyIndex = 2; private const int inAssemblyPropertyIndex = 3; - private const int aPropertyIndex = 4; - private const int bPropertyIndex = 5; + private const int bPropertyIndex = 4; /// /// Creates a new instance of . @@ -74,31 +73,12 @@ private static bool ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(string propertyName) { - return nameof(A).Equals(propertyName) - || nameof(B).Equals(propertyName); + return nameof(B).Equals(propertyName); } #region Length effect parameters [DynamicVisible] - [PropertyOrder(aPropertyIndex)] - [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))] - [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_A_DisplayName))] - [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_A_Description))] - public double A - { - get - { - return data.ProbabilityAssessmentInput.A; - } - set - { - data.ProbabilityAssessmentInput.A = value; - data.NotifyObservers(); - } - } - - [DynamicVisible] [PropertyOrder(bPropertyIndex)] [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))] [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_B_DisplayName))] @@ -107,7 +87,7 @@ { get { - return data.ProbabilityAssessmentInput.B; + return data.GeneralInput.B; } } Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenarioRow.cs =================================================================== diff -u -rb2effabadc11d9de1195ecde3103cb33becbb1c2 -r62c19d9cf7388d38773b99878b127b5fc5bedbdb --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenarioRow.cs (.../MacroStabilityInwardsScenarioRow.cs) (revision b2effabadc11d9de1195ecde3103cb33becbb1c2) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenarioRow.cs (.../MacroStabilityInwardsScenarioRow.cs) (revision 62c19d9cf7388d38773b99878b127b5fc5bedbdb) @@ -78,7 +78,7 @@ if (derivedOutput != null) { return Math.Min(1.0, derivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN( - failureMechanism.ProbabilityAssessmentInput.B)); + failureMechanism.GeneralInput.B)); } return double.NaN; Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/PropertyClasses/RegistrationState/MacroStabilityInwardsFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6a29395620a9ccb1c1e96767f8a137848ae8900a -r62c19d9cf7388d38773b99878b127b5fc5bedbdb --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/PropertyClasses/RegistrationState/MacroStabilityInwardsFailureMechanismPropertiesTest.cs (.../MacroStabilityInwardsFailureMechanismPropertiesTest.cs) (revision 6a29395620a9ccb1c1e96767f8a137848ae8900a) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/PropertyClasses/RegistrationState/MacroStabilityInwardsFailureMechanismPropertiesTest.cs (.../MacroStabilityInwardsFailureMechanismPropertiesTest.cs) (revision 62c19d9cf7388d38773b99878b127b5fc5bedbdb) @@ -21,12 +21,9 @@ using System; using System.ComponentModel; -using Core.Common.Base; using Core.Common.TestUtil; using Core.Gui.TestUtil; using NUnit.Framework; -using Rhino.Mocks; -using Riskeer.Common.Data.Probability; using Riskeer.MacroStabilityInwards.Data; using Riskeer.MacroStabilityInwards.Forms.PropertyClasses; using Riskeer.MacroStabilityInwards.Forms.PropertyClasses.RegistrationState; @@ -39,8 +36,7 @@ private const int namePropertyIndex = 0; private const int codePropertyIndex = 1; private const int inAssemblyPropertyIndex = 2; - private const int aPropertyIndex = 3; - private const int bPropertyIndex = 4; + private const int bPropertyIndex = 3; [Test] public void Constructor_ExpectedValues() @@ -61,9 +57,8 @@ Assert.AreEqual(failureMechanism.Code, properties.Code); Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly); - ProbabilityAssessmentInput probabilityAssessmentInput = failureMechanism.ProbabilityAssessmentInput; - Assert.AreEqual(probabilityAssessmentInput.A, properties.A); - Assert.AreEqual(probabilityAssessmentInput.B, properties.B); + GeneralMacroStabilityInwardsInput generalInput = failureMechanism.GeneralInput; + Assert.AreEqual(generalInput.B, properties.B); } [Test] @@ -80,7 +75,7 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(5, dynamicProperties.Count); + Assert.AreEqual(4, dynamicProperties.Count); const string generalCategory = "Algemeen"; const string lengthEffectCategory = "Lengte-effect"; @@ -106,12 +101,6 @@ "Geeft aan of dit faalmechanisme wordt meegenomen in de assemblage.", true); - PropertyDescriptor aProperty = dynamicProperties[aPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(aProperty, - lengthEffectCategory, - "a [-]", - "De parameter 'a' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans."); - PropertyDescriptor bProperty = dynamicProperties[bPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(bProperty, lengthEffectCategory, @@ -161,62 +150,6 @@ } [Test] - [SetCulture("nl-NL")] - [TestCase(-1)] - [TestCase(-0.1)] - [TestCase(1.1)] - [TestCase(8)] - public void A_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value) - { - // Setup - var mocks = new MockRepository(); - var observer = mocks.StrictMock(); - mocks.ReplayAll(); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - failureMechanism.Attach(observer); - - var properties = new MacroStabilityInwardsFailureMechanismProperties(failureMechanism); - - // Call - void Call() => properties.A = value; - - // Assert - const string expectedMessage = "De waarde voor 'a' moet in het bereik [0,0, 1,0] liggen."; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); - - mocks.VerifyAll(); - } - - [Test] - [TestCase(0)] - [TestCase(0.1)] - [TestCase(1)] - [TestCase(0.0000001)] - [TestCase(0.9999999)] - public void A_SetValidValue_SetsValueAndUpdatesObservers(double value) - { - // Setup - var mocks = new MockRepository(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - failureMechanism.Attach(observer); - - var properties = new MacroStabilityInwardsFailureMechanismProperties(failureMechanism); - - // Call - properties.A = value; - - // Assert - Assert.AreEqual(value, failureMechanism.ProbabilityAssessmentInput.A); - - mocks.VerifyAll(); - } - - [Test] [TestCase(true)] [TestCase(false)] public void DynamicVisibleValidationMethod_DependingOnInAssembly_ReturnExpectedVisibility(bool inAssembly) @@ -234,7 +167,6 @@ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Code))); Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.InAssembly))); - Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.A))); Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.B))); Assert.IsTrue(properties.DynamicVisibleValidationMethod(null)); Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -rb2effabadc11d9de1195ecde3103cb33becbb1c2 -r62c19d9cf7388d38773b99878b127b5fc5bedbdb --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismResultViewTest.cs (.../MacroStabilityInwardsFailureMechanismResultViewTest.cs) (revision b2effabadc11d9de1195ecde3103cb33becbb1c2) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismResultViewTest.cs (.../MacroStabilityInwardsFailureMechanismResultViewTest.cs) (revision 62c19d9cf7388d38773b99878b127b5fc5bedbdb) @@ -129,7 +129,7 @@ Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(true, cells[isRelevantIndex].Value); Assert.AreEqual(AdoptableInitialFailureMechanismResultType.Adopt, cells[initialFailureMechanismResultTypeIndex].Value); - Assert.AreEqual(probability * scenarioConfiguration.GetN(failureMechanism.ProbabilityAssessmentInput.B), + Assert.AreEqual(probability * scenarioConfiguration.GetN(failureMechanism.GeneralInput.B), cells[initialFailureMechanismResultSectionProbabilityIndex].Value); Assert.AreEqual(FailureMechanismSectionResultFurtherAnalysisType.NotNecessary, cells[furtherAnalysisTypeIndex].Value); Assert.AreEqual("-", cells[refinedSectionProbabilityIndex].FormattedValue); Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenarioRowTest.cs =================================================================== diff -u -rb2effabadc11d9de1195ecde3103cb33becbb1c2 -r62c19d9cf7388d38773b99878b127b5fc5bedbdb --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenarioRowTest.cs (.../MacroStabilityInwardsScenarioRowTest.cs) (revision b2effabadc11d9de1195ecde3103cb33becbb1c2) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenarioRowTest.cs (.../MacroStabilityInwardsScenarioRowTest.cs) (revision 62c19d9cf7388d38773b99878b127b5fc5bedbdb) @@ -117,7 +117,7 @@ // Assert DerivedMacroStabilityInwardsOutput expectedDerivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(calculation.Output, failureMechanism.GeneralInput.ModelFactor); Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability, row.FailureProbability); - Assert.AreEqual(Math.Min(1.0, expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.ProbabilityAssessmentInput.B)), + Assert.AreEqual(Math.Min(1.0, expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.GeneralInput.B)), row.SectionFailureProbability); } @@ -162,7 +162,7 @@ // Then DerivedMacroStabilityInwardsOutput expectedDerivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(calculation.Output, failureMechanism.GeneralInput.ModelFactor); Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability, row.FailureProbability); - Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.ProbabilityAssessmentInput.B), + Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.GeneralInput.B), row.SectionFailureProbability); } @@ -184,7 +184,7 @@ // Precondition DerivedMacroStabilityInwardsOutput expectedDerivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(calculation.Output, failureMechanism.GeneralInput.ModelFactor); Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability, row.FailureProbability); - Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.ProbabilityAssessmentInput.B), + Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.GeneralInput.B), row.SectionFailureProbability); // When @@ -214,7 +214,7 @@ // Precondition DerivedMacroStabilityInwardsOutput expectedDerivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(calculation.Output, failureMechanism.GeneralInput.ModelFactor); Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability, row.FailureProbability); - Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.ProbabilityAssessmentInput.B), + Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.GeneralInput.B), row.SectionFailureProbability); var random = new Random(11); @@ -229,7 +229,7 @@ // Then DerivedMacroStabilityInwardsOutput newExpectedDerivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(calculation.Output, failureMechanism.GeneralInput.ModelFactor); Assert.AreEqual(newExpectedDerivedOutput.MacroStabilityInwardsProbability, row.FailureProbability); - Assert.AreEqual(newExpectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.ProbabilityAssessmentInput.B), + Assert.AreEqual(newExpectedDerivedOutput.MacroStabilityInwardsProbability * sectionConfiguration.GetN(failureMechanism.GeneralInput.B), row.SectionFailureProbability); } }