Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -r436131a6956e94ebfd9ce917a4e8c9c307f662fb -rbbdeb25d8b1857b3fc69049808136a764a844448 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 436131a6956e94ebfd9ce917a4e8c9c307f662fb) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision bbdeb25d8b1857b3fc69049808136a764a844448) @@ -179,7 +179,7 @@ { if (project is RiskeerProject riskeerProject) { - AssessmentSection assessmentSection = riskeerProject.AssessmentSections.First(); + AssessmentSection assessmentSection = riskeerProject.AssessmentSection; return new AssessmentSectionStateRootContext(assessmentSection); } @@ -191,7 +191,7 @@ { if (project is RiskeerProject riskeerProject) { - return new HydraulicLoadsStateRootContext(riskeerProject.AssessmentSections.First()); + return new HydraulicLoadsStateRootContext(riskeerProject.AssessmentSection); } return null; @@ -201,7 +201,7 @@ { if (project is RiskeerProject riskeerProject) { - return new CalculationsStateRootContext(riskeerProject.AssessmentSections.First()); + return new CalculationsStateRootContext(riskeerProject.AssessmentSection); } return null; @@ -211,7 +211,7 @@ { if (project is RiskeerProject riskeerProject) { - return new FailurePathsStateRootContext(riskeerProject.AssessmentSections.First()); + return new FailurePathsStateRootContext(riskeerProject.AssessmentSection); } return null; @@ -885,9 +885,9 @@ { if (viewData is RiskeerProject project) { - foreach (AssessmentSection item in project.AssessmentSections) + if (project.AssessmentSection != null) { - yield return item; + yield return project.AssessmentSection; } } @@ -1348,8 +1348,8 @@ return; } - IEnumerable sectionsWithHydraulicBoundaryDatabaseLinked = riskeerProject.AssessmentSections.Where(i => i.HydraulicBoundaryDatabase.IsLinked()); - foreach (AssessmentSection section in sectionsWithHydraulicBoundaryDatabaseLinked) + AssessmentSection section = riskeerProject.AssessmentSection; + if (section != null && section.HydraulicBoundaryDatabase.IsLinked()) { string validationProblem = HydraulicBoundaryDatabaseHelper.ValidateFilesForCalculation( section.HydraulicBoundaryDatabase.FilePath, Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs =================================================================== diff -u -r79d532885abad824d867c39b42ac3a6598aefbcc -rbbdeb25d8b1857b3fc69049808136a764a844448 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 79d532885abad824d867c39b42ac3a6598aefbcc) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision bbdeb25d8b1857b3fc69049808136a764a844448) @@ -100,10 +100,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - new AssessmentSection(AssessmentSectionComposition.Dike) - } + AssessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) }; // When @@ -146,10 +143,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; // When @@ -182,14 +176,11 @@ var project = new RiskeerProject { - AssessmentSections = + AssessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { - new AssessmentSection(AssessmentSectionComposition.Dike) + HydraulicBoundaryDatabase = { - HydraulicBoundaryDatabase = - { - FilePath = nonExistingFile - } + FilePath = nonExistingFile } } }; @@ -721,19 +712,22 @@ public void GetChildDataWithViewDefinitions_ProjectWithChildren_ReturnChildren() { // Setup - var project = new RiskeerProject(); - project.AssessmentSections.Add(new AssessmentSection(AssessmentSectionComposition.Dike)); - project.AssessmentSections.Add(new AssessmentSection(AssessmentSectionComposition.Dike)); - project.AssessmentSections.Add(new AssessmentSection(AssessmentSectionComposition.Dike)); + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + var project = new RiskeerProject + { + AssessmentSection = assessmentSection + }; using (var plugin = new RiskeerPlugin()) { // Call IEnumerable childrenWithViewDefinitions = plugin.GetChildDataWithViewDefinitions(project); // Assert - List expectedResult = project.AssessmentSections; - CollectionAssert.AreEquivalent(expectedResult, childrenWithViewDefinitions); + CollectionAssert.AreEquivalent(new[] + { + project.AssessmentSection + }, childrenWithViewDefinitions); } } @@ -833,10 +827,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -901,10 +892,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -961,10 +949,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1021,10 +1006,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1076,10 +1058,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1133,10 +1112,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1190,10 +1166,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1244,10 +1217,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1301,10 +1271,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1358,10 +1325,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1415,10 +1379,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null); @@ -1469,10 +1430,7 @@ var project = new RiskeerProject { - AssessmentSections = - { - assessmentSection - } + AssessmentSection = assessmentSection }; gui.SetProject(project, null);