// Copyright (C) Stichting Deltares 2016. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets 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;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.ClosingStructures.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Service;
using Ringtoets.DuneErosion.Data;
using Ringtoets.DuneErosion.Data.TestUtil;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.HeightStructures.Data;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Data.StandAlone;
using Ringtoets.Integration.TestUtils;
using Ringtoets.Piping.Data;
using Ringtoets.Piping.Primitives;
using Ringtoets.StabilityPointStructures.Data;
using Ringtoets.StabilityStoneCover.Data;
using Ringtoets.WaveImpactAsphaltCover.Data;
namespace Ringtoets.Integration.Service.Test
{
[TestFixture]
public class RingtoetsDataSynchronizationServiceTest
{
[Test]
public void ClearFailureMechanismCalculationOutputs_WithoutAssessmentSection_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs(null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
public void ClearFailureMechanismCalculationOutputs_WithAssessmentSection_ClearsFailureMechanismCalculationsOutputAndReturnsAffectedCalculations()
{
// Setup
AssessmentSection assessmentSection = TestDataGenerator.GetFullyConfiguredAssessmentSection();
IEnumerable expectedAffectedItems = assessmentSection.GetFailureMechanisms()
.SelectMany(f => f.Calculations)
.Where(c => c.HasOutput)
.ToList();
// Call
IEnumerable affectedItems = RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs(assessmentSection);
// Assert
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
CollectionAssert.IsEmpty(assessmentSection.GetFailureMechanisms()
.SelectMany(f => f.Calculations)
.Where(c => c.HasOutput));
CollectionAssert.AreEquivalent(expectedAffectedItems, affectedItems);
}
[Test]
public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_VariousCalculations_ClearsHydraulicBoundaryLocationAndCalculationsAndReturnsAffectedObjects()
{
// Setup
var assessmentSection = TestDataGenerator.GetFullyConfiguredAssessmentSection();
var expectedAffectedItems = new List();
expectedAffectedItems.AddRange(assessmentSection.ClosingStructures.Calculations
.Cast>()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.ClosingStructures.Calculations
.Cast>()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.GrassCoverErosionInwards.Calculations
.Cast()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.GrassCoverErosionInwards.Calculations
.Cast()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.GrassCoverErosionOutwards.Calculations
.Cast()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.GrassCoverErosionOutwards.Calculations
.Cast()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.HeightStructures.Calculations
.Cast>()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.HeightStructures.Calculations
.Cast>()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.PipingFailureMechanism.Calculations
.Cast()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.PipingFailureMechanism.Calculations
.Cast()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.StabilityPointStructures.Calculations
.Cast>()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.StabilityPointStructures.Calculations
.Cast>()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.StabilityStoneCover.Calculations
.Cast()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.StabilityStoneCover.Calculations
.Cast()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
expectedAffectedItems.AddRange(assessmentSection.WaveImpactAsphaltCover.Calculations
.Cast()
.Where(c => c.HasOutput));
expectedAffectedItems.AddRange(assessmentSection.WaveImpactAsphaltCover.Calculations
.Cast()
.Select(c => c.InputParameters)
.Where(i => i.HydraulicBoundaryLocation != null));
// Call
IEnumerable affectedItems = RingtoetsDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(assessmentSection);
// Assert
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
Assert.IsTrue(assessmentSection.ClosingStructures.Calculations.Cast>()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.GrassCoverErosionInwards.Calculations.Cast()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.GrassCoverErosionOutwards.Calculations.Cast()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.HeightStructures.Calculations.Cast>()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.PipingFailureMechanism.Calculations.Cast()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.StabilityPointStructures.Calculations.Cast>()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.StabilityStoneCover.Calculations.Cast()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
Assert.IsTrue(assessmentSection.WaveImpactAsphaltCover.Calculations.Cast()
.All(c => c.InputParameters.HydraulicBoundaryLocation == null && !c.HasOutput));
CollectionAssert.AreEquivalent(expectedAffectedItems, affectedItems);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_HydraulicBoundaryDatabaseNull_ThrowsArgumentNullException()
{
// Setup
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(null,
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("hydraulicBoundaryDatabase", exception.ParamName);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_grassCoverErosionOutwardsFailureMechanismNull_ThrowsArgumentNullException()
{
// Setup
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(hydraulicBoundaryDatabase,
null,
duneErosionFailureMechanism);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("grassCoverErosionOutwardsFailureMechanism", exception.ParamName);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_DuneErosionFailureMechanismNull_ThrowsArgumentNullException()
{
// Setup
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(hydraulicBoundaryDatabase,
grassCoverErosionOutwardsFailureMechanism,
null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("duneErosionFailureMechanism", exception.ParamName);
}
[Test]
[TestCase(1.0, 3.0)]
[TestCase(3.8, double.NaN)]
[TestCase(double.NaN, 6.9)]
public void ClearHydraulicBoundaryLocationOutput_LocationWithData_ClearsDataAndReturnsAffectedHydraulicBoundaryLocations(
double waveHeight, double designWaterLevel)
{
// Setup
var mockRepository = new MockRepository();
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(
grassCoverErosionOutwardsFailureMechanism, mockRepository);
mockRepository.ReplayAll();
HydraulicBoundaryLocation hydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations[0];
hydraulicBoundaryLocation.DesignWaterLevelOutput = new TestHydraulicBoundaryLocationOutput(designWaterLevel);
hydraulicBoundaryLocation.WaveHeightOutput = new TestHydraulicBoundaryLocationOutput(waveHeight);
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(
assessmentSectionStub.HydraulicBoundaryDatabase,
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism);
// Assert
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
Assert.IsNull(hydraulicBoundaryLocation.DesignWaterLevelOutput);
Assert.IsNull(hydraulicBoundaryLocation.WaveHeightOutput);
Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel);
Assert.IsNaN(hydraulicBoundaryLocation.WaveHeight);
Assert.AreEqual(CalculationConvergence.NotCalculated, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
Assert.AreEqual(CalculationConvergence.NotCalculated, hydraulicBoundaryLocation.WaveHeightCalculationConvergence);
CollectionAssert.AreEqual(new[]
{
hydraulicBoundaryLocation
}, affectedObjects);
mockRepository.VerifyAll();
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_HydraulicBoundaryDatabaseWithoutLocations_DoNothing()
{
// Setup
var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
{
HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase()
};
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(
assessmentSection.HydraulicBoundaryDatabase,
assessmentSection.GrassCoverErosionOutwards,
assessmentSection.DuneErosion);
// Assert
CollectionAssert.IsEmpty(affectedObjects);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_LocationWithoutWaveHeightAndDesignWaterLevel_DoNothing()
{
// Setup
var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
{
HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase()
};
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 0, 0);
assessmentSection.HydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(
assessmentSection.HydraulicBoundaryDatabase,
assessmentSection.GrassCoverErosionOutwards,
assessmentSection.DuneErosion);
// Assert
CollectionAssert.IsEmpty(affectedObjects);
}
[Test]
[TestCase(3.5, double.NaN, TestName = "ClearHydraulicBoundaryLocationOutput_LocationWithoutDataAndGrassOutwardLocationWithData_ClearDataAndReturnAffectedData(3.5, NaN)")]
[TestCase(double.NaN, 8.3, TestName = "ClearHydraulicBoundaryLocationOutput_LocationWithoutDataAndGrassOutwardLocationWithData_ClearDataAndReturnAffectedData(NaN, 8.3)")]
public void ClearHydraulicBoundaryLocationOutput_LocationWithoutDataAndGrassCoverErosionOutwardsLocationWithData_ClearDataAndReturnAffectedHydraulicBoundaryLocations(
double designWaterLevel, double waveHeight)
{
// Setup
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 0, 0);
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
{
Locations =
{
hydraulicBoundaryLocation
}
};
var grassCoverErosionOutwardsHydraulicBoundaryLocation = hydraulicBoundaryLocation;
grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevelOutput = new TestHydraulicBoundaryLocationOutput(
designWaterLevel, CalculationConvergence.CalculatedConverged);
grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightOutput = new TestHydraulicBoundaryLocationOutput(
waveHeight, CalculationConvergence.CalculatedConverged);
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism
{
HydraulicBoundaryLocations =
{
grassCoverErosionOutwardsHydraulicBoundaryLocation
}
};
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(
hydraulicBoundaryDatabase,
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism);
// Assert
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
Assert.IsNull(grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevelOutput);
Assert.IsNull(grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightOutput);
Assert.IsNaN(grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevel);
Assert.IsNaN(grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeight);
Assert.AreEqual(CalculationConvergence.NotCalculated, grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
Assert.AreEqual(CalculationConvergence.NotCalculated, grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightCalculationConvergence);
CollectionAssert.AreEqual(new[]
{
grassCoverErosionOutwardsHydraulicBoundaryLocation
}, affectedObjects);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_LocationWithoutDataAndGrassCoverErosionOutwardsLocationWithoutData_DoNothing()
{
// Setup
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 0, 0);
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
{
Locations =
{
hydraulicBoundaryLocation
}
};
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism
{
HydraulicBoundaryLocations =
{
hydraulicBoundaryLocation
}
};
var duneErosionFailureMechanism = new DuneErosionFailureMechanism
{
DuneLocations =
{
new TestDuneLocation()
}
};
// Call
IEnumerable affected = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(
hydraulicBoundaryDatabase,
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism);
// Assert
CollectionAssert.IsEmpty(affected);
}
[Test]
[TestCase(3.5, double.NaN, TestName = "ClearHydraulicBoundaryLocationOutput_LocationWithDataAndGrassOutwardLocationWithData_ClearDataAndReturnAffectedData(3.5, NaN)")]
[TestCase(double.NaN, 8.3, TestName = "ClearHydraulicBoundaryLocationOutput_LocationWithDataAndGrassOutwardLocationWithData_ClearDataAndReturnAffectedData(NaN, 8.3)")]
public void ClearHydraulicBoundaryLocationOutput_LocationWithDataAndGrassCoverErosionOutwardsLocationWithData_ClearDataAndReturnAffectedHydraulicBoundaryLocations(
double designWaterLevel, double waveHeight)
{
// Setup
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
var mockRepository = new MockRepository();
IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(
grassCoverErosionOutwardsFailureMechanism, mockRepository);
mockRepository.ReplayAll();
HydraulicBoundaryLocation hydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations[0];
hydraulicBoundaryLocation.DesignWaterLevelOutput = new TestHydraulicBoundaryLocationOutput(designWaterLevel);
hydraulicBoundaryLocation.WaveHeightOutput = new TestHydraulicBoundaryLocationOutput(waveHeight);
var grassCoverErosionOutwardsHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation
{
DesignWaterLevelOutput = new TestHydraulicBoundaryLocationOutput(hydraulicBoundaryLocation.DesignWaterLevel),
WaveHeightOutput = new TestHydraulicBoundaryLocationOutput(hydraulicBoundaryLocation.WaveHeight)
};
grassCoverErosionOutwardsFailureMechanism.HydraulicBoundaryLocations.Add(grassCoverErosionOutwardsHydraulicBoundaryLocation);
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(
assessmentSectionStub.HydraulicBoundaryDatabase,
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism);
// Assert
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
Assert.IsNull(hydraulicBoundaryLocation.DesignWaterLevelOutput);
Assert.IsNull(hydraulicBoundaryLocation.WaveHeightOutput);
Assert.IsNaN(hydraulicBoundaryLocation.DesignWaterLevel);
Assert.IsNaN(hydraulicBoundaryLocation.WaveHeight);
Assert.AreEqual(CalculationConvergence.NotCalculated, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
Assert.AreEqual(CalculationConvergence.NotCalculated, hydraulicBoundaryLocation.WaveHeightCalculationConvergence);
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
Assert.IsNull(grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevelOutput);
Assert.IsNull(grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightOutput);
Assert.IsNaN(grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevel);
Assert.IsNaN(grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeight);
Assert.AreEqual(CalculationConvergence.NotCalculated, grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence);
Assert.AreEqual(CalculationConvergence.NotCalculated, grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightCalculationConvergence);
CollectionAssert.AreEquivalent(new[]
{
grassCoverErosionOutwardsHydraulicBoundaryLocation,
hydraulicBoundaryLocation
}, affectedObjects);
mockRepository.VerifyAll();
}
[Test]
public void ClearReferenceLine_AssessmentSectionNull_ThrowArgumentNullException()
{
// Call
TestDelegate call = () => RingtoetsDataSynchronizationService.ClearReferenceLine(null);
// Assert
string paramName = Assert.Throws(call).ParamName;
Assert.AreEqual("assessmentSection", paramName);
}
[Test]
public void ClearReferenceLine_FullyConfiguredAssessmentSection_AllReferenceLineDependentDataCleared()
{
// Setup
AssessmentSection assessmentSection = TestDataGenerator.GetFullyConfiguredAssessmentSection();
// Call
RingtoetsDataSynchronizationService.ClearReferenceLine(assessmentSection);
// Assert
// Note: To make sure the clear is performed regardless of what is done with
// the return result, no ToArray() should be called before these assertions:
PipingFailureMechanism pipingFailureMechanism = assessmentSection.PipingFailureMechanism;
CollectionAssert.IsEmpty(pipingFailureMechanism.Sections);
CollectionAssert.IsEmpty(pipingFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(pipingFailureMechanism.CalculationsGroup.Children);
CollectionAssert.IsEmpty(pipingFailureMechanism.StochasticSoilModels);
CollectionAssert.IsEmpty(pipingFailureMechanism.SurfaceLines);
GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwardsFailureMechanism = assessmentSection.GrassCoverErosionInwards;
CollectionAssert.IsEmpty(grassCoverErosionInwardsFailureMechanism.Sections);
CollectionAssert.IsEmpty(grassCoverErosionInwardsFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(grassCoverErosionInwardsFailureMechanism.CalculationsGroup.Children);
CollectionAssert.IsEmpty(grassCoverErosionInwardsFailureMechanism.DikeProfiles);
GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwardsFailureMechanism = assessmentSection.GrassCoverErosionOutwards;
CollectionAssert.IsEmpty(grassCoverErosionOutwardsFailureMechanism.Sections);
CollectionAssert.IsEmpty(grassCoverErosionOutwardsFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(grassCoverErosionOutwardsFailureMechanism.WaveConditionsCalculationGroup.Children);
CollectionAssert.IsEmpty(grassCoverErosionOutwardsFailureMechanism.ForeshoreProfiles);
WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCoverFailureMechanism = assessmentSection.WaveImpactAsphaltCover;
CollectionAssert.IsEmpty(waveImpactAsphaltCoverFailureMechanism.Sections);
CollectionAssert.IsEmpty(waveImpactAsphaltCoverFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(waveImpactAsphaltCoverFailureMechanism.WaveConditionsCalculationGroup.Children);
CollectionAssert.IsEmpty(waveImpactAsphaltCoverFailureMechanism.ForeshoreProfiles);
StabilityStoneCoverFailureMechanism stabilityStoneCoverFailureMechanism = assessmentSection.StabilityStoneCover;
CollectionAssert.IsEmpty(stabilityStoneCoverFailureMechanism.Sections);
CollectionAssert.IsEmpty(stabilityStoneCoverFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(stabilityStoneCoverFailureMechanism.WaveConditionsCalculationGroup.Children);
CollectionAssert.IsEmpty(stabilityStoneCoverFailureMechanism.ForeshoreProfiles);
ClosingStructuresFailureMechanism closingStructuresFailureMechanism = assessmentSection.ClosingStructures;
CollectionAssert.IsEmpty(closingStructuresFailureMechanism.Sections);
CollectionAssert.IsEmpty(closingStructuresFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(closingStructuresFailureMechanism.CalculationsGroup.Children);
CollectionAssert.IsEmpty(closingStructuresFailureMechanism.ForeshoreProfiles);
CollectionAssert.IsEmpty(closingStructuresFailureMechanism.ClosingStructures);
HeightStructuresFailureMechanism heightStructuresFailureMechanism = assessmentSection.HeightStructures;
CollectionAssert.IsEmpty(heightStructuresFailureMechanism.Sections);
CollectionAssert.IsEmpty(heightStructuresFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(heightStructuresFailureMechanism.CalculationsGroup.Children);
CollectionAssert.IsEmpty(heightStructuresFailureMechanism.ForeshoreProfiles);
CollectionAssert.IsEmpty(heightStructuresFailureMechanism.HeightStructures);
StabilityPointStructuresFailureMechanism stabilityPointStructuresFailureMechanism = assessmentSection.StabilityPointStructures;
CollectionAssert.IsEmpty(stabilityPointStructuresFailureMechanism.Sections);
CollectionAssert.IsEmpty(stabilityPointStructuresFailureMechanism.SectionResults);
CollectionAssert.IsEmpty(stabilityPointStructuresFailureMechanism.CalculationsGroup.Children);
CollectionAssert.IsEmpty(stabilityPointStructuresFailureMechanism.ForeshoreProfiles);
CollectionAssert.IsEmpty(stabilityPointStructuresFailureMechanism.StabilityPointStructures);
DuneErosionFailureMechanism duneErosionFailureMechanism = assessmentSection.DuneErosion;
CollectionAssert.IsEmpty(duneErosionFailureMechanism.Sections);
CollectionAssert.IsEmpty(duneErosionFailureMechanism.SectionResults);
MacrostabilityInwardsFailureMechanism macrostabilityInwardsFailureMechanism = assessmentSection.MacrostabilityInwards;
CollectionAssert.IsEmpty(macrostabilityInwardsFailureMechanism.Sections);
CollectionAssert.IsEmpty(macrostabilityInwardsFailureMechanism.SectionResults);
MacrostabilityOutwardsFailureMechanism macrostabilityOutwardsFailureMechanism = assessmentSection.MacrostabilityOutwards;
CollectionAssert.IsEmpty(macrostabilityOutwardsFailureMechanism.Sections);
CollectionAssert.IsEmpty(macrostabilityOutwardsFailureMechanism.SectionResults);
MicrostabilityFailureMechanism microstabilityFailureMechanism = assessmentSection.Microstability;
CollectionAssert.IsEmpty(microstabilityFailureMechanism.Sections);
CollectionAssert.IsEmpty(microstabilityFailureMechanism.SectionResults);
WaterPressureAsphaltCoverFailureMechanism waterPressureAsphaltCoverFailureMechanism = assessmentSection.WaterPressureAsphaltCover;
CollectionAssert.IsEmpty(waterPressureAsphaltCoverFailureMechanism.Sections);
CollectionAssert.IsEmpty(waterPressureAsphaltCoverFailureMechanism.SectionResults);
GrassCoverSlipOffOutwardsFailureMechanism grassCoverSlipOffOutwardsFailureMechanism = assessmentSection.GrassCoverSlipOffOutwards;
CollectionAssert.IsEmpty(grassCoverSlipOffOutwardsFailureMechanism.Sections);
CollectionAssert.IsEmpty(grassCoverSlipOffOutwardsFailureMechanism.SectionResults);
GrassCoverSlipOffInwardsFailureMechanism grassCoverSlipOffInwardsFailureMechanism = assessmentSection.GrassCoverSlipOffInwards;
CollectionAssert.IsEmpty(grassCoverSlipOffInwardsFailureMechanism.Sections);
CollectionAssert.IsEmpty(grassCoverSlipOffInwardsFailureMechanism.SectionResults);
StrengthStabilityLengthwiseConstructionFailureMechanism stabilityLengthwiseConstructionFailureMechanism = assessmentSection.StrengthStabilityLengthwiseConstruction;
CollectionAssert.IsEmpty(stabilityLengthwiseConstructionFailureMechanism.Sections);
CollectionAssert.IsEmpty(stabilityLengthwiseConstructionFailureMechanism.SectionResults);
PipingStructureFailureMechanism pipingStructureFailureMechanism = assessmentSection.PipingStructure;
CollectionAssert.IsEmpty(pipingStructureFailureMechanism.Sections);
CollectionAssert.IsEmpty(pipingStructureFailureMechanism.SectionResults);
TechnicalInnovationFailureMechanism technicalInnovationFailureMechanism = assessmentSection.TechnicalInnovation;
CollectionAssert.IsEmpty(technicalInnovationFailureMechanism.Sections);
CollectionAssert.IsEmpty(technicalInnovationFailureMechanism.SectionResults);
Assert.IsNull(assessmentSection.ReferenceLine);
}
[Test]
public void ClearReferenceLine_FullyConfiguredAssessmentSection_ClearResultsContainAllAffectedObjectsAndAllDeletedObjects()
{
// Setup
AssessmentSection assessmentSection = TestDataGenerator.GetFullyConfiguredAssessmentSection();
IList