Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql =================================================================== diff -u -r6b20f88a2f50fb210b0458b7268a325f2a8d5391 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 6b20f88a2f50fb210b0458b7268a325f2a8d5391) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -39,7 +39,56 @@ INSERT INTO GrassCoverErosionOutwardsWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsOutputEntity; INSERT INTO GrassCoverSlipOffInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffInwardsSectionResultEntity; INSERT INTO GrassCoverSlipOffOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffOutwardsSectionResultEntity; -INSERT INTO HeightStructureEntity SELECT * FROM [SOURCEPROJECT].HeightStructureEntity; +INSERT INTO HeightStructureEntity ( + [HeightStructureEntityId], + [FailureMechanismEntityId], + [Order], + [Name], + [Id], + [X], + [Y], + [StructureNormalOrientation], + [LevelCrestStructureMean], + [LevelCrestStructureStandardDeviation], + [FlowWidthAtBottomProtectionMean], + [FlowWidthAtBottomProtectionStandardDeviation], + [CriticalOvertoppingDischargeMean], + [CriticalOvertoppingDischargeCoefficientOfVariation], + [WidthFlowAperturesMean], + [WidthFlowAperturesStandardDeviation], + [FailureProbabilityStructureWithErosion], + [StorageStructureAreaMean], + [StorageStructureAreaCoefficientOfVariation], + [AllowedLevelIncreaseStorageMean], + [AllowedLevelIncreaseStorageStandardDeviation]) +SELECT + [HeightStructureEntityId], + [FailureMechanismEntityId], + [Order], + [Name], + CASE WHEN Suffix THEN [Id] || '(' || Suffix || ')' ELSE [Id] END as [Id], + [X], + [Y], + [StructureNormalOrientation], + [LevelCrestStructureMean], + [LevelCrestStructureStandardDeviation], + [FlowWidthAtBottomProtectionMean], + [FlowWidthAtBottomProtectionStandardDeviation], + [CriticalOvertoppingDischargeMean], + [CriticalOvertoppingDischargeCoefficientOfVariation], + [WidthFlowAperturesMean], + [WidthFlowAperturesStandardDeviation], + [FailureProbabilityStructureWithErosion], + [StorageStructureAreaMean], + [StorageStructureAreaCoefficientOfVariation], + [AllowedLevelIncreaseStorageMean], + [AllowedLevelIncreaseStorageStandardDeviation] + FROM (SELECT *, (SELECT count(*) + FROM [SOURCEPROJECT].HeightStructureEntity + WHERE HS.[HeightStructureEntityId] > [HeightStructureEntityId] + AND HS.[Name] IS [Name] + AND HS.[FailuremechanismEntityId] = [FailuremechanismEntityId]) as Suffix + FROM [SOURCEPROJECT].HeightStructureEntity HS); INSERT INTO HeightStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresCalculationEntity; INSERT INTO HeightStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresFailureMechanismMetaEntity; INSERT INTO HeightStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresOutputEntity; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.HeightStructures.Data; @@ -43,7 +44,7 @@ { FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.StructureHeight, registry); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); - AddEntitiesForHeightStructures(mechanism.HeightStructures, entity, registry); + AddEntitiesForHeightStructures(mechanism.HeightStructuresCollection, entity, registry); AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); entity.CalculationGroupEntity = mechanism.CalculationsGroup.Create(registry, 0); AddEntitiesForSectionResults(mechanism.SectionResults, registry); @@ -76,7 +77,7 @@ } private static void AddEntitiesForHeightStructures( - IList structures, + StructureCollection structures, FailureMechanismEntity entity, PersistenceRegistry registry) { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -35,6 +35,7 @@ using Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover; using Core.Common.Base; using Ringtoets.ClosingStructures.Data; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; @@ -247,7 +248,7 @@ entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadHeightStructuresMechanismSectionResults(failureMechanism, collector); entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); - entity.ReadHeightStructures(failureMechanism.HeightStructures, collector); + entity.ReadHeightStructures(failureMechanism.HeightStructuresCollection, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadHeightStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); } @@ -265,9 +266,10 @@ } } - private static void ReadHeightStructures(this FailureMechanismEntity entity, ObservableList heightStructures, ReadConversionCollector collector) + private static void ReadHeightStructures(this FailureMechanismEntity entity, StructureCollection heightStructures, ReadConversionCollector collector) { - heightStructures.AddRange(entity.HeightStructureEntities.OrderBy(fpe => fpe.Order).Select(structureEntity => structureEntity.Read(collector))); + heightStructures.AddRange(entity.HeightStructureEntities.OrderBy(fpe => fpe.Order).Select(structureEntity => structureEntity.Read(collector)), + "TODO: To be determined"); } private static void ReadGeneralInput(this FailureMechanismEntity entity, GeneralHeightStructuresInput generalInput) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -186,7 +186,10 @@ HeightStructure structure = new TestHeightStructure(); var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.HeightStructures.Add(structure); + failureMechanism.HeightStructuresCollection.AddRange(new[] + { + structure + }, "some path"); var persistenceRegistry = new PersistenceRegistry(); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -1068,12 +1068,12 @@ entity.ReadAsHeightStructuresFailureMechanism(failureMechanism, collector); // Assert - Assert.AreEqual(2, failureMechanism.HeightStructures.Count); + Assert.AreEqual(2, failureMechanism.HeightStructuresCollection.Count); - HeightStructure child1 = failureMechanism.HeightStructures[0]; + HeightStructure child1 = failureMechanism.HeightStructuresCollection[0]; Assert.AreEqual("Child2", child1.Name); - HeightStructure child2 = failureMechanism.HeightStructures[1]; + HeightStructure child2 = failureMechanism.HeightStructuresCollection[1]; Assert.AreEqual("Child1", child2.Name); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -231,7 +231,7 @@ { HeightStructuresFailureMechanism failureMechanism = assessmentSection.HeightStructures; Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); - Assert.AreEqual(2, failureMechanism.HeightStructures.Count); + Assert.AreEqual(2, failureMechanism.HeightStructuresCollection.Count); Assert.NotNull(failureMechanism.CalculationsGroup); Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -574,8 +574,11 @@ List hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; var heightStructure = new TestHeightStructure(); - failureMechanism.HeightStructures.Add(heightStructure); - failureMechanism.HeightStructures.Add(new TestHeightStructure()); + failureMechanism.HeightStructuresCollection.AddRange(new[] + { + heightStructure, + new TestHeightStructure("Structure B", "IdB") + }, @"C:\Folder"); ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanism.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanism.cs (.../HeightStructuresFailureMechanism.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanism.cs (.../HeightStructuresFailureMechanism.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; @@ -48,6 +49,7 @@ CalculationsGroup = new CalculationGroup(RingtoetsCommonDataResources.FailureMechanism_Calculations_DisplayName, false); GeneralInput = new GeneralHeightStructuresInput(); HeightStructures = new ObservableList(); + HeightStructuresCollection = new StructureCollection(); ForeshoreProfiles = new ObservableList(); } @@ -70,6 +72,11 @@ public ObservableList HeightStructures { get; private set; } /// + /// Gets the available height structures of this instance. + /// + public StructureCollection HeightStructuresCollection { get; private set; } + + /// /// Gets the available foreshore profiles for this instance. /// public ObservableList ForeshoreProfiles { get; private set; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -103,7 +103,7 @@ .Concat(failureMechanism.SectionResults) .Concat(failureMechanism.CalculationsGroup.GetAllChildrenRecursive()) .Concat(failureMechanism.ForeshoreProfiles) - .Concat(failureMechanism.HeightStructures) + .Concat(failureMechanism.HeightStructuresCollection) .ToArray(); failureMechanism.ClearAllSections(); @@ -115,8 +115,8 @@ failureMechanism.ForeshoreProfiles.Clear(); changedObjects.Add(failureMechanism.ForeshoreProfiles); - failureMechanism.HeightStructures.Clear(); - changedObjects.Add(failureMechanism.HeightStructures); + failureMechanism.HeightStructuresCollection.Clear(); + changedObjects.Add(failureMechanism.HeightStructuresCollection); return new ClearResults(changedObjects, removedObjects); } @@ -155,8 +155,8 @@ changedObservables.Add(result); } - failureMechanism.HeightStructures.Remove(structure); - changedObservables.Add(failureMechanism.HeightStructures); + failureMechanism.HeightStructuresCollection.Remove(structure); + changedObservables.Add(failureMechanism.HeightStructuresCollection); return changedObservables; } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismTest.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismTest.cs (.../HeightStructuresFailureMechanismTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismTest.cs (.../HeightStructuresFailureMechanismTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -51,7 +51,7 @@ Assert.IsFalse(failureMechanism.CalculationsGroup.IsNameEditable); CollectionAssert.IsEmpty(failureMechanism.Sections); CollectionAssert.IsEmpty(failureMechanism.Calculations); - CollectionAssert.IsEmpty(failureMechanism.HeightStructures); + CollectionAssert.IsEmpty(failureMechanism.HeightStructuresCollection); CollectionAssert.IsEmpty(failureMechanism.CalculationsGroup.Children); CollectionAssert.IsEmpty(failureMechanism.ForeshoreProfiles); } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs (.../TestHeightStructureTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs (.../TestHeightStructureTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -32,64 +32,97 @@ [Test] public void Constructor_ExpectedValues() { - // Setup - const string expectedName = "Test"; - var expectedLocation = new Point2D(0, 0); - // Call var heightStructure = new TestHeightStructure(); // Assert - AssertTestHeightStructure(heightStructure, expectedName, expectedLocation); + const string expectedName = "Test"; + const string expectedId = "Id"; + var expectedLocation = new Point2D(0, 0); + AssertTestHeightStructure(heightStructure, expectedName, expectedId, expectedLocation); } [Test] public void Constructor_CustomLocation_ExpectedValues() { // Setup - const string expectedName = "Test"; var customLocation = new Point2D(10, 20); // Call var heightStructure = new TestHeightStructure(customLocation); // Assert - AssertTestHeightStructure(heightStructure, expectedName, customLocation); + const string expectedName = "Test"; + const string expectedId = "Id"; + AssertTestHeightStructure(heightStructure, expectedName, expectedId, customLocation); } [Test] + public void Constructor_CustomLocationAndId_ExpectedValues() + { + // Setup + var customLocation = new Point2D(10, 20); + const string customId = "A different id for structure"; + + // Call + var heightStructure = new TestHeightStructure(customLocation, customId); + + // Assert + const string expectedName = "Test"; + AssertTestHeightStructure(heightStructure, expectedName, customId, customLocation); + } + + [Test] public void Constructor_CustomName_ExpectedValues() { // Setup const string customName = "A different name for structure"; - var expectedLocation = new Point2D(0, 0); // Call var heightStructure = new TestHeightStructure(customName); // Assert - AssertTestHeightStructure(heightStructure, customName, expectedLocation); + const string expectedId = "Id"; + var expectedLocation = new Point2D(0, 0); + AssertTestHeightStructure(heightStructure, customName, expectedId, expectedLocation); } [Test] - public void Constructor_CustomNameAndLocation_ExpectedValues() + public void Constructor_CustomNameAndId_ExpectedValues() { // Setup const string customName = "A different name for structure"; + const string customId = "A different id for structure"; + + // Call + var heightStructure = new TestHeightStructure(customName, customId); + + // Assert + var expectedLocation = new Point2D(0, 0); + AssertTestHeightStructure(heightStructure, customName, customId, expectedLocation); + } + + [Test] + public void Constructor_CustomNameAndLocationAndId_ExpectedValues() + { + // Setup + const string customName = "A different name for structure"; + const string customId = "A different id for structure"; var customLocation = new Point2D(10, 20); // Call - var heightStructure = new TestHeightStructure(customName, customLocation); + var heightStructure = new TestHeightStructure(customName, customId, customLocation); // Assert - AssertTestHeightStructure(heightStructure, customName, customLocation); + AssertTestHeightStructure(heightStructure, customName, customId, customLocation); } - private static void AssertTestHeightStructure(TestHeightStructure heightStructure, string expectedName, Point2D expectedLocation) + private static void AssertTestHeightStructure(HeightStructure heightStructure, string expectedName, + string expectedId, Point2D expectedLocation) { Assert.IsInstanceOf(heightStructure); Assert.AreEqual(expectedName, heightStructure.Name); - Assert.AreEqual("Id", heightStructure.Id); + Assert.AreEqual(expectedId, heightStructure.Id); Assert.AreEqual(expectedLocation.X, heightStructure.Location.X); Assert.AreEqual(expectedLocation.Y, heightStructure.Location.Y); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs (.../TestHeightStructure.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs (.../TestHeightStructure.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -40,25 +40,42 @@ /// /// The name of the structure. public TestHeightStructure(string name) - : this(name, new Point2D(0.0, 0.0)) {} + : this(name, "Id", new Point2D(0.0, 0.0)) {} /// /// Creates a new instance of . /// + /// The name of the structure. + /// The id of the structure. + public TestHeightStructure(string name, string id) + : this(name, id, new Point2D(0.0, 0.0)) {} + + /// + /// Creates a new instance of . + /// /// The location of the structure. public TestHeightStructure(Point2D location) - : this("Test", location) {} + : this("Test", "Id", location) {} /// /// Creates a new instance of . /// + /// The location of the structure. + /// The id of the structure. + public TestHeightStructure(Point2D location, string id) + : this("Test", id, location) {} + + /// + /// Creates a new instance of . + /// /// The name of the structure. + /// The id of the structure. /// The location of the structure. - public TestHeightStructure(string name, Point2D location) + public TestHeightStructure(string name, string id, Point2D location) : base(new ConstructionProperties { Name = name, - Id = "Id", + Id = id, Location = location, StructureNormalOrientation = (RoundedDouble) 0.12345, LevelCrestStructure = Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructureTreeNodeInfoTest.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructureTreeNodeInfoTest.cs (.../HeightStructureTreeNodeInfoTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructureTreeNodeInfoTest.cs (.../HeightStructureTreeNodeInfoTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -159,9 +159,9 @@ calculation3Observer.Expect(o => o.UpdateObserver()).Repeat.Never(); mocks.ReplayAll(); - var nodeData = new TestHeightStructure(new Point2D(1, 0)); - var otherProfile1 = new TestHeightStructure(new Point2D(2, 0)); - var otherProfile2 = new TestHeightStructure(new Point2D(6, 0)); + var nodeData = new TestHeightStructure(new Point2D(1, 0), "Id1"); + var otherProfile1 = new TestHeightStructure(new Point2D(2, 0), "Id2"); + var otherProfile2 = new TestHeightStructure(new Point2D(6, 0), "Id6"); var calculation1 = new StructuresCalculation { @@ -190,12 +190,6 @@ var failureMechanism = new HeightStructuresFailureMechanism { - HeightStructures = - { - nodeData, - otherProfile1, - otherProfile2 - }, CalculationsGroup = { Children = @@ -206,6 +200,14 @@ } } }; + + failureMechanism.HeightStructuresCollection.AddRange(new[] + { + nodeData, + otherProfile1, + otherProfile2 + }, "some location"); + failureMechanism.AddSection(new FailureMechanismSection("A", new[] { new Point2D(0, 0), @@ -216,7 +218,7 @@ new Point2D(4, 0), new Point2D(9, 0) })); - failureMechanism.HeightStructures.Attach(observer); + failureMechanism.HeightStructuresCollection.Attach(observer); failureMechanism.SectionResults.ElementAt(0).Calculation = calculation1; failureMechanism.SectionResults.ElementAt(1).Calculation = calculation3; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs (.../HeightStructuresDataSynchronizationServiceTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs (.../HeightStructuresDataSynchronizationServiceTest.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) @@ -282,7 +282,7 @@ .Concat(failureMechanism.SectionResults) .Concat(failureMechanism.CalculationsGroup.GetAllChildrenRecursive()) .Concat(failureMechanism.ForeshoreProfiles) - .Concat(failureMechanism.HeightStructures) + .Concat(failureMechanism.HeightStructuresCollection) .ToArray(); // Call @@ -295,14 +295,14 @@ CollectionAssert.IsEmpty(failureMechanism.SectionResults); CollectionAssert.IsEmpty(failureMechanism.CalculationsGroup.Children); CollectionAssert.IsEmpty(failureMechanism.ForeshoreProfiles); - CollectionAssert.IsEmpty(failureMechanism.HeightStructures); + CollectionAssert.IsEmpty(failureMechanism.HeightStructuresCollection); IObservable[] array = results.ChangedObjects.ToArray(); Assert.AreEqual(4, array.Length); CollectionAssert.Contains(array, failureMechanism); CollectionAssert.Contains(array, failureMechanism.CalculationsGroup); CollectionAssert.Contains(array, failureMechanism.ForeshoreProfiles); - CollectionAssert.Contains(array, failureMechanism.HeightStructures); + CollectionAssert.Contains(array, failureMechanism.HeightStructuresCollection); CollectionAssert.AreEquivalent(expectedRemovedObjects, results.RemovedObjects); } @@ -312,7 +312,7 @@ { // Setup HeightStructuresFailureMechanism failureMechanism = CreateFullyConfiguredFailureMechanism(); - HeightStructure structure = failureMechanism.HeightStructures[0]; + HeightStructure structure = failureMechanism.HeightStructuresCollection[0]; StructuresCalculation[] calculationsWithStructure = failureMechanism.Calculations .Cast>() .Where(c => ReferenceEquals(c.InputParameters.Structure, structure)) @@ -339,7 +339,7 @@ // 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.DoesNotContain(failureMechanism.HeightStructures, structure); + CollectionAssert.DoesNotContain(failureMechanism.HeightStructuresCollection, structure); foreach (StructuresCalculation calculation in calculationsWithStructure) { Assert.IsNull(calculation.InputParameters.Structure); @@ -356,7 +356,7 @@ IObservable[] array = affectedObjects.ToArray(); Assert.AreEqual(1 + calculationsWithOutput.Length + calculationsWithStructure.Length + sectionResultsWithStructure.Length, array.Length); - CollectionAssert.Contains(array, failureMechanism.HeightStructures); + CollectionAssert.Contains(array, failureMechanism.HeightStructuresCollection); foreach (StructuresCalculation calculation in calculationsWithStructure) { CollectionAssert.Contains(array, calculation.InputParameters); @@ -385,8 +385,8 @@ new Point2D(2, 0), new Point2D(4, 0) }); - var structure1 = new TestHeightStructure(new Point2D(1, 0)); - var structure2 = new TestHeightStructure(new Point2D(3, 0)); + var structure1 = new TestHeightStructure(new Point2D(1, 0), "Id 1,0"); + var structure2 = new TestHeightStructure(new Point2D(3, 0), "Id 3,0"); var profile = new TestForeshoreProfile(); StructuresCalculation calculation1 = new TestHeightStructuresCalculation { @@ -415,11 +415,6 @@ }; var failureMechanism = new HeightStructuresFailureMechanism { - HeightStructures = - { - structure1, - structure2 - }, ForeshoreProfiles = { profile @@ -441,6 +436,12 @@ } }; + failureMechanism.HeightStructuresCollection.AddRange(new[] + { + structure1, + structure2 + }, "someLocation"); + failureMechanism.AddSection(section1); failureMechanism.AddSection(section2); HeightStructuresFailureMechanismSectionResult result1 = failureMechanism.SectionResults