Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj
===================================================================
diff -u -rac2591ff2b3c8bd665344f1a5ec1126e31ae2292 -rb9a1d3cdf1e58825664b0c7c2bcfff11aa48c852
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision ac2591ff2b3c8bd665344f1a5ec1126e31ae2292)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision b9a1d3cdf1e58825664b0c7c2bcfff11aa48c852)
@@ -84,6 +84,11 @@
Core.Components.Gis
False
+
+ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
+ Ringtoets.AssemblyTool.Data
+ False
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs
===================================================================
diff -u -r9fbb85cdbc3fd1dd58ae2d03dbe37fe2714d0e04 -rb9a1d3cdf1e58825664b0c7c2bcfff11aa48c852
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs (.../StabilityPointStructuresFailureMechanismSectionResultRow.cs) (revision 9fbb85cdbc3fd1dd58ae2d03dbe37fe2714d0e04)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs (.../StabilityPointStructuresFailureMechanismSectionResultRow.cs) (revision b9a1d3cdf1e58825664b0c7c2bcfff11aa48c852)
@@ -21,8 +21,11 @@
using System;
using System.ComponentModel;
+using Ringtoets.AssemblyTool.Data;
using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.TypeConverters;
using Ringtoets.Common.Forms.Views;
using Ringtoets.Common.Primitives;
@@ -39,6 +42,11 @@
private readonly StabilityPointStructuresFailureMechanism failureMechanism;
private readonly IAssessmentSection assessmentSection;
+ private FailureMechanismSectionAssemblyCategoryGroup simpleAssemblyCategoryGroup;
+ private FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup;
+ private FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup;
+ private FailureMechanismSectionAssemblyCategoryGroup combinedAssemblyCategoryGroup;
+
///
/// Creates a new instance of .
///
@@ -64,6 +72,8 @@
this.failureMechanism = failureMechanism;
this.assessmentSection = assessmentSection;
+
+ Update();
}
///
@@ -146,6 +156,56 @@
}
///
+ /// Gets the simple assembly category group.
+ ///
+ public string SimpleAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(simpleAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the detailed assembly category group.
+ ///
+ public string DetailedAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(detailedAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the tailor made assembly category group.
+ ///
+ public string TailorMadeAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(tailorMadeAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the combined assembly category group.
+ ///
+ public string CombinedAssemblyCategoryGroup
+ {
+ get
+ {
+ return FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(combinedAssemblyCategoryGroup);
+ }
+ }
+
+ ///
+ /// Gets the combined assembly probability.
+ ///
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double CombinedAssemblyProbability { get; private set; }
+
+ ///
/// Gets the of the wrapped
/// .
///
@@ -156,6 +216,79 @@
return SectionResult.Calculation;
}
- public override void Update() {}
+ public override void Update()
+ {
+ UpdateDerivedData();
+ }
+
+ private void UpdateDerivedData()
+ {
+ TryGetSimpleAssemblyCategoryGroup();
+ TryGetDetailedAssemblyCategoryGroup();
+ TryGetTailorMadeAssemblyCategoryGroup();
+ TryGetCombinedAssemblyCategoryGroup();
+ }
+
+ private void TryGetSimpleAssemblyCategoryGroup()
+ {
+ try
+ {
+ simpleAssemblyCategoryGroup = StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group;
+ }
+ catch (AssemblyException e)
+ {
+ simpleAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ }
+ }
+
+ private void TryGetDetailedAssemblyCategoryGroup()
+ {
+ try
+ {
+ detailedAssemblyCategoryGroup = StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
+ SectionResult,
+ failureMechanism,
+ assessmentSection).Group;
+ }
+ catch (AssemblyException e)
+ {
+ detailedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ }
+ }
+
+ private void TryGetTailorMadeAssemblyCategoryGroup()
+ {
+ try
+ {
+ tailorMadeAssemblyCategoryGroup = StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssembly(
+ SectionResult,
+ failureMechanism,
+ assessmentSection).Group;
+ }
+ catch (AssemblyException e)
+ {
+ tailorMadeAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ }
+ }
+
+ private void TryGetCombinedAssemblyCategoryGroup()
+ {
+ try
+ {
+ FailureMechanismSectionAssembly combinedAssembly =
+ StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssembly(
+ SectionResult,
+ failureMechanism,
+ assessmentSection);
+
+ combinedAssemblyCategoryGroup = combinedAssembly.Group;
+ CombinedAssemblyProbability = combinedAssembly.Probability;
+ }
+ catch (AssemblyException e)
+ {
+ combinedAssemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.None;
+ CombinedAssemblyProbability = double.NaN;
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj
===================================================================
diff -u -r7af42667c0a4cd9f2521bd5118225dbf024454a1 -rb9a1d3cdf1e58825664b0c7c2bcfff11aa48c852
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision 7af42667c0a4cd9f2521bd5118225dbf024454a1)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision b9a1d3cdf1e58825664b0c7c2bcfff11aa48c852)
@@ -73,6 +73,18 @@
{318BA582-88C9-4816-A54A-A7E431461DE3}
Core.Components.Gis
+
+ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
+ Ringtoets.AssemblyTool.Data
+
+
+ {358B6DA2-A1DF-477F-B6AC-C30204265CB0}
+ Ringtoets.AssemblyTool.KernelWrapper
+
+
+ {0AB432BB-E2CC-42EA-A72C-7AFEF7536B38}
+ Ringtoets.AssemblyTool.KernelWrapper.TestUtil
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -r238bf704788e704cba7b7fd64590a10ca9050227 -rb9a1d3cdf1e58825664b0c7c2bcfff11aa48c852
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision 238bf704788e704cba7b7fd64590a10ca9050227)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision b9a1d3cdf1e58825664b0c7c2bcfff11aa48c852)
@@ -24,11 +24,16 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.TypeConverters;
using Ringtoets.Common.Forms.Views;
using Ringtoets.Common.Primitives;
@@ -41,7 +46,7 @@
public class StabilityPointStructuresFailureMechanismSectionResultRowTest
{
[Test]
- public void Constructor_WithParameters_ExpectedValues()
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
{
// Setup
var mocks = new MockRepository();
@@ -51,60 +56,174 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
-
// Call
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
+ TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(result, null, assessmentSection);
// Assert
- Assert.IsInstanceOf>(row);
- Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult);
- Assert.AreEqual(result.GetDetailedAssessmentProbability(failureMechanism, assessmentSection), row.DetailedAssessmentProbability);
- Assert.AreEqual(row.TailorMadeAssessmentProbability, result.TailorMadeAssessmentProbability);
-
- TestHelper.AssertTypeConverter(
- nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability));
- TestHelper.AssertTypeConverter(
- nameof(StabilityPointStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability));
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
mocks.VerifyAll();
}
[Test]
- public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
// Call
- TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(result, null, assessmentSection);
+ TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(
+ result, new StabilityPointStructuresFailureMechanism(), null);
// Assert
var exception = Assert.Throws(call);
- Assert.AreEqual("failureMechanism", exception.ParamName);
- mocks.VerifyAll();
+ Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
- public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ public void Constructor_WithParameters_ExpectedValues()
{
// Setup
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
// Call
- TestDelegate call = () => new StabilityPointStructuresFailureMechanismSectionResultRow(
- result, new StabilityPointStructuresFailureMechanism(), null);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("assessmentSection", exception.ParamName);
+ // Assert
+ Assert.IsInstanceOf>(row);
+ Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult);
+ Assert.AreEqual(result.DetailedAssessmentResult, row.DetailedAssessmentResult);
+ Assert.AreEqual(result.GetDetailedAssessmentProbability(failureMechanism, assessmentSection), row.DetailedAssessmentProbability);
+ Assert.AreEqual(result.TailorMadeAssessmentResult, row.TailorMadeAssessmentResult);
+ Assert.AreEqual(row.TailorMadeAssessmentProbability, result.TailorMadeAssessmentProbability);
+
+ TestHelper.AssertTypeConverter(
+ nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability));
+ TestHelper.AssertTypeConverter(
+ nameof(StabilityPointStructuresFailureMechanismSectionResultRow.TailorMadeAssessmentProbability));
+ TestHelper.AssertTypeConverter(
+ nameof(StabilityPointStructuresFailureMechanismSectionResultRow.CombinedAssemblyProbability));
+ mocks.VerifyAll();
+ }
}
+ [Test]
+ public void Constructor_AssemblyRan_ReturnCategoryGroups()
+ {
+ // Setup
+ var random = new Random(39);
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ // Call
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.SimpleAssessmentAssemblyOutput.Group),
+ row.SimpleAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.DetailedAssessmentAssemblyOutput.Group),
+ row.DetailedAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.TailorMadeAssessmentAssemblyOutput.Group),
+ row.TailorMadeAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.CombinedAssemblyOutput.Group),
+ row.CombinedAssemblyCategoryGroup);
+ Assert.AreEqual(calculator.CombinedAssemblyOutput.Probability, row.CombinedAssemblyProbability);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void GivenRowWithoutAssemblyErrors_WhenUpdatingAndAssemblyThrowsException_ThenAssemblyGroupSetToNone()
+ {
+ // Given
+ var random = new Random(39);
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ calculator.CombinedAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
+
+ // Precondition
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.SimpleAssessmentAssemblyOutput.Group),
+ row.SimpleAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.DetailedAssessmentAssemblyOutput.Group),
+ row.DetailedAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.TailorMadeAssessmentAssemblyOutput.Group),
+ row.TailorMadeAssemblyCategoryGroup);
+ Assert.AreEqual(FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(calculator.CombinedAssemblyOutput.Group),
+ row.CombinedAssemblyCategoryGroup);
+ Assert.AreEqual(calculator.CombinedAssemblyOutput.Probability, row.CombinedAssemblyProbability);
+
+ // When
+ calculator.ThrowExceptionOnCalculate = true;
+ row.SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.Applicable;
+
+ // Then
+ string expectedAssemblyDisplayName = FailureMechanismSectionResultRowHelper.GetCategoryGroupDisplayname(FailureMechanismSectionAssemblyCategoryGroup.None);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.SimpleAssemblyCategoryGroup);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.DetailedAssemblyCategoryGroup);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.TailorMadeAssemblyCategoryGroup);
+ Assert.AreEqual(expectedAssemblyDisplayName, row.CombinedAssemblyCategoryGroup);
+ Assert.IsNaN(row.CombinedAssemblyProbability);
+
+ mocks.VerifyAll();
+ }
+ }
+
#region Registration
[Test]
@@ -126,16 +245,19 @@
var newValue = new Random(21).NextEnumValue();
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result,
- failureMechanism,
- assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result,
+ failureMechanism,
+ assessmentSection);
- // Call
- row.SimpleAssessmentResult = newValue;
+ // Call
+ row.SimpleAssessmentResult = newValue;
- // Assert
- Assert.AreEqual(newValue, result.SimpleAssessmentResult);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreEqual(newValue, result.SimpleAssessmentResult);
+ mocks.VerifyAll();
+ }
}
[Test]
@@ -157,41 +279,47 @@
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
result.Attach(observer);
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
- result, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
+ result, failureMechanism, assessmentSection);
- // Call
- row.DetailedAssessmentResult = newValue;
+ // Call
+ row.DetailedAssessmentResult = newValue;
- // Assert
- Assert.AreEqual(newValue, result.DetailedAssessmentResult);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreEqual(newValue, result.DetailedAssessmentResult);
+ mocks.VerifyAll();
+ }
}
[Test]
public void DetailedAssessmentProbability_NoCalculationSet_ReturnNaN()
{
// Setup
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
-
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(section);
// Precondition
Assert.IsNull(sectionResult.Calculation);
- var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection);
- // Call
- double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
+ // Call
+ double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
- // Assert
- Assert.IsNaN(detailedAssessmentProbability);
- mocks.VerifyAll();
+ // Assert
+ Assert.IsNaN(detailedAssessmentProbability);
+ mocks.VerifyAll();
+ }
}
[Test]
@@ -218,14 +346,17 @@
Calculation = calculation
};
- var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection);
- // Call
- double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
+ // Call
+ double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
- // Assert
- Assert.IsNaN(detailedAssessmentProbability);
- mocks.VerifyAll();
+ // Assert
+ Assert.IsNaN(detailedAssessmentProbability);
+ mocks.VerifyAll();
+ }
}
[Test]
@@ -249,14 +380,17 @@
Calculation = calculation
};
- var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection);
- // Call
- double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
+ // Call
+ double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
- // Assert
- Assert.AreEqual(0.17105612630848185, detailedAssessmentProbability);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreEqual(0.17105612630848185, detailedAssessmentProbability);
+ mocks.VerifyAll();
+ }
}
[Test]
@@ -278,15 +412,18 @@
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
result.Attach(observer);
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
- result, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
+ result, failureMechanism, assessmentSection);
- // Call
- row.TailorMadeAssessmentResult = newValue;
+ // Call
+ row.TailorMadeAssessmentResult = newValue;
- // Assert
- Assert.AreEqual(newValue, result.TailorMadeAssessmentResult);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreEqual(newValue, result.TailorMadeAssessmentResult);
+ mocks.VerifyAll();
+ }
}
[Test]
@@ -310,15 +447,18 @@
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
result.Attach(observer);
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
- result, new StabilityPointStructuresFailureMechanism(), assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
+ result, new StabilityPointStructuresFailureMechanism(), assessmentSection);
- // Call
- row.TailorMadeAssessmentProbability = value;
+ // Call
+ row.TailorMadeAssessmentProbability = value;
- // Assert
- Assert.AreEqual(value, row.TailorMadeAssessmentProbability);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreEqual(value, row.TailorMadeAssessmentProbability);
+ mocks.VerifyAll();
+ }
}
[Test]
@@ -339,16 +479,19 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
- result, new StabilityPointStructuresFailureMechanism(), assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(
+ result, new StabilityPointStructuresFailureMechanism(), assessmentSection);
- // Call
- TestDelegate test = () => row.TailorMadeAssessmentProbability = value;
+ // Call
+ TestDelegate test = () => row.TailorMadeAssessmentProbability = value;
- // Assert
- const string expectedMessage = "De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- mocks.VerifyAll();
+ // Assert
+ const string expectedMessage = "De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ mocks.VerifyAll();
+ }
}
#endregion
@@ -357,38 +500,41 @@
public void GetSectionResultCalculation_NoCalculationSetOnSectionResult_ReturnNull()
{
// Setup
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
-
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var result = new StabilityPointStructuresFailureMechanismSectionResult(section);
// Precondition
Assert.IsNull(result.Calculation);
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
- // Call
- StructuresCalculation calculation = row.GetSectionResultCalculation();
+ // Call
+ StructuresCalculation calculation = row.GetSectionResultCalculation();
- // Assert
- Assert.IsNull(calculation);
- mocks.VerifyAll();
+ // Assert
+ Assert.IsNull(calculation);
+ mocks.VerifyAll();
+ }
}
[Test]
public void GetSectionResultCalculation_WithCalculationSetOnSectionResult_ReturnCalculation()
{
// Setup
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
-
var expectedCalculation = new StructuresCalculation();
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
@@ -397,14 +543,17 @@
Calculation = expectedCalculation
};
- var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var row = new StabilityPointStructuresFailureMechanismSectionResultRow(result, failureMechanism, assessmentSection);
- // Call
- StructuresCalculation calculation = row.GetSectionResultCalculation();
+ // Call
+ StructuresCalculation calculation = row.GetSectionResultCalculation();
- // Assert
- Assert.AreSame(expectedCalculation, calculation);
- mocks.VerifyAll();
+ // Assert
+ Assert.AreSame(expectedCalculation, calculation);
+ mocks.VerifyAll();
+ }
}
}
}
\ No newline at end of file