Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/AssessmentSectionHelper.cs
===================================================================
diff -u -rdcc94dbcc481ef9f6f83308b82096f85f9cb6f01 -r733f6586289fc6b2d40073062b0ad5aa653110cb
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/AssessmentSectionHelper.cs (.../AssessmentSectionHelper.cs) (revision dcc94dbcc481ef9f6f83308b82096f85f9cb6f01)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/AssessmentSectionHelper.cs (.../AssessmentSectionHelper.cs) (revision 733f6586289fc6b2d40073062b0ad5aa653110cb)
@@ -20,6 +20,7 @@
// All rights reserved.
using System.Linq;
+using Core.Common.Base.Data;
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Contribution;
@@ -34,54 +35,33 @@
public static class AssessmentSectionHelper
{
///
- /// Creates a stub of without
- /// or set.
+ /// Creates a stub of with a that is not linked.
///
/// The mock repository to create the stub with.
/// A stubbed .
- public static IAssessmentSection CreateAssessmentSectionStubWithoutBoundaryDatabaseOrFailureMechanisms(MockRepository mockRepository)
+ public static IAssessmentSection CreateAssessmentSectionStub(MockRepository mockRepository)
{
- return CreateAssessmentSectionStub(null, mockRepository, false, null);
- }
+ var assessmentSection = mockRepository.Stub();
+ assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase());
- ///
- /// Creates a stub of without the set.
- ///
- /// The failure mechanism to set the contribution for.
- /// The mock repository to create the stub with.
- /// A stubbed .
- public static IAssessmentSection CreateAssessmentSectionStubWithoutBoundaryDatabase(IFailureMechanism failureMechanism,
- MockRepository mockRepository)
- {
- return CreateAssessmentSectionStub(failureMechanism, mockRepository, false, null);
+ return assessmentSection;
}
///
- /// Creates a stub of with the set.
+ /// Creates a stub of .
///
/// The failure mechanism to set the contribution for.
/// The mock repository to create the stub with.
- /// The file path to the hydraulic boundary database.
+ /// The file path to the hydraulic boundary database (optional).
/// A stubbed .
+ /// Whether is provided or not, a dummy location with id 1300001 is added to the
+ /// hydraulic boundary database.
public static IAssessmentSection CreateAssessmentSectionStub(IFailureMechanism failureMechanism,
MockRepository mockRepository,
string filePath = null)
{
- return CreateAssessmentSectionStub(failureMechanism, mockRepository, true, filePath);
- }
+ IFailureMechanism[] failureMechanisms = GetFailureMechanisms(failureMechanism);
- private static IAssessmentSection CreateAssessmentSectionStub(IFailureMechanism failureMechanism,
- MockRepository mockRepository,
- bool addBoundaryDatabase,
- string filePath)
- {
- IFailureMechanism[] failureMechanisms = failureMechanism == null
- ? Enumerable.Empty().ToArray()
- : new[]
- {
- failureMechanism
- };
-
var assessmentSection = mockRepository.Stub();
assessmentSection.Stub(a => a.Id).Return("21");
assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
@@ -90,17 +70,34 @@
0.1,
1.0 / 30000));
assessmentSection.Stub(a => a.GetFailureMechanisms()).Return(failureMechanisms);
+ assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(GetHydraulicBoundaryDatabase(filePath));
- if (addBoundaryDatabase)
- {
- assessmentSection.HydraulicBoundaryDatabase = GetHydraulicBoundaryDatabase(filePath);
- }
+ assessmentSection.Replay();
return assessmentSection;
}
- private static HydraulicBoundaryDatabase GetHydraulicBoundaryDatabase(string filePath = null)
+ ///
+ /// Gets a normative assessment level.
+ ///
+ /// The normative assessment level.
+ public static RoundedDouble GetTestNormativeAssessmentLevel()
{
+ return (RoundedDouble) 1.1;
+ }
+
+ private static IFailureMechanism[] GetFailureMechanisms(IFailureMechanism failureMechanism)
+ {
+ return failureMechanism == null
+ ? Enumerable.Empty().ToArray()
+ : new[]
+ {
+ failureMechanism
+ };
+ }
+
+ private static HydraulicBoundaryDatabase GetHydraulicBoundaryDatabase(string filePath)
+ {
return new HydraulicBoundaryDatabase
{
FilePath = filePath,