Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs =================================================================== diff -u -r508d720230c5f63bce7f95bddc3b7a04808d267d -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 508d720230c5f63bce7f95bddc3b7a04808d267d) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -111,7 +111,7 @@ Version = entity.HydraulicDatabaseVersion }; - foreach (var hydraulicLocationEntity in entity.HydraulicLocationEntities) + foreach (var hydraulicLocationEntity in entity.HydraulicLocationEntities.OrderBy(hl => hl.Order)) { assessmentSection.HydraulicBoundaryDatabase.Locations.Add(hydraulicLocationEntity.Read(collector)); } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -rbc7cd9cbf90d04580e6b3542c56edc590867c43a -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision bc7cd9cbf90d04580e6b3542c56edc590867c43a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -96,12 +96,12 @@ ReadProbabilityAssessmentInput(entity.PipingFailureMechanismMetaEntities, failureMechanism.PipingProbabilityAssessmentInput); } - foreach (var stochasticSoilModelEntity in entity.StochasticSoilModelEntities) + foreach (var stochasticSoilModelEntity in entity.StochasticSoilModelEntities.OrderBy(ssm => ssm.Order)) { failureMechanism.StochasticSoilModels.Add(stochasticSoilModelEntity.Read(collector)); } - foreach (SurfaceLineEntity surfaceLineEntity in entity.SurfaceLineEntities) + foreach (SurfaceLineEntity surfaceLineEntity in entity.SurfaceLineEntities.OrderBy(sl => sl.Order)) { failureMechanism.SurfaceLines.Add(surfaceLineEntity.Read(collector)); } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilProfileEntityReadExtensions.cs =================================================================== diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilProfileEntityReadExtensions.cs (.../SoilProfileEntityReadExtensions.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/SoilProfileEntityReadExtensions.cs (.../SoilProfileEntityReadExtensions.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -54,7 +54,7 @@ { return collector.Get(entity); } - IEnumerable layers = entity.SoilLayerEntities.Select(sl => sl.Read()); + IEnumerable layers = entity.SoilLayerEntities.OrderBy(sl => sl.Order).Select(sl => sl.Read()); var pipingSoilProfile = new PipingSoilProfile(entity.Name, entity.Bottom.ToNullAsNaN(), layers, SoilProfileType.SoilProfile1D, -1) { StorageId = entity.SoilProfileEntityId Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs =================================================================== diff -u -r508d720230c5f63bce7f95bddc3b7a04808d267d -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs (.../StochasticSoilModelEntityReadExtensions.cs) (revision 508d720230c5f63bce7f95bddc3b7a04808d267d) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs (.../StochasticSoilModelEntityReadExtensions.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Application.Ringtoets.Storage.BinaryConverters; using Application.Ringtoets.Storage.DbContext; @@ -66,7 +67,7 @@ private static void ReadStochasticSoilProfiles(this StochasticSoilModelEntity entity, StochasticSoilModel model, ReadConversionCollector collector) { - foreach (var stochasticSoilProfileEntity in entity.StochasticSoilProfileEntities) + foreach (var stochasticSoilProfileEntity in entity.StochasticSoilProfileEntities.OrderBy(ssp => ssp.Order)) { model.StochasticSoilProfiles.Add(stochasticSoilProfileEntity.Read(collector)); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -re159c065240db0cf858fed2fc110acf6e1f07204 -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision e159c065240db0cf858fed2fc110acf6e1f07204) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -131,11 +131,13 @@ entity.HydraulicDatabaseVersion = testVersion; entity.HydraulicLocationEntities.Add(new HydraulicLocationEntity { - Name = "someName" + Name = "A", + Order = 1 }); entity.HydraulicLocationEntities.Add(new HydraulicLocationEntity { - Name = "someName" + Name = "B", + Order = 0 }); var collector = new ReadConversionCollector(); @@ -145,6 +147,7 @@ // Assert Assert.AreEqual(2, section.HydraulicBoundaryDatabase.Locations.Count); + CollectionAssert.AreEqual(new[]{"B", "A"}, section.HydraulicBoundaryDatabase.Locations.Select(l => l.Name)); Assert.AreEqual(testLocation, section.HydraulicBoundaryDatabase.FilePath); Assert.AreEqual(testVersion, section.HydraulicBoundaryDatabase.Version); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs =================================================================== diff -u -re159c065240db0cf858fed2fc110acf6e1f07204 -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision e159c065240db0cf858fed2fc110acf6e1f07204) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -131,11 +131,15 @@ { new StochasticSoilModelEntity { - StochasticSoilModelSegmentPointData = emptySegmentPointsData + StochasticSoilModelSegmentPointData = emptySegmentPointsData, + Name = "A", + Order = 1 }, new StochasticSoilModelEntity { - StochasticSoilModelSegmentPointData = emptySegmentPointsData + StochasticSoilModelSegmentPointData = emptySegmentPointsData, + Name = "B", + Order = 0 } } }; @@ -147,6 +151,7 @@ // Assert Assert.AreEqual(2, failureMechanism.StochasticSoilModels.Count); + CollectionAssert.AreEqual(new[]{"B", "A"}, failureMechanism.StochasticSoilModels.Select(s => s.Name)); } [Test] @@ -164,11 +169,15 @@ { new SurfaceLineEntity { - PointsData = emptyPointsData + PointsData = emptyPointsData, + Name = "1", + Order = 1 }, new SurfaceLineEntity { - PointsData = emptyPointsData + PointsData = emptyPointsData, + Name = "2", + Order = 0 } } }; @@ -180,6 +189,7 @@ // Assert Assert.AreEqual(2, failureMechanism.SurfaceLines.Count); + CollectionAssert.AreEqual(new[]{"2", "1"}, failureMechanism.SurfaceLines.Select(sl => sl.Name)); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilProfileEntityReadExtensionsTest.cs =================================================================== diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilProfileEntityReadExtensionsTest.cs (.../SoilProfileEntityReadExtensionsTest.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/SoilProfileEntityReadExtensionsTest.cs (.../SoilProfileEntityReadExtensionsTest.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -20,13 +20,16 @@ // All rights reserved. using System; +using System.Linq; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using Application.Ringtoets.Storage.Read.Piping; using NUnit.Framework; +using Ringtoets.Piping.Primitives; + namespace Application.Ringtoets.Storage.Test.Read.Piping { [TestFixture] @@ -63,20 +66,31 @@ Bottom = bottom, SoilLayerEntities = { - new SoilLayerEntity{ Top = bottom + 0.5 }, - new SoilLayerEntity{ Top = bottom + 1.2 } + new SoilLayerEntity + { + Top = bottom + 0.5, + MaterialName = "A", + Order = 1 + }, + new SoilLayerEntity + { + Top = bottom + 1.2, + MaterialName = "B", + Order = 0 + } } }; var collector = new ReadConversionCollector(); // Call - var failureMechanism = entity.Read(collector); + PipingSoilProfile profile = entity.Read(collector); // Assert - Assert.IsNotNull(failureMechanism); - Assert.AreEqual(entityId, failureMechanism.StorageId); - Assert.AreEqual(testName, failureMechanism.Name); - Assert.AreEqual(bottom, failureMechanism.Bottom, 1e-6); + Assert.IsNotNull(profile); + Assert.AreEqual(entityId, profile.StorageId); + Assert.AreEqual(testName, profile.Name); + Assert.AreEqual(bottom, profile.Bottom, 1e-6); + CollectionAssert.AreEqual(new[]{"B", "A"}, profile.Layers.Select(l => l.MaterialName)); } [Test] @@ -113,13 +127,13 @@ }; var collector = new ReadConversionCollector(); - var firstFailureMechanism = entity.Read(collector); + PipingSoilProfile profile = entity.Read(collector); // Call var secondFailureMechanism = entity.Read(collector); // Assert - Assert.AreSame(firstFailureMechanism, secondFailureMechanism); + Assert.AreSame(profile, secondFailureMechanism); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs =================================================================== diff -u -r508d720230c5f63bce7f95bddc3b7a04808d267d -r61af2d41d88907e33ced4083ec53c2327718fd9a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision 508d720230c5f63bce7f95bddc3b7a04808d267d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision 61af2d41d88907e33ced4083ec53c2327718fd9a) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Application.Ringtoets.Storage.BinaryConverters; using Application.Ringtoets.Storage.DbContext; @@ -93,8 +94,10 @@ SoilLayerEntities = { new SoilLayerEntity() - } - } + }, + Name = "A" + }, + Order = 1 }, new StochasticSoilProfileEntity { @@ -103,18 +106,21 @@ SoilLayerEntities = { new SoilLayerEntity() - } - } + }, + Name = "B" + }, + Order = 0 } } }; var collector = new ReadConversionCollector(); // Call - var model = entity.Read(collector); + StochasticSoilModel model = entity.Read(collector); // Assert Assert.AreEqual(2, model.StochasticSoilProfiles.Count); + CollectionAssert.AreEqual(new[]{"B", "A"}, model.StochasticSoilProfiles.Select(ssp => ssp.SoilProfile.Name)); } [Test]