// 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((IAssessmentSection)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 ClearFailureMechanismCalculationOutputs_WithouFailureMechanisms_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs((IEnumerable)null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("failureMechanisms", exception.ParamName);
}
[Test]
public void ClearFailureMechanismCalculationOutputs_WithFailureMechanisms_ClearsFailureMechanismCalculationsOutputAndReturnsAffectedCalculations()
{
// Setup
var pipingFailureMechanism = new PipingFailureMechanism();
pipingFailureMechanism.CalculationsGroup.Children.Add(new PipingCalculationScenario(new GeneralPipingInput()));
List failureMechanisms = new List
{
TestDataGenerator.GetFullyConfiguredClosingStructuresFailureMechanism(),
TestDataGenerator.GetFullyConfiguredGrassCoverErosionInwardsFailureMechanism(),
pipingFailureMechanism
};
IEnumerable expectedAffectedItems = failureMechanisms
.SelectMany(f => f.Calculations)
.Where(c => c.HasOutput)
.ToList();
// Call
IEnumerable affectedItems = RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs(failureMechanisms);
// 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(failureMechanisms
.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 mocks = new MockRepository();
IAssessmentSection assessmentSection = mocks.Stub();
mocks.ReplayAll();
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(null, assessmentSection);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("hydraulicBoundaryDatabase", exception.ParamName);
mocks.VerifyAll();
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Setup
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(hydraulicBoundaryDatabase, null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
public void ClearHydraulicBoundaryLocationOutputOfFailureMechanisms_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutputOfFailureMechanisms((IAssessmentSection)null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_GrassCoverErosionOutwardsAndDunesWithoutLocations_DoNothing()
{
// Setup
var mockRepository = new MockRepository();
IAssessmentSection assessmentSection = mockRepository.Stub();
assessmentSection.Stub(section => section.GetFailureMechanisms()).Return(new IFailureMechanism[]
{
new GrassCoverErosionOutwardsFailureMechanism(),
new DuneErosionFailureMechanism()
});
mockRepository.ReplayAll();
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutputOfFailureMechanisms(assessmentSection);
// Assert
CollectionAssert.IsEmpty(affectedObjects);
mockRepository.VerifyAll();
}
[Test]
[TestCaseSource(nameof(GrassAndDuneLocations))]
public void ClearHydraulicBoundaryLocationOutputForFailureMechanisms_GrassCoverErosionOutwardsAndDuneLocations_ClearDataAndReturnAffectedLocations(HydraulicBoundaryLocation grassCoverErosionLocation,
DuneLocation duneLocation,
IEnumerable expectedAffectedItems)
{
// Setup
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
grassCoverErosionOutwardsFailureMechanism.HydraulicBoundaryLocations.Add(grassCoverErosionLocation);
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
duneErosionFailureMechanism.DuneLocations.Add(duneLocation);
var mockRepository = new MockRepository();
IAssessmentSection assessmentSection = mockRepository.Stub();
assessmentSection.Stub(section => section.GetFailureMechanisms()).Return(new IFailureMechanism[]
{
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism
});
mockRepository.ReplayAll();
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutputOfFailureMechanisms(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.AreEquivalent(expectedAffectedItems, affectedObjects);
Assert.IsNull(grassCoverErosionLocation.DesignWaterLevelOutput);
Assert.IsNull(grassCoverErosionLocation.WaveHeightOutput);
Assert.IsNull(duneLocation.Output);
mockRepository.VerifyAll();
}
[Test]
public void ClearHydraulicBoundaryLocationOutputOfFailureMechanisms_FailureMechanismsNull_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutputOfFailureMechanisms((IEnumerable)null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("failureMechanisms", exception.ParamName);
}
[Test]
public void ClearHydraulicBoundaryLocationOutput_FailureMechanismsGrassCoverErosionOutwardsAndDunesWithoutLocations_DoNothing()
{
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutputOfFailureMechanisms(new IFailureMechanism[]
{
new GrassCoverErosionOutwardsFailureMechanism(),
new DuneErosionFailureMechanism()
});
// Assert
CollectionAssert.IsEmpty(affectedObjects);
}
[Test]
[TestCaseSource(nameof(GrassAndDuneLocations2))]
public void ClearHydraulicBoundaryLocationOutputForFailureMechanisms_FailureMechanismsGrassCoverErosionOutwardsAndDuneLocations_ClearDataAndReturnAffectedLocations(HydraulicBoundaryLocation grassCoverErosionLocation,
DuneLocation duneLocation,
IEnumerable expectedAffectedItems)
{
// Setup
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
grassCoverErosionOutwardsFailureMechanism.HydraulicBoundaryLocations.Add(grassCoverErosionLocation);
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
duneErosionFailureMechanism.DuneLocations.Add(duneLocation);
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutputOfFailureMechanisms(new IFailureMechanism[]
{
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:
CollectionAssert.AreEquivalent(expectedAffectedItems, affectedObjects);
Assert.IsNull(grassCoverErosionLocation.DesignWaterLevelOutput);
Assert.IsNull(grassCoverErosionLocation.WaveHeightOutput);
Assert.IsNull(duneLocation.Output);
}
[Test]
[TestCaseSource(nameof(HydraulicBoundaryLocationAndGrassAndDuneLocations))]
public void ClearHydraulicBoundaryLocationOutput_HydraulicBoundaryGrassCoverErosionOutwardsAndDuneLocations_ClearDataAndReturnAffectedLocations(HydraulicBoundaryLocation hydraulicBoundaryLocation,
HydraulicBoundaryLocation grassCoverErosionLocation,
DuneLocation duneLocation,
IEnumerable expectedAffectedItems)
{
// Setup
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
{
Locations =
{
hydraulicBoundaryLocation
}
};
var duneErosionFailureMechanism = new DuneErosionFailureMechanism();
duneErosionFailureMechanism.DuneLocations.Add(duneLocation);
var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
grassCoverErosionOutwardsFailureMechanism.HydraulicBoundaryLocations.Add(grassCoverErosionLocation);
var mockRepository = new MockRepository();
IAssessmentSection assessmentSection = mockRepository.Stub();
assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase;
assessmentSection.Stub(section => section.GetFailureMechanisms()).Return(new IFailureMechanism[]
{
grassCoverErosionOutwardsFailureMechanism,
duneErosionFailureMechanism
});
mockRepository.ReplayAll();
// Call
IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationOutput(assessmentSection.HydraulicBoundaryDatabase, 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.AreEquivalent(expectedAffectedItems, affectedObjects);
Assert.IsNull(hydraulicBoundaryLocation.DesignWaterLevelOutput);
Assert.IsNull(hydraulicBoundaryLocation.WaveHeightOutput);
Assert.IsNull(grassCoverErosionLocation.DesignWaterLevelOutput);
Assert.IsNull(grassCoverErosionLocation.WaveHeightOutput);
Assert.IsNull(duneLocation.Output);
mockRepository.VerifyAll();
}
[Test]
public void GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms((IAssessmentSection)null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("assessmentSection", exception.ParamName);
}
[Test]
[TestCaseSource(nameof(FailureMechanisms))]
public void GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms_GrassCoverOutwardsAndDuneLocations_ReturnsExpectedAffectedCollections(IEnumerable availableFailureMechanisms,
IEnumerable expectedCollections)
{
// Setup
var mockRepository = new MockRepository();
IAssessmentSection assessmentSection = mockRepository.Stub();
assessmentSection.Stub(section => section.GetFailureMechanisms()).Return(availableFailureMechanisms);
mockRepository.ReplayAll();
// Call
IEnumerable affectedCollections = RingtoetsDataSynchronizationService.GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms(assessmentSection);
// Assert
CollectionAssert.AreEquivalent(expectedCollections, affectedCollections);
mockRepository.VerifyAll();
}
[Test]
public void GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms_FailureMechanismsNull_ThrowsArgumentNullException()
{
// Call
TestDelegate test = () => RingtoetsDataSynchronizationService.GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms((IEnumerable)null);
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual("failureMechanisms", exception.ParamName);
}
[Test]
[TestCaseSource(nameof(FailureMechanisms2))]
public void GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms_FailureMechanismsGrassCoverOutwardsAndDuneLocations_ReturnsExpectedAffectedCollections(IEnumerable availableFailureMechanisms,
IEnumerable expectedCollections)
{
// Call
IEnumerable affectedCollections = RingtoetsDataSynchronizationService.GetHydraulicBoundaryLocationCollectionsOfFailureMechanisms(availableFailureMechanisms);
// Assert
CollectionAssert.AreEquivalent(expectedCollections, affectedCollections);
}
[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_ClearResultsContainAllAffectedObjectsAndAllRemovedObjects()
{
// Setup
AssessmentSection assessmentSection = TestDataGenerator.GetFullyConfiguredAssessmentSection();
IList