Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/AssessmentSectionConverter.cs =================================================================== diff -u -r4e65fa5d8abdf1c0a9238492cdbcd7d2b3fa2d0f -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/AssessmentSectionConverter.cs (.../AssessmentSectionConverter.cs) (revision 4e65fa5d8abdf1c0a9238492cdbcd7d2b3fa2d0f) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Converters/AssessmentSectionConverter.cs (.../AssessmentSectionConverter.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -47,11 +47,10 @@ throw new ArgumentNullException("entity"); } - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(GetAssessmentSectionComposition(entity.Composition)); assessmentSection.StorageId = entity.AssessmentSectionEntityId; assessmentSection.Name = entity.Name ?? string.Empty; assessmentSection.FailureMechanismContribution.Norm = entity.Norm; - assessmentSection.ChangeComposition(GetAssessmentSectionComposition(entity.Composition)); if (entity.HydraulicDatabaseLocation != null && entity.HydraulicDatabaseVersion != null) { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/AssessmentSectionConverterTest.cs =================================================================== diff -u -r4e65fa5d8abdf1c0a9238492cdbcd7d2b3fa2d0f -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/AssessmentSectionConverterTest.cs (.../AssessmentSectionConverterTest.cs) (revision 4e65fa5d8abdf1c0a9238492cdbcd7d2b3fa2d0f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Converters/AssessmentSectionConverterTest.cs (.../AssessmentSectionConverterTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -107,7 +107,7 @@ { // Setup AssessmentSectionConverter converter = new AssessmentSectionConverter(); - AssessmentSection assessmentSection = new AssessmentSection(); + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call TestDelegate test = () => converter.ConvertModelToEntity(assessmentSection, null); @@ -143,7 +143,7 @@ const string name = "test"; const string hydraulicDatabaseVersion = "1.0"; const string hydraulicDatabasePath = "testPath"; - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(composition) { StorageId = storageId, Name = name, @@ -157,7 +157,6 @@ FilePath = hydraulicDatabasePath } }; - assessmentSection.ChangeComposition(composition); AssessmentSectionEntity assessmentSectionEntity = new AssessmentSectionEntity { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/AssessmentSectionPersistorTest.cs =================================================================== diff -u -r4e65fa5d8abdf1c0a9238492cdbcd7d2b3fa2d0f -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/AssessmentSectionPersistorTest.cs (.../AssessmentSectionPersistorTest.cs) (revision 4e65fa5d8abdf1c0a9238492cdbcd7d2b3fa2d0f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/AssessmentSectionPersistorTest.cs (.../AssessmentSectionPersistorTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -252,7 +252,7 @@ mockRepository.ReplayAll(); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call TestDelegate test = () => persistor.InsertModel(null, assessmentSection, 0); @@ -293,17 +293,15 @@ mockRepository.ReplayAll(); ICollection parentNavigationProperty = new List(); - AssessmentSection assessmentSection = - new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(composition) + { + Name = name, + FailureMechanismContribution = { - Name = name, - FailureMechanismContribution = - { - Norm = norm - }, - HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() - }; - assessmentSection.ChangeComposition(composition); + Norm = norm + }, + HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() + }; AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); @@ -345,7 +343,7 @@ AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { StorageId = storageId, Name = name, @@ -385,7 +383,7 @@ const double locationX = 253; const double locationY = 123; - AssessmentSection assessmentSection = new AssessmentSection(); + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); assessmentSection.HydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(locationId, name, locationX, locationY) { @@ -424,7 +422,7 @@ mockRepository.ReplayAll(); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call TestDelegate test = () => persistor.UpdateModel(null, assessmentSection, 0); @@ -464,7 +462,7 @@ AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); ICollection parentNavigationProperty = new List(); - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(composition) { Name = name, FailureMechanismContribution = @@ -473,7 +471,6 @@ }, HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() }; - assessmentSection.ChangeComposition(composition); // Call persistor.UpdateModel(parentNavigationProperty, assessmentSection, 0); @@ -501,16 +498,15 @@ mockRepository.ReplayAll(); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); ICollection parentNavigationProperty = new List(); - AssessmentSection assessmentSection = - new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) + { + StorageId = storageId, + Name = name, + FailureMechanismContribution = { - StorageId = storageId, - Name = name, - FailureMechanismContribution = - { - Norm = norm - } - }; + Norm = norm + } + }; // Call TestDelegate test = () => persistor.UpdateModel(parentNavigationProperty, assessmentSection, 0); @@ -536,7 +532,7 @@ AssessmentSectionEntityId = 4567L } }; - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { StorageId = storageId }; @@ -569,7 +565,7 @@ AssessmentSectionEntityId = storageId } }; - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { StorageId = storageId }; @@ -606,7 +602,7 @@ Composition = (short)AssessmentSectionComposition.Dune } }; - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(composition) { StorageId = storageId, Name = name, @@ -616,7 +612,6 @@ }, HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() }; - assessmentSection.ChangeComposition(composition); // Call persistor.UpdateModel(parentNavigationProperty, assessmentSection, 0); @@ -664,7 +659,7 @@ AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(composition) { StorageId = storageId, Name = name, @@ -674,7 +669,6 @@ }, HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() }; - assessmentSection.ChangeComposition(composition); // Call persistor.UpdateModel(parentNavigationProperty, assessmentSection, 0); @@ -702,7 +696,7 @@ mockRepository.ReplayAll(); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { StorageId = storageId, HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() @@ -769,16 +763,15 @@ ringtoetsEntities.AssessmentSectionEntities.Add(entityToDelete); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - AssessmentSection assessmentSection = - new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) + { + Name = name, + FailureMechanismContribution = { - Name = name, - FailureMechanismContribution = - { - Norm = norm - }, - HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() - }; + Norm = norm + }, + HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() + }; persistor.InsertModel(parentNavigationProperty, assessmentSection, 0); @@ -822,7 +815,7 @@ ringtoetsEntities.AssessmentSectionEntities.Add(entityToUpdate); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(composition) { Name = name, FailureMechanismContribution = @@ -832,7 +825,6 @@ StorageId = storageId, HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() }; - assessmentSection.ChangeComposition(composition); TestDelegate updateTest = () => persistor.UpdateModel(parentNavigationProperty, assessmentSection, 0); Assert.DoesNotThrow(updateTest, "Precondition failed: Update should not throw exception."); @@ -874,7 +866,7 @@ ringtoetsEntities.AssessmentSectionEntities.Add(secondEntityToDelete); AssessmentSectionPersistor persistor = new AssessmentSectionPersistor(ringtoetsEntities); - AssessmentSection assessmentSection = new AssessmentSection + AssessmentSection assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() }; @@ -926,7 +918,7 @@ for (var i = 0; i < numberOfInserts; i++) { - assessmentSections.Add(new AssessmentSection + assessmentSections.Add(new AssessmentSection(AssessmentSectionComposition.Dike) { StorageId = 0L, HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/PipingFailureMechanismPersistorTest.cs =================================================================== diff -u -rc116b4635603c6d5bbdedb837f68fd3839ece6ca -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/PipingFailureMechanismPersistorTest.cs (.../PipingFailureMechanismPersistorTest.cs) (revision c116b4635603c6d5bbdedb837f68fd3839ece6ca) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/PipingFailureMechanismPersistorTest.cs (.../PipingFailureMechanismPersistorTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -29,6 +29,8 @@ using Application.Ringtoets.Storage.TestUtil; using NUnit.Framework; using Rhino.Mocks; + +using Ringtoets.Common.Data; using Ringtoets.Integration.Data; using Ringtoets.Piping.Data; @@ -125,7 +127,7 @@ { // Setup const long storageId = 1234L; - Piping model = new Piping() + Piping model = new Piping { StorageId = storageId }; @@ -137,7 +139,7 @@ var ringtoetsEntities = mockRepository.StrictMock(); PipingFailureMechanismPersistor persistor = new PipingFailureMechanismPersistor(ringtoetsEntities); - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call persistor.LoadModel(entity, assessmentSection.Piping); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ProjectPersistorTest.cs =================================================================== diff -u -r8b5a6f938fe2b04cd78623649df37580e145055f -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ProjectPersistorTest.cs (.../ProjectPersistorTest.cs) (revision 8b5a6f938fe2b04cd78623649df37580e145055f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Persistors/ProjectPersistorTest.cs (.../ProjectPersistorTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -29,6 +29,8 @@ using Core.Common.Base.Data; using NUnit.Framework; using Rhino.Mocks; + +using Ringtoets.Common.Data; using Ringtoets.Integration.Data; namespace Application.Ringtoets.Storage.Test.Persistors @@ -277,7 +279,7 @@ Description = description, Items = { - new AssessmentSection() + new AssessmentSection(AssessmentSectionComposition.Dike) } }; @@ -441,7 +443,7 @@ Description = description, Items = { - new AssessmentSection() + new AssessmentSection(AssessmentSectionComposition.Dike) } }; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs =================================================================== diff -u -r8b5a6f938fe2b04cd78623649df37580e145055f -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision 8b5a6f938fe2b04cd78623649df37580e145055f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -45,7 +45,7 @@ Description = "description", Items = { - new AssessmentSection + new AssessmentSection(AssessmentSectionComposition.Dike) { Name = "assessmentSection", HydraulicBoundaryDatabase = GetHydraulicBoundaryDatabase(), Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs =================================================================== diff -u -rc116b4635603c6d5bbdedb837f68fd3839ece6ca -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision c116b4635603c6d5bbdedb837f68fd3839ece6ca) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -5,6 +5,8 @@ using Core.Common.Controls.Commands; using Core.Common.Gui; using Core.Common.Utils.IO; + +using Ringtoets.Common.Data; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.IO; using Ringtoets.HydraRing.Data; @@ -55,7 +57,7 @@ private AssessmentSection CreateNewDemoAssessmentSection() { - var demoAssessmentSection = new AssessmentSection + var demoAssessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { Name = "Demo traject" }; Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs =================================================================== diff -u -rc116b4635603c6d5bbdedb837f68fd3839ece6ca -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision c116b4635603c6d5bbdedb837f68fd3839ece6ca) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -30,7 +30,6 @@ using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data.Placeholders; using Ringtoets.Integration.Data.Properties; -using Ringtoets.Piping.Data; namespace Ringtoets.Integration.Data { @@ -46,7 +45,9 @@ /// /// Initializes a new instance of the class. /// - public AssessmentSection() + /// The composition of the assessment section, e.g. what + /// type of elements can be found within the assessment section. + public AssessmentSection(AssessmentSectionComposition composition) { Name = Resources.AssessmentSection_DisplayName; @@ -62,7 +63,7 @@ DuneErosion = new Placeholder(Resources.ErosionFailureMechanism_DisplayName); FailureMechanismContribution = new FailureMechanismContribution(GetFailureMechanisms(), 30, 30000); - ChangeComposition(AssessmentSectionComposition.Dike); + ChangeComposition(composition); } /// Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs =================================================================== diff -u -r3434a272cc8bfb25dae4bd7bd50afedb377343c0 -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision 3434a272cc8bfb25dae4bd7bd50afedb377343c0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -51,7 +51,7 @@ CreateData = owner => { var project = (Project) owner; - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); assessmentSection.Name = GetUniqueForAssessmentSectionName(project, assessmentSection.Name); return assessmentSection; } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u -rc116b4635603c6d5bbdedb837f68fd3839ece6ca -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision c116b4635603c6d5bbdedb837f68fd3839ece6ca) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -6,7 +6,6 @@ using Ringtoets.Common.Data; using Ringtoets.Common.Data.Contribution; -using Ringtoets.Piping.Data; using RingtoetsIntegrationResources = Ringtoets.Integration.Data.Properties.Resources; @@ -16,10 +15,13 @@ public class AssessmentSectionTest { [Test] - public void DefaultConstructor_ExpectedValues() + [TestCase(AssessmentSectionComposition.Dike)] + [TestCase(AssessmentSectionComposition.Dune)] + [TestCase(AssessmentSectionComposition.DikeAndDune)] + public void Constructor_ExpectedValues(AssessmentSectionComposition composition) { // Call - var section = new AssessmentSection(); + var section = new AssessmentSection(composition); var pipingName = "Dijken - Piping"; var grassErosionName = "Dijken - Graserosie kruin en binnentalud"; @@ -32,8 +34,6 @@ var grassRevetmentName = "Dijken - Grasbekledingen"; var duneErosionName = "Duinen - Erosie"; - var pipingContribution = 24; - var contributions = new double[] { pipingContribution, 24, 4, 2, 4, 2, 4, 3, 3, 0, 30 }; var names = new[] { pipingName, grassErosionName, @@ -54,8 +54,8 @@ Assert.AreEqual("Traject", section.Name); Assert.IsNull(section.Comments); - Assert.IsNull(section.ReferenceLine); - Assert.AreEqual(AssessmentSectionComposition.Dike, section.Composition); + Assert.IsNull(section.ReferenceLine); + Assert.AreEqual(composition, section.Composition); Assert.IsInstanceOf(section.FailureMechanismContribution); CollectionAssert.IsEmpty(section.Piping.StochasticSoilModels); @@ -72,22 +72,11 @@ Assert.AreEqual(grassRevetmentName, section.GrassRevetment.Name); Assert.AreEqual(duneErosionName, section.DuneErosion.Name); - Assert.AreEqual(24, section.Piping.Contribution); - Assert.AreEqual(24, section.GrassErosion.Contribution); - Assert.AreEqual(4, section.MacrostabilityInward.Contribution); - Assert.AreEqual(2, section.Overtopping.Contribution); - Assert.AreEqual(4, section.Closing.Contribution); - Assert.AreEqual(2, section.FailingOfConstruction.Contribution); - Assert.AreEqual(4, section.StoneRevetment.Contribution); - Assert.AreEqual(3, section.AsphaltRevetment.Contribution); - Assert.AreEqual(3, section.GrassRevetment.Contribution); - Assert.AreEqual(0, section.DuneErosion.Contribution); + AssertExpectedContributions(composition, section); - Assert.AreEqual(contributions, section.FailureMechanismContribution.Distribution.Select(d => d.Contribution)); Assert.AreEqual(names, section.FailureMechanismContribution.Distribution.Select(d => d.Assessment)); Assert.AreEqual(Enumerable.Repeat(30000.0, 11), section.FailureMechanismContribution.Distribution.Select(d => d.Norm)); - Assert.AreEqual(pipingContribution, section.Piping.SemiProbabilisticInput.Contribution); Assert.AreEqual(30000.0, section.Piping.SemiProbabilisticInput.Norm); Assert.AreEqual(double.NaN, section.Piping.SemiProbabilisticInput.SectionLength); @@ -98,7 +87,7 @@ public void Name_SetingNewValue_GetNewValue() { // Setup - var section = new AssessmentSection(); + var section = new AssessmentSection(AssessmentSectionComposition.Dike); const string newValue = "new value"; @@ -113,7 +102,7 @@ public void Comments_SettingNewValue_GetNewValue() { // Setup - var section = new AssessmentSection(); + var section = new AssessmentSection(AssessmentSectionComposition.Dike); const string newValue = "new comment value"; @@ -131,8 +120,7 @@ public void GetFailureMechanisms_Always_ReturnAllFailureMechanisms(AssessmentSectionComposition composition) { // Setup - var assessmentSection = new AssessmentSection(); - assessmentSection.ChangeComposition(composition); + var assessmentSection = new AssessmentSection(composition); // Call var failureMechanisms = assessmentSection.GetFailureMechanisms().ToArray(); @@ -158,8 +146,7 @@ public void FailureMechanismContribution_DefaultConstructed_FailureMechanismContributionWithItemsForFailureMechanismsAndOther(AssessmentSectionComposition composition) { // Setup - var assessmentSection = new AssessmentSection(); - assessmentSection.ChangeComposition(composition); + var assessmentSection = new AssessmentSection(composition); const int norm = 30000; @@ -193,7 +180,13 @@ public void ChangeComposition_ToTargetValue_UpdateContributions(AssessmentSectionComposition composition) { // Setup - var assessmentSection = new AssessmentSection(); + var initialComposition = composition == AssessmentSectionComposition.Dike ? + AssessmentSectionComposition.Dune : + AssessmentSectionComposition.Dike; + var assessmentSection = new AssessmentSection(initialComposition); + + // Precondition + Assert.AreNotEqual(assessmentSection.Composition, composition); // Call assessmentSection.ChangeComposition(composition); @@ -285,7 +278,7 @@ public void ReferenceLine_SetNewValue_GetNewValue() { // Setup - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); var referenceLine = new ReferenceLine(); @@ -301,7 +294,7 @@ { // Setup var random = new Random(21); - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ReferenceLine referenceLine = new ReferenceLine(); Point2D[] somePointsCollection = @@ -324,7 +317,7 @@ public void ReferenceLine_Null_GeneralPipingInputSectionLengthNaN() { // Setup - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call assessmentSection.ReferenceLine = null; Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs =================================================================== diff -u -ra7a3af9bffa76922cf344ee2134ad30078de878d -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs (.../AssessmentSectionPropertiesTest.cs) (revision a7a3af9bffa76922cf344ee2134ad30078de878d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionPropertiesTest.cs (.../AssessmentSectionPropertiesTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -27,7 +27,7 @@ public void GetProperties_WithData_ReturnExpectedValues() { // Setup - var assessmentSection = new AssessmentSection + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { Name = "Test" }; @@ -50,7 +50,7 @@ projectObserver.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); assessmentSection.Attach(projectObserver); var properties = new AssessmentSectionProperties Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs =================================================================== diff -u -rd5326f028bd3c83dc0479606ea1e2e1ead914e29 -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision d5326f028bd3c83dc0479606ea1e2e1ead914e29) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/FailureMechanismContributionViewTest.cs (.../FailureMechanismContributionViewTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -291,8 +291,7 @@ // Setup using (var view = new FailureMechanismContributionView()) { - var assessmentSection = new AssessmentSection(); - assessmentSection.ChangeComposition(composition); + var assessmentSection = new AssessmentSection(composition); var context = new FailureMechanismContributionContext(assessmentSection.FailureMechanismContribution, assessmentSection); @@ -320,8 +319,7 @@ // Setup using (var view = new FailureMechanismContributionView()) { - var assessmentSection = new AssessmentSection(); - assessmentSection.ChangeComposition(initialComposition); + var assessmentSection = new AssessmentSection(initialComposition); var context = new FailureMechanismContributionContext(assessmentSection.FailureMechanismContribution, assessmentSection); @@ -366,8 +364,7 @@ observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); - var assessmentSection = new AssessmentSection(); - assessmentSection.ChangeComposition(initialComposition); + var assessmentSection = new AssessmentSection(initialComposition); assessmentSection.Attach(observer); var context = new FailureMechanismContributionContext(assessmentSection.FailureMechanismContribution, assessmentSection); Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingCalculationsViewIntegrationTest.cs =================================================================== diff -u -rc116b4635603c6d5bbdedb837f68fd3839ece6ca -re8d521c72f8cd2fa9e02dc14c38700bd051ac838 --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingCalculationsViewIntegrationTest.cs (.../PipingCalculationsViewIntegrationTest.cs) (revision c116b4635603c6d5bbdedb837f68fd3839ece6ca) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingCalculationsViewIntegrationTest.cs (.../PipingCalculationsViewIntegrationTest.cs) (revision e8d521c72f8cd2fa9e02dc14c38700bd051ac838) @@ -37,7 +37,7 @@ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; // Set all necessary data to the view - var assessmentSection = new AssessmentSection(); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); pipingCalculationsView.Data = assessmentSection.Piping.CalculationsGroup; pipingCalculationsView.AssessmentSection = assessmentSection; pipingCalculationsView.Piping = assessmentSection.Piping;