Index: Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailurePathViewTest.cs =================================================================== diff -u -r9e166d21af80d81af53fbc4a1cabfcc18f6f0f11 -r70cf59df57f263b83322a645a5b0a4daa9328b74 --- Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailurePathViewTest.cs (.../GrassCoverErosionOutwardsFailurePathViewTest.cs) (revision 9e166d21af80d81af53fbc4a1cabfcc18f6f0f11) +++ Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailurePathViewTest.cs (.../GrassCoverErosionOutwardsFailurePathViewTest.cs) (revision 70cf59df57f263b83322a645a5b0a4daa9328b74) @@ -19,7 +19,6 @@ // 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 System.Threading; @@ -101,8 +100,6 @@ public void Constructor_WithAllData_DataUpdatedToCollectionOfFilledMapData() { // Setup - var random = new Random(39); - var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SpecificFailureMechanismView.cs =================================================================== diff -u -ref30f9470b4ebd9560616050b9ab74e356c6bb1c -r70cf59df57f263b83322a645a5b0a4daa9328b74 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SpecificFailureMechanismView.cs (.../SpecificFailureMechanismView.cs) (revision ef30f9470b4ebd9560616050b9ab74e356c6bb1c) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/SpecificFailureMechanismView.cs (.../SpecificFailureMechanismView.cs) (revision 70cf59df57f263b83322a645a5b0a4daa9328b74) @@ -30,6 +30,7 @@ using Riskeer.Common.Forms.Factories; using Riskeer.Common.Forms.MapLayers; using Riskeer.Common.Forms.Views; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; namespace Riskeer.Integration.Forms.Views { @@ -45,6 +46,8 @@ private HydraulicBoundaryLocationsMapLayer hydraulicBoundaryLocationsMapLayer; + private NonCalculatableFailureMechanismSectionResultsMapLayer assemblyResultMapLayer; + private MapLineData referenceLineMapData; private MapLineData sectionsMapData; @@ -94,6 +97,7 @@ referenceLineObserver.Dispose(); failureMechanismObserver.Dispose(); hydraulicBoundaryLocationsMapLayer.Dispose(); + assemblyResultMapLayer.Dispose(); if (disposing) { @@ -148,8 +152,12 @@ sectionsMapDataCollection.Add(sectionsStartPointMapData); sectionsMapDataCollection.Add(sectionsEndPointMapData); + assemblyResultMapLayer = new NonCalculatableFailureMechanismSectionResultsMapLayer( + failureMechanism, sr => FailureMechanismAssemblyFactory.AssembleSection(sr, failureMechanism, assessmentSection)); + failureMechanismMapDataCollection.Add(referenceLineMapData); failureMechanismMapDataCollection.Add(sectionsMapDataCollection); + failureMechanismMapDataCollection.Add(assemblyResultMapLayer.MapData); failureMechanismMapDataCollection.Add(hydraulicBoundaryLocationsMapLayer.MapData); } Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SpecificFailureMechanismViewTest.cs =================================================================== diff -u -ref30f9470b4ebd9560616050b9ab74e356c6bb1c -r70cf59df57f263b83322a645a5b0a4daa9328b74 --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SpecificFailureMechanismViewTest.cs (.../SpecificFailureMechanismViewTest.cs) (revision ef30f9470b4ebd9560616050b9ab74e356c6bb1c) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Views/SpecificFailureMechanismViewTest.cs (.../SpecificFailureMechanismViewTest.cs) (revision 70cf59df57f263b83322a645a5b0a4daa9328b74) @@ -30,6 +30,9 @@ using Core.Components.Gis.Forms; using NUnit.Framework; using Rhino.Mocks; +using Riskeer.AssemblyTool.KernelWrapper.Calculators; +using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators; +using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.FailureMechanism; using Riskeer.Common.Data.Hydraulics; @@ -45,7 +48,8 @@ { private const int referenceLineIndex = 0; private const int sectionsCollectionIndex = 1; - private const int hydraulicBoundaryLocationsIndex = 2; + private const int assemblyResultsIndex = 2; + private const int hydraulicBoundaryLocationsIndex = 3; private const int sectionsIndex = 0; private const int sectionsStartPointIndex = 1; @@ -137,22 +141,29 @@ new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2)) }); - // Call - SpecificFailureMechanismView view = CreateView(failureMechanism, assessmentSection); + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + SpecificFailureMechanismView view = CreateView(failureMechanism, assessmentSection); - // Assert - MapDataCollection mapData = view.Map.Data; - List mapDataList = mapData.Collection.ToList(); - Assert.AreEqual(3, mapDataList.Count); + // Assert + MapDataCollection mapData = view.Map.Data; + List mapDataList = mapData.Collection.ToList(); + Assert.AreEqual(4, mapDataList.Count); - MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); - IEnumerable sectionsCollection = ((MapDataCollection) mapDataList[sectionsCollectionIndex]).Collection; - MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionsCollection.ElementAt(sectionsIndex)); - MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionsCollection.ElementAt(sectionsStartPointIndex)); - MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsCollection.ElementAt(sectionsEndPointIndex)); + IEnumerable sectionsCollection = ((MapDataCollection) mapDataList[sectionsCollectionIndex]).Collection; + MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionsCollection.ElementAt(sectionsIndex)); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionsCollection.ElementAt(sectionsStartPointIndex)); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsCollection.ElementAt(sectionsEndPointIndex)); - MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(assessmentSection, mapDataList[hydraulicBoundaryLocationsIndex]); + MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(assessmentSection, mapDataList[hydraulicBoundaryLocationsIndex]); + + var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + MapDataTestHelper.AssertAssemblyMapData(failureMechanism, calculator.FailureMechanismSectionAssemblyResultOutput, mapDataList[assemblyResultsIndex]); + } } [Test] @@ -277,6 +288,7 @@ const int updatedReferenceLineLayerIndex = referenceLineIndex + hydraulicBoundaryLocationsIndex; const int updatedSectionsCollectionLayerIndex = sectionsCollectionIndex - 1; const int updatedHydraulicBoundaryLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1; + const int updatedAssemblyResultsIndex = assemblyResultsIndex - 1; var assessmentSection = new AssessmentSectionStub(); var failureMechanism = new SpecificFailureMechanism(); @@ -300,6 +312,9 @@ MapData hydraulicBoundaryLocationsData = mapDataCollection.ElementAt(updatedHydraulicBoundaryLocationsLayerIndex); Assert.AreEqual("Hydraulische belastingen", hydraulicBoundaryLocationsData.Name); + var assemblyResultsData = (MapLineData) mapDataCollection.ElementAt(updatedAssemblyResultsIndex); + Assert.AreEqual("Duidingsklasse per vak", assemblyResultsData.Name); + // When var points = new List { @@ -338,7 +353,7 @@ List mapDataList = mapDataCollection.Collection.ToList(); - Assert.AreEqual(3, mapDataList.Count); + Assert.AreEqual(4, mapDataList.Count); var referenceLineMapData = (MapLineData) mapDataList[referenceLineIndex]; Assert.AreEqual("Referentielijn", referenceLineMapData.Name); @@ -356,9 +371,13 @@ var sectionsStartPointMapData = (MapPointData) sectionsDataList[sectionsStartPointIndex]; var sectionsEndPointMapData = (MapPointData) sectionsDataList[sectionsEndPointIndex]; + var assemblyResultsMapData = (MapLineData) mapDataList[assemblyResultsIndex]; + Assert.AreEqual("Duidingsklasse per vak", assemblyResultsMapData.Name); + CollectionAssert.IsEmpty(sectionsMapData.Features); CollectionAssert.IsEmpty(sectionsStartPointMapData.Features); CollectionAssert.IsEmpty(sectionsEndPointMapData.Features); + CollectionAssert.IsEmpty(assemblyResultsMapData.Features); } ///