Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Data.TestUtil/ClosingStructuresCalculationScenarioTestFactory.cs
===================================================================
diff -u -r5c844b9b5e82d13f5e471d72c9b081921003e6c6 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Data.TestUtil/ClosingStructuresCalculationScenarioTestFactory.cs (.../ClosingStructuresCalculationScenarioTestFactory.cs) (revision 5c844b9b5e82d13f5e471d72c9b081921003e6c6)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Data.TestUtil/ClosingStructuresCalculationScenarioTestFactory.cs (.../ClosingStructuresCalculationScenarioTestFactory.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -33,7 +33,7 @@
public static class ClosingStructuresCalculationScenarioTestFactory
{
///
- /// Creates a calculated scenario for which the surface line on the input intersects with .
+ /// Creates a calculated scenario for which the structure on the input intersects with .
///
/// The section for which an intersection will be created.
/// A new .
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs
===================================================================
diff -u -rd3b94aacb873473ebe92d56b4e48341bf4b26412 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs (.../ClosingStructuresInputContextPropertiesTest.cs) (revision d3b94aacb873473ebe92d56b4e48341bf4b26412)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresInputContextPropertiesTest.cs (.../ClosingStructuresInputContextPropertiesTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -22,10 +22,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using Core.Common.Base;
using Core.Common.Base.Data;
-using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -35,7 +33,6 @@
using Riskeer.ClosingStructures.Forms.PropertyClasses;
using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.DikeProfiles;
-using Riskeer.Common.Data.FailureMechanism;
using Riskeer.Common.Data.Structures;
using Riskeer.Common.Data.TestUtil;
using Riskeer.Common.Forms.PresentationObjects;
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -rb0364f30bec4e8168154687679c725e43ba0cc65 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs (.../ClosingStructuresFailureMechanismSectionResultRowTest.cs) (revision b0364f30bec4e8168154687679c725e43ba0cc65)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs (.../ClosingStructuresFailureMechanismSectionResultRowTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -716,7 +716,7 @@
[Test]
[TestCase(SimpleAssessmentResultType.None)]
[TestCase(SimpleAssessmentResultType.AssessFurther)]
- public void Constructor_TotalContributionNotHundred_DetailedAssessmentProbabilityHasErrorText(
+ public void Constructor_TotalContributionNotOne_DetailedAssessmentProbabilityHasErrorText(
SimpleAssessmentResultType simpleAssessmentResult)
{
// Setup
@@ -1192,7 +1192,7 @@
}
[Test]
- public void DetailedAssessmentProbability_NoCalculationSet_ReturnNaN()
+ public void DetailedAssessmentProbability_CalculationScenarioWithoutOutput_ReturnNaN()
{
// Setup
var failureMechanism = new ClosingStructuresFailureMechanism();
@@ -1204,34 +1204,6 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var sectionResult = new ClosingStructuresFailureMechanismSectionResult(section);
- using (new AssemblyToolCalculatorFactoryConfig())
- {
- var resultRow = new ClosingStructuresFailureMechanismSectionResultRow(
- sectionResult, Enumerable.Empty>(),
- failureMechanism, assessmentSection, ConstructionProperties);
-
- // Call
- double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability;
-
- // Assert
- Assert.IsNaN(detailedAssessmentProbability);
- mocks.VerifyAll();
- }
- }
-
- [Test]
- public void DetailedAssessmentProbability_CalculationWithoutOutput_ReturnNaN()
- {
- // Setup
- var failureMechanism = new ClosingStructuresFailureMechanism();
-
- var mocks = new MockRepository();
- IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
- mocks.ReplayAll();
-
- FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
- var sectionResult = new ClosingStructuresFailureMechanismSectionResult(section);
-
StructuresCalculationScenario[] calculationScenarios =
{
ClosingStructuresCalculationScenarioTestFactory.CreateNotCalculatedClosingStructuresCalculationScenario(section)
@@ -1252,7 +1224,7 @@
}
[Test]
- public void DetailedAssessmentProbability_CalculationWithNaNOutput_ReturnNaN()
+ public void DetailedAssessmentProbability_CalculationScenarioWithNaNOutput_ReturnNaN()
{
// Setup
var failureMechanism = new ClosingStructuresFailureMechanism();
@@ -1289,7 +1261,7 @@
}
[Test]
- public void DetailedAssessmentProbability_CalculationSuccessful_ReturnDetailedAssessmentProbability()
+ public void DetailedAssessmentProbability_CalculationScenarioSuccessful_ReturnDetailedAssessmentProbability()
{
// Setup
var failureMechanism = new ClosingStructuresFailureMechanism();
Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs
===================================================================
diff -u -r822617da9d315fb1ee30a0a3861f53be154d6371 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs (.../FailureMechanismSectionResultRowHelperTest.cs) (revision 822617da9d315fb1ee30a0a3861f53be154d6371)
+++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs (.../FailureMechanismSectionResultRowHelperTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -106,7 +106,7 @@
}
[Test]
- public void GetDetailedAssessmentProbabilityError_TotalContributionNotHundred_ReturnsErrorMessage()
+ public void GetDetailedAssessmentProbabilityError_TotalContributionNotOne_ReturnsErrorMessage()
{
// Setup
var mocks = new MockRepository();
Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -r72b45a85229ead7e8b748fa28047a73123059f51 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision 72b45a85229ead7e8b748fa28047a73123059f51)
+++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -720,7 +720,7 @@
[Test]
[TestCase(SimpleAssessmentValidityOnlyResultType.None)]
[TestCase(SimpleAssessmentValidityOnlyResultType.Applicable)]
- public void Constructor_TotalContributionNotHundred_DetailedAssessmentProbabilityHasErrorText(
+ public void Constructor_TotalContributionNotOne_DetailedAssessmentProbabilityHasErrorText(
SimpleAssessmentValidityOnlyResultType simpleAssessmentResult)
{
// Setup
Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs
===================================================================
diff -u -r168c742c76779963c6698233953919b330b0f7a6 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision 168c742c76779963c6698233953919b330b0f7a6)
+++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -44,8 +44,9 @@
/// All calculation scenarios in the failure mechanism.
/// The failure mechanism the section result belongs to.
/// The assessment section the section result belongs to.
- /// The calculated detailed assessment probability; or when there is no
- /// calculation assigned to the section result or the calculation is not performed.
+ /// The calculated detailed assessment probability; or when there
+ /// are no relevant calculations, when not all relevant calculations are performed or when the
+ /// contribution of the relevant calculations don't add up to 1.
/// Thrown when any parameter is null.
public static double GetDetailedAssessmentProbability(this HeightStructuresFailureMechanismSectionResult sectionResult,
IEnumerable> calculationScenarios,
Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs
===================================================================
diff -u -r289960cdf6a56b45aac35607377bdee0cc98abeb -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 289960cdf6a56b45aac35607377bdee0cc98abeb)
+++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -325,10 +325,7 @@
try
{
detailedAssemblyCategoryGroup = HeightStructuresFailureMechanismAssemblyFactory.AssembleDetailedAssessment(
- SectionResult,
- failureMechanism.Calculations.Cast>(),
- failureMechanism,
- assessmentSection).Group;
+ SectionResult, calculationScenarios, failureMechanism, assessmentSection).Group;
}
catch (AssemblyException e)
{
@@ -342,9 +339,7 @@
try
{
tailorMadeAssemblyCategoryGroup = HeightStructuresFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(
- SectionResult,
- failureMechanism,
- assessmentSection).Group;
+ SectionResult, failureMechanism, assessmentSection).Group;
}
catch (AssemblyException e)
{
@@ -359,10 +354,7 @@
{
FailureMechanismSectionAssembly combinedAssembly =
HeightStructuresFailureMechanismAssemblyFactory.AssembleCombinedAssessment(
- SectionResult,
- failureMechanism.Calculations.Cast>(),
- failureMechanism,
- assessmentSection);
+ SectionResult, calculationScenarios, failureMechanism, assessmentSection);
combinedAssemblyCategoryGroup = combinedAssembly.Group;
CombinedAssemblyProbability = combinedAssembly.Probability;
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil/HeightStructuresCalculationScenarioTestFactory.cs
===================================================================
diff -u -rf31ac9c417b65b2d572a51434670a7baf7c27ce8 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil/HeightStructuresCalculationScenarioTestFactory.cs (.../HeightStructuresCalculationScenarioTestFactory.cs) (revision f31ac9c417b65b2d572a51434670a7baf7c27ce8)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil/HeightStructuresCalculationScenarioTestFactory.cs (.../HeightStructuresCalculationScenarioTestFactory.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -33,7 +33,7 @@
public static class HeightStructuresCalculationScenarioTestFactory
{
///
- /// Creates a calculated scenario for which the surface line on the input intersects with .
+ /// Creates a calculated scenario for which the structure on the input intersects with .
///
/// The section for which an intersection will be created.
/// A new .
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs
===================================================================
diff -u -rdd054e7fbf79e4df138d9ba5b87f2ab81e4d2330 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision dd054e7fbf79e4df138d9ba5b87f2ab81e4d2330)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -22,16 +22,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using Core.Common.Base;
using Core.Common.Base.Data;
-using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.DikeProfiles;
-using Riskeer.Common.Data.FailureMechanism;
using Riskeer.Common.Data.Structures;
using Riskeer.Common.Data.TestUtil;
using Riskeer.Common.Forms.PresentationObjects;
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -rb81a6c6bad9aa12a1e78fb4c0058612225f24216 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision b81a6c6bad9aa12a1e78fb4c0058612225f24216)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -673,7 +673,7 @@
[Test]
[TestCase(SimpleAssessmentResultType.None)]
[TestCase(SimpleAssessmentResultType.AssessFurther)]
- public void Constructor_TotalContributionNotHundred_DetailedAssessmentProbabilityHasErrorText(
+ public void Constructor_TotalContributionNotOne_DetailedAssessmentProbabilityHasErrorText(
SimpleAssessmentResultType simpleAssessmentResult)
{
// Setup
@@ -1151,7 +1151,7 @@
}
[Test]
- public void DetailedAssessmentProbability_CalculationWithoutOutput_ReturnNaN()
+ public void DetailedAssessmentProbability_CalculationScenarioWithoutOutput_ReturnNaN()
{
// Setup
var failureMechanism = new HeightStructuresFailureMechanism();
@@ -1183,7 +1183,7 @@
}
[Test]
- public void DetailedAssessmentProbability_CalculationWithNaNOutput_ReturnNaN()
+ public void DetailedAssessmentProbability_CalculationScenarioWithNaNOutput_ReturnNaN()
{
// Setup
var failureMechanism = new HeightStructuresFailureMechanism();
@@ -1220,7 +1220,7 @@
}
[Test]
- public void DetailedAssessmentProbability_CalculationSuccessful_ReturnDetailedAssessmentProbability()
+ public void DetailedAssessmentProbability_CalculationScenarioSuccessful_ReturnDetailedAssessmentProbability()
{
// Setup
var failureMechanism = new HeightStructuresFailureMechanism();
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Plugin.Test/FileImporters/HeightStructureUpdateDataStrategyTest.cs
===================================================================
diff -u -rd6537c7341346ca27309e5fa46b5a12974d647fe -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Plugin.Test/FileImporters/HeightStructureUpdateDataStrategyTest.cs (.../HeightStructureUpdateDataStrategyTest.cs) (revision d6537c7341346ca27309e5fa46b5a12974d647fe)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Plugin.Test/FileImporters/HeightStructureUpdateDataStrategyTest.cs (.../HeightStructureUpdateDataStrategyTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -46,11 +46,11 @@
public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new HeightStructureUpdateDataStrategy(null);
+ void Call() => new HeightStructureUpdateDataStrategy(null);
// Assert
- string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("failureMechanism", paramName);
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
}
[Test]
@@ -74,12 +74,11 @@
var strategy = new HeightStructureUpdateDataStrategy(new HeightStructuresFailureMechanism());
// Call
- TestDelegate test = () => strategy.UpdateStructuresWithImportedData(null,
- string.Empty);
+ void Call() => strategy.UpdateStructuresWithImportedData(null, string.Empty);
// Assert
- string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("importedDataCollection", paramName);
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("importedDataCollection", exception.ParamName);
}
[Test]
@@ -89,12 +88,11 @@
var strategy = new HeightStructureUpdateDataStrategy(new HeightStructuresFailureMechanism());
// Call
- TestDelegate test = () => strategy.UpdateStructuresWithImportedData(Enumerable.Empty(),
- null);
+ void Call() => strategy.UpdateStructuresWithImportedData(Enumerable.Empty(), null);
// Assert
- string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("sourceFilePath", paramName);
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("sourceFilePath", exception.ParamName);
}
[Test]
@@ -112,11 +110,10 @@
var strategy = new HeightStructureUpdateDataStrategy(new HeightStructuresFailureMechanism());
// Call
- TestDelegate call = () => strategy.UpdateStructuresWithImportedData(readStructures,
- sourceFilePath);
+ void Call() => strategy.UpdateStructuresWithImportedData(readStructures, sourceFilePath);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(Call);
const string expectedMessage = "Geïmporteerde data moet unieke elementen bevatten.";
Assert.AreEqual(expectedMessage, exception.Message);
@@ -148,11 +145,10 @@
var strategy = new HeightStructureUpdateDataStrategy(new HeightStructuresFailureMechanism());
// Call
- TestDelegate call = () => strategy.UpdateStructuresWithImportedData(readStructures,
- sourceFilePath);
+ void Call() => strategy.UpdateStructuresWithImportedData(readStructures, sourceFilePath);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(Call);
const string expectedMessage = "Geïmporteerde data moet unieke elementen bevatten.";
Assert.AreEqual(expectedMessage, exception.Message);
@@ -561,6 +557,177 @@
}, affectedObjects);
}
+ [Test]
+ public void UpdateStructuresWithImportedData_CalculationWithSameReference_OnlyReturnsDistinctCalculationInput()
+ {
+ // Setup
+ const string affectedId = "affectedId";
+ var affectedStructure = new TestHeightStructure(affectedId, "Old name");
+ var affectedCalculation = new TestHeightStructuresCalculationScenario
+ {
+ InputParameters =
+ {
+ Structure = affectedStructure
+ },
+ Output = new TestStructuresOutput()
+ };
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ affectedCalculation,
+ affectedCalculation
+ }
+ }
+ };
+
+ StructureCollection structures = failureMechanism.HeightStructures;
+ structures.AddRange(new[]
+ {
+ affectedStructure
+ }, sourceFilePath);
+
+ var structureToUpdateFrom = new TestHeightStructure(affectedId, "New name");
+
+ var strategy = new HeightStructureUpdateDataStrategy(failureMechanism);
+
+ // Call
+ IEnumerable affectedObjects = strategy.UpdateStructuresWithImportedData(new[]
+ {
+ structureToUpdateFrom
+ }, sourceFilePath);
+ // Assert
+ CollectionAssert.AreEquivalent(new IObservable[]
+ {
+ structures,
+ affectedStructure,
+ affectedCalculation.InputParameters
+ }, affectedObjects);
+ }
+
+ [Test]
+ public void UpdateStructuresWithImportedData_SectionResultWithStructureImportedStructureWithSameId_UpdatesCalculationInput()
+ {
+ // Setup
+ const string sameId = "sameId";
+ var originalMatchingPoint = new Point2D(0, 0);
+ var updatedMatchingPoint = new Point2D(20, 20);
+ HeightStructure readStructure = new TestHeightStructure(updatedMatchingPoint, sameId);
+ HeightStructure structure = new TestHeightStructure(originalMatchingPoint, sameId);
+
+ var calculation = new TestHeightStructuresCalculationScenario
+ {
+ InputParameters =
+ {
+ Structure = structure
+ }
+ };
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ calculation
+ }
+ }
+ };
+ failureMechanism.HeightStructures.AddRange(new[]
+ {
+ structure
+ }, sourceFilePath);
+
+ var intersectionPoint = new Point2D(10, 10);
+ FailureMechanismTestHelper.SetSections(failureMechanism, new[]
+ {
+ new FailureMechanismSection("OldSection", new[]
+ {
+ originalMatchingPoint,
+ intersectionPoint
+ }),
+ new FailureMechanismSection("NewSection", new[]
+ {
+ intersectionPoint,
+ updatedMatchingPoint
+ })
+ });
+
+ var strategy = new HeightStructureUpdateDataStrategy(failureMechanism);
+
+ // Call
+ IEnumerable affectedObjects = strategy.UpdateStructuresWithImportedData(new[]
+ {
+ readStructure
+ },
+ sourceFilePath);
+
+ // Assert
+ AssertHeightStructures(readStructure, structure);
+
+ CollectionAssert.AreEqual(new IObservable[]
+ {
+ failureMechanism.HeightStructures,
+ structure,
+ calculation.InputParameters,
+ }, affectedObjects);
+ }
+
+ [Test]
+ public void UpdateStructuresWithImportedData_SectionResultWithStructureImportedStructureWithSameIdRemoved_UpdatesCalculationInput()
+ {
+ // Setup
+ const string sameId = "id";
+ var originalMatchingPoint = new Point2D(0, 0);
+ HeightStructure removedStructure = new TestHeightStructure(originalMatchingPoint, sameId);
+
+ var calculation = new TestHeightStructuresCalculationScenario
+ {
+ InputParameters =
+ {
+ Structure = removedStructure
+ }
+ };
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ calculation
+ }
+ }
+ };
+ failureMechanism.HeightStructures.AddRange(new[]
+ {
+ removedStructure
+ }, sourceFilePath);
+
+ FailureMechanismTestHelper.SetSections(failureMechanism, new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ originalMatchingPoint,
+ new Point2D(10, 10)
+ })
+ });
+
+ var strategy = new HeightStructureUpdateDataStrategy(failureMechanism);
+
+ // Call
+ IEnumerable affectedObjects = strategy.UpdateStructuresWithImportedData(Enumerable.Empty(),
+ sourceFilePath);
+
+ // Assert
+ CollectionAssert.AreEqual(new IObservable[]
+ {
+ failureMechanism.HeightStructures,
+ calculation.InputParameters,
+ }, affectedObjects);
+ }
+
private static void AssertHeightStructures(HeightStructure readStructure, HeightStructure structure)
{
Assert.AreEqual(readStructure.Name, structure.Name);
Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -rd0baf43e46fa2758efcffe064cc960188ef64362 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs) (revision d0baf43e46fa2758efcffe064cc960188ef64362)
+++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -718,7 +718,7 @@
[Test]
[TestCase(SimpleAssessmentResultType.None)]
[TestCase(SimpleAssessmentResultType.AssessFurther)]
- public void Constructor_TotalContributionNotHundred_DetailedAssessmentProbabilityHasErrorText(
+ public void Constructor_TotalContributionNotOne_DetailedAssessmentProbabilityHasErrorText(
SimpleAssessmentResultType simpleAssessmentResult)
{
// Setup
Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -rd0baf43e46fa2758efcffe064cc960188ef64362 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision d0baf43e46fa2758efcffe064cc960188ef64362)
+++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -718,7 +718,7 @@
[Test]
[TestCase(SimpleAssessmentResultType.None)]
[TestCase(SimpleAssessmentResultType.AssessFurther)]
- public void Constructor_TotalContributionNotHundred_DetailedAssessmentProbabilityHasErrorText(
+ public void Constructor_TotalContributionNotOne_DetailedAssessmentProbabilityHasErrorText(
SimpleAssessmentResultType simpleAssessmentResult)
{
// Setup
Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs
===================================================================
diff -u -rdd054e7fbf79e4df138d9ba5b87f2ab81e4d2330 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs (.../StabilityPointStructuresInputContextPropertiesTest.cs) (revision dd054e7fbf79e4df138d9ba5b87f2ab81e4d2330)
+++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresInputContextPropertiesTest.cs (.../StabilityPointStructuresInputContextPropertiesTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -22,10 +22,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using Core.Common.Base;
using Core.Common.Base.Data;
-using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
Index: Riskeer/Storage/src/Riskeer.Storage.Core/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensions.cs
===================================================================
diff -u -r6a22c0bc4da3805d6e2ca60f6c89de919a340453 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/src/Riskeer.Storage.Core/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensions.cs (.../ClosingStructuresFailureMechanismSectionResultCreateExtensions.cs) (revision 6a22c0bc4da3805d6e2ca60f6c89de919a340453)
+++ Riskeer/Storage/src/Riskeer.Storage.Core/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensions.cs (.../ClosingStructuresFailureMechanismSectionResultCreateExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -37,7 +37,7 @@
///
/// The result to create a database entity for.
/// A new .
- /// Thrown when any parameter is null.
+ /// Thrown when is null.
internal static ClosingStructuresSectionResultEntity Create(this ClosingStructuresFailureMechanismSectionResult result)
{
if (result == null)
Index: Riskeer/Storage/src/Riskeer.Storage.Core/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs
===================================================================
diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/src/Riskeer.Storage.Core/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea)
+++ Riskeer/Storage/src/Riskeer.Storage.Core/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -59,7 +59,7 @@
{
foreach (HeightStructuresFailureMechanismSectionResult failureMechanismSectionResult in sectionResults)
{
- HeightStructuresSectionResultEntity sectionResultEntity = failureMechanismSectionResult.Create(registry);
+ HeightStructuresSectionResultEntity sectionResultEntity = failureMechanismSectionResult.Create();
FailureMechanismSectionEntity section = registry.Get(failureMechanismSectionResult.Section);
section.HeightStructuresSectionResultEntities.Add(sectionResultEntity);
}
Index: Riskeer/Storage/src/Riskeer.Storage.Core/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs
===================================================================
diff -u -rb81a6c6bad9aa12a1e78fb4c0058612225f24216 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/src/Riskeer.Storage.Core/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs (.../HeightStructuresFailureMechanismSectionResultCreateExtensions.cs) (revision b81a6c6bad9aa12a1e78fb4c0058612225f24216)
+++ Riskeer/Storage/src/Riskeer.Storage.Core/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs (.../HeightStructuresFailureMechanismSectionResultCreateExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -36,22 +36,15 @@
/// .
///
/// The result to create a database entity for.
- /// The object keeping track of create operations.
/// A new .
- /// Thrown when any parameter is null.
- internal static HeightStructuresSectionResultEntity Create(this HeightStructuresFailureMechanismSectionResult result,
- PersistenceRegistry registry)
+ /// Thrown when is null.
+ internal static HeightStructuresSectionResultEntity Create(this HeightStructuresFailureMechanismSectionResult result)
{
if (result == null)
{
throw new ArgumentNullException(nameof(result));
}
- if (registry == null)
- {
- throw new ArgumentNullException(nameof(registry));
- }
-
return new HeightStructuresSectionResultEntity
{
SimpleAssessmentResult = Convert.ToByte(result.SimpleAssessmentResult),
Index: Riskeer/Storage/src/Riskeer.Storage.Core/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensions.cs
===================================================================
diff -u -r6a22c0bc4da3805d6e2ca60f6c89de919a340453 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/src/Riskeer.Storage.Core/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensions.cs (.../ClosingStructuresSectionResultEntityReadExtensions.cs) (revision 6a22c0bc4da3805d6e2ca60f6c89de919a340453)
+++ Riskeer/Storage/src/Riskeer.Storage.Core/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensions.cs (.../ClosingStructuresSectionResultEntityReadExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -39,11 +39,9 @@
/// The used to update
/// the .
/// The target of the read operation.
- /// The object keeping track of read operations.
/// Thrown when any input parameter is null.
internal static void Read(this ClosingStructuresSectionResultEntity entity,
- ClosingStructuresFailureMechanismSectionResult sectionResult,
- ReadConversionCollector collector)
+ ClosingStructuresFailureMechanismSectionResult sectionResult)
{
if (entity == null)
{
@@ -55,11 +53,6 @@
throw new ArgumentNullException(nameof(sectionResult));
}
- if (collector == null)
- {
- throw new ArgumentNullException(nameof(collector));
- }
-
sectionResult.SimpleAssessmentResult = (SimpleAssessmentResultType) entity.SimpleAssessmentResult;
sectionResult.DetailedAssessmentResult = (DetailedAssessmentProbabilityOnlyResultType) entity.DetailedAssessmentResult;
sectionResult.TailorMadeAssessmentResult = (TailorMadeAssessmentProbabilityCalculationResultType) entity.TailorMadeAssessmentResult;
Index: Riskeer/Storage/src/Riskeer.Storage.Core/Read/FailureMechanismEntityReadExtensions.cs
===================================================================
diff -u -ra82de779411871f94577f314a476b276990f135a -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/src/Riskeer.Storage.Core/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision a82de779411871f94577f314a476b276990f135a)
+++ Riskeer/Storage/src/Riskeer.Storage.Core/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -293,7 +293,7 @@
FailureMechanismSection failureMechanismSection = collector.Get(sectionResultEntity.FailureMechanismSectionEntity);
HeightStructuresFailureMechanismSectionResult result = failureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection));
- sectionResultEntity.Read(result, collector);
+ sectionResultEntity.Read(result);
}
}
@@ -461,7 +461,7 @@
FailureMechanismSection failureMechanismSection = collector.Get(sectionResultEntity.FailureMechanismSectionEntity);
ClosingStructuresFailureMechanismSectionResult result = failureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection));
- sectionResultEntity.Read(result, collector);
+ sectionResultEntity.Read(result);
}
}
Index: Riskeer/Storage/src/Riskeer.Storage.Core/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensions.cs
===================================================================
diff -u -rb81a6c6bad9aa12a1e78fb4c0058612225f24216 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/src/Riskeer.Storage.Core/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensions.cs (.../HeightStructuresSectionResultEntityReadExtensions.cs) (revision b81a6c6bad9aa12a1e78fb4c0058612225f24216)
+++ Riskeer/Storage/src/Riskeer.Storage.Core/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensions.cs (.../HeightStructuresSectionResultEntityReadExtensions.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -39,12 +39,10 @@
/// The used to
/// update the .
/// The target of the read operation.
- /// The object keeping track of read operations.
/// A new .
/// Thrown when any input parameter is null.
internal static void Read(this HeightStructuresSectionResultEntity entity,
- HeightStructuresFailureMechanismSectionResult sectionResult,
- ReadConversionCollector collector)
+ HeightStructuresFailureMechanismSectionResult sectionResult)
{
if (entity == null)
{
@@ -56,11 +54,6 @@
throw new ArgumentNullException(nameof(sectionResult));
}
- if (collector == null)
- {
- throw new ArgumentNullException(nameof(collector));
- }
-
sectionResult.SimpleAssessmentResult = (SimpleAssessmentResultType) entity.SimpleAssessmentResult;
sectionResult.DetailedAssessmentResult = (DetailedAssessmentProbabilityOnlyResultType) entity.DetailedAssessmentResult;
sectionResult.TailorMadeAssessmentResult = (TailorMadeAssessmentProbabilityCalculationResultType) entity.TailorMadeAssessmentResult;
Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u -r0464e347324f31f1ebd583672c33354451cffe47 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 0464e347324f31f1ebd583672c33354451cffe47)
+++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -25,7 +25,6 @@
using Riskeer.Common.Data.TestUtil;
using Riskeer.Common.Primitives;
using Riskeer.HeightStructures.Data;
-using Riskeer.Storage.Core.Create;
using Riskeer.Storage.Core.Create.HeightStructures;
using Riskeer.Storage.Core.DbContext;
@@ -38,28 +37,14 @@
public void Create_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
{
// Call
- void Call() => HeightStructuresFailureMechanismSectionResultCreateExtensions.Create(null, new PersistenceRegistry());
+ void Call() => HeightStructuresFailureMechanismSectionResultCreateExtensions.Create(null);
// Assert
var exception = Assert.Throws(Call);
Assert.AreEqual("result", exception.ParamName);
}
[Test]
- public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
- {
- // Setup
- var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
-
- // Call
- void Call() => sectionResult.Create(null);
-
- // Assert
- var exception = Assert.Throws(Call);
- Assert.AreEqual("registry", exception.ParamName);
- }
-
- [Test]
public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
{
// Setup
@@ -82,7 +67,7 @@
};
// Call
- HeightStructuresSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+ HeightStructuresSectionResultEntity entity = sectionResult.Create();
// Assert
Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
@@ -104,7 +89,7 @@
};
// Call
- HeightStructuresSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+ HeightStructuresSectionResultEntity entity = sectionResult.Create();
// Assert
Assert.IsNull(entity.TailorMadeAssessmentProbability);
Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u -r6a22c0bc4da3805d6e2ca60f6c89de919a340453 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision 6a22c0bc4da3805d6e2ca60f6c89de919a340453)
+++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -39,8 +39,7 @@
{
// Call
void Call() => ((ClosingStructuresSectionResultEntity) null).Read(new ClosingStructuresFailureMechanismSectionResult(
- FailureMechanismSectionTestFactory.CreateFailureMechanismSection()),
- new ReadConversionCollector());
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()));
// Assert
var exception = Assert.Throws(Call);
@@ -54,28 +53,14 @@
var entity = new ClosingStructuresSectionResultEntity();
// Call
- void Call() => entity.Read(null, new ReadConversionCollector());
+ void Call() => entity.Read(null);
// Assert
var exception = Assert.Throws(Call);
Assert.AreEqual("sectionResult", exception.ParamName);
}
[Test]
- public void Read_CollectorNull_ThrowsArgumentNullException()
- {
- // Setup
- var entity = new ClosingStructuresSectionResultEntity();
-
- // Call
- void Call() => entity.Read(new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()), null);
-
- // Assert
- var exception = Assert.Throws(Call);
- Assert.AreEqual("collector", exception.ParamName);
- }
-
- [Test]
public void Read_ParameterValues_SectionResultWithParameterValues()
{
// Setup
@@ -104,7 +89,7 @@
var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
// Call
- entity.Read(sectionResult, collector);
+ entity.Read(sectionResult);
// Assert
Assert.AreEqual(simpleAssessmentResult, sectionResult.SimpleAssessmentResult);
@@ -130,7 +115,7 @@
var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
// Call
- entity.Read(sectionResult, collector);
+ entity.Read(sectionResult);
// Assert
Assert.IsNaN(sectionResult.TailorMadeAssessmentProbability);
Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u -rb81a6c6bad9aa12a1e78fb4c0058612225f24216 -r7ca9e70221e813bd346b89788b8ea9ab4c7c5c35
--- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs (.../HeightStructuresSectionResultEntityReadExtensionsTest.cs) (revision b81a6c6bad9aa12a1e78fb4c0058612225f24216)
+++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs (.../HeightStructuresSectionResultEntityReadExtensionsTest.cs) (revision 7ca9e70221e813bd346b89788b8ea9ab4c7c5c35)
@@ -38,12 +38,11 @@
public void Read_EntityNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => ((HeightStructuresSectionResultEntity) null).Read(
- new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()),
- new ReadConversionCollector());
+ void Call() => ((HeightStructuresSectionResultEntity) null).Read(new HeightStructuresFailureMechanismSectionResult(
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()));
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(Call);
Assert.AreEqual("entity", exception.ParamName);
}
@@ -54,29 +53,14 @@
var entity = new HeightStructuresSectionResultEntity();
// Call
- TestDelegate call = () => entity.Read(null, new ReadConversionCollector());
+ void Call() => entity.Read(null);
// Assert
- string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("sectionResult", paramName);
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("sectionResult", exception.ParamName);
}
[Test]
- public void Read_CollectorNull_ThrowsArgumentNullException()
- {
- // Setup
- var entity = new HeightStructuresSectionResultEntity();
-
- // Call
- TestDelegate call = () => entity.Read(new HeightStructuresFailureMechanismSectionResult(
- FailureMechanismSectionTestFactory.CreateFailureMechanismSection()), null);
-
- // Assert
- string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("collector", paramName);
- }
-
- [Test]
public void Read_ParameterValues_SectionResultWithParameterValues()
{
// Setup
@@ -105,7 +89,7 @@
var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
// Call
- entity.Read(sectionResult, collector);
+ entity.Read(sectionResult);
// Assert
Assert.AreEqual(simpleAssessmentResult, sectionResult.SimpleAssessmentResult);
@@ -132,7 +116,7 @@
var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
// Call
- entity.Read(sectionResult, collector);
+ entity.Read(sectionResult);
// Assert
Assert.IsNaN(sectionResult.TailorMadeAssessmentProbability);