Fisheye: Tag b2d867a7173eebede05e3375ee77210ba82b9a06 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsAssemblyMapDataFeaturesFactory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismView.cs
===================================================================
diff -u -r959e36fe7429c4b54ccd4b197fce3fa2b89bda88 -rb2d867a7173eebede05e3375ee77210ba82b9a06
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismView.cs (.../MacroStabilityInwardsFailureMechanismView.cs) (revision 959e36fe7429c4b54ccd4b197fce3fa2b89bda88)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismView.cs (.../MacroStabilityInwardsFailureMechanismView.cs) (revision b2d867a7173eebede05e3375ee77210ba82b9a06)
@@ -218,10 +218,7 @@
#region Calculations MapData
- ///
- /// Updates the calculations map data.
- ///
- protected virtual void UpdateCalculationsMapData()
+ private void UpdateCalculationsMapData()
{
SetCalculationsMapData();
calculationsMapData.NotifyObservers();
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailurePathView.cs
===================================================================
diff -u -rdfd2e82406d3cafb83004a065b3ea1f943ced729 -rb2d867a7173eebede05e3375ee77210ba82b9a06
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailurePathView.cs (.../MacroStabilityInwardsFailurePathView.cs) (revision dfd2e82406d3cafb83004a065b3ea1f943ced729)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailurePathView.cs (.../MacroStabilityInwardsFailurePathView.cs) (revision b2d867a7173eebede05e3375ee77210ba82b9a06)
@@ -26,8 +26,8 @@
using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.FailureMechanism;
using Riskeer.Common.Forms.Factories;
+using Riskeer.Common.Forms.MapLayers;
using Riskeer.MacroStabilityInwards.Data;
-using Riskeer.MacroStabilityInwards.Forms.Factories;
using MacroStabilityInwardsDataResources = Riskeer.MacroStabilityInwards.Data.Properties.Resources;
namespace Riskeer.MacroStabilityInwards.Forms.Views
@@ -41,15 +41,10 @@
private MapPointData sectionsStartPointMapData;
private MapPointData sectionsEndPointMapData;
- private MapLineData simpleAssemblyMapData;
- private MapLineData detailedAssemblyMapData;
- private MapLineData tailorMadeAssemblyMapData;
- private MapLineData combinedAssemblyMapData;
+ private CalculatableFailureMechanismSectionResultsMapLayer assemblyResultsMapLayer;
private Observer failureMechanismObserver;
- private RecursiveObserver, MacroStabilityInwardsFailureMechanismSectionResultOld> sectionResultObserver;
-
///
/// Creates a new instance of .
///
@@ -61,94 +56,48 @@
protected override void Dispose(bool disposing)
{
failureMechanismObserver.Dispose();
- sectionResultObserver.Dispose();
+ assemblyResultsMapLayer.Dispose();
base.Dispose(disposing);
}
protected override void CreateMapData()
{
base.CreateMapData();
-
+
MapDataCollection sectionsMapDataCollection = RiskeerMapDataFactory.CreateSectionsMapDataCollection();
sectionsMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsMapData();
sectionsStartPointMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsStartPointMapData();
sectionsEndPointMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsEndPointMapData();
- MapDataCollection assemblyMapDataCollection = AssemblyMapDataFactory.CreateAssemblyMapDataCollection();
- tailorMadeAssemblyMapData = AssemblyMapDataFactory.CreateTailorMadeAssemblyMapData();
- detailedAssemblyMapData = AssemblyMapDataFactory.CreateDetailedAssemblyMapData();
- simpleAssemblyMapData = AssemblyMapDataFactory.CreateSimpleAssemblyMapData();
- combinedAssemblyMapData = AssemblyMapDataFactory.CreateCombinedAssemblyMapData();
+ assemblyResultsMapLayer = new CalculatableFailureMechanismSectionResultsMapLayer(
+ FailureMechanism, sr => MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleSection(sr, FailureMechanism, AssessmentSection));
sectionsMapDataCollection.Add(sectionsMapData);
sectionsMapDataCollection.Add(sectionsStartPointMapData);
sectionsMapDataCollection.Add(sectionsEndPointMapData);
MapDataCollection.Insert(3, sectionsMapDataCollection);
- assemblyMapDataCollection.Add(tailorMadeAssemblyMapData);
- assemblyMapDataCollection.Add(detailedAssemblyMapData);
- assemblyMapDataCollection.Add(simpleAssemblyMapData);
- assemblyMapDataCollection.Add(combinedAssemblyMapData);
- MapDataCollection.Insert(4, assemblyMapDataCollection);
+ MapDataCollection.Insert(4, assemblyResultsMapLayer.MapData);
}
protected override void CreateObservers()
{
base.CreateObservers();
-
+
failureMechanismObserver = new Observer(UpdateFailureMechanismMapData)
{
Observable = FailureMechanism
};
-
- sectionResultObserver = new RecursiveObserver, MacroStabilityInwardsFailureMechanismSectionResultOld>(UpdateAssemblyMapData, sr => sr)
- {
- Observable = FailureMechanism.SectionResultsOld
- };
}
protected override void SetAllMapDataFeatures()
{
base.SetAllMapDataFeatures();
SetSectionsMapData();
-
- SetAssemblyMapData();
}
- #region Assembly MapData
-
- private void UpdateAssemblyMapData()
- {
- SetAssemblyMapData();
- simpleAssemblyMapData.NotifyObservers();
- detailedAssemblyMapData.NotifyObservers();
- tailorMadeAssemblyMapData.NotifyObservers();
- combinedAssemblyMapData.NotifyObservers();
- }
-
- private void SetAssemblyMapData()
- {
- simpleAssemblyMapData.Features = MacroStabilityInwardsAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(FailureMechanism);
- detailedAssemblyMapData.Features = MacroStabilityInwardsAssemblyMapDataFeaturesFactory.CreateDetailedAssemblyFeatures(FailureMechanism, AssessmentSection);
- tailorMadeAssemblyMapData.Features = MacroStabilityInwardsAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(FailureMechanism, AssessmentSection);
- combinedAssemblyMapData.Features = MacroStabilityInwardsAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(FailureMechanism, AssessmentSection);
- }
-
- #endregion
-
- #region Calculations MapData
-
- protected override void UpdateCalculationsMapData()
- {
- base.UpdateCalculationsMapData();
-
- UpdateAssemblyMapData();
- }
-
- #endregion
-
#region FailureMechanism MapData
private void UpdateFailureMechanismMapData()
@@ -157,8 +106,6 @@
sectionsMapData.NotifyObservers();
sectionsStartPointMapData.NotifyObservers();
sectionsEndPointMapData.NotifyObservers();
-
- UpdateAssemblyMapData();
}
private void SetSectionsMapData()
Fisheye: Tag b2d867a7173eebede05e3375ee77210ba82b9a06 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsAssemblyMapDataFeaturesFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailurePathViewTest.cs
===================================================================
diff -u -r3a4cc52eb9f7524ca64d6c2ab3a90230db2149c7 -rb2d867a7173eebede05e3375ee77210ba82b9a06
--- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailurePathViewTest.cs (.../MacroStabilityInwardsFailurePathViewTest.cs) (revision 3a4cc52eb9f7524ca64d6c2ab3a90230db2149c7)
+++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailurePathViewTest.cs (.../MacroStabilityInwardsFailurePathViewTest.cs) (revision b2d867a7173eebede05e3375ee77210ba82b9a06)
@@ -66,18 +66,9 @@
private const int sectionsStartPointIndex = 1;
private const int sectionsEndPointIndex = 2;
- private const int tailorMadeAssemblyIndex = 0;
- private const int detailedAssemblyIndex = 1;
- private const int simpleAssemblyIndex = 2;
- private const int combinedAssemblyIndex = 3;
-
private const int sectionsObserverIndex = 0;
private const int sectionsStartPointObserverIndex = 1;
private const int sectionsEndPointObserverIndex = 2;
- private const int simpleAssemblyObserverIndex = 3;
- private const int detailedAssemblyObserverIndex = 4;
- private const int tailorMadeAssemblyObserverIndex = 5;
- private const int combinedAssemblyObserverIndex = 6;
private Form testForm;
@@ -204,21 +195,15 @@
hydraulicBoundaryLocation2
});
- var expectedSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var expectedDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var expectedTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var expectedCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
-
- using (new AssemblyToolCalculatorFactoryConfigOld())
+ using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance;
- FailureMechanismSectionAssemblyCalculatorOldStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var failureMechanismSectionAssemblyResult = new FailureMechanismSectionAssemblyResult(
+ random.NextDouble(), random.NextDouble(), random.NextDouble(),
+ random.NextEnumValue());
+ calculator.FailureMechanismSectionAssemblyResultOutput = failureMechanismSectionAssemblyResult;
- calculator.SimpleAssessmentAssemblyOutput = expectedSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = expectedDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = expectedTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = expectedCombinedAssembly;
-
// Call
MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, assessmentSection);
@@ -242,18 +227,13 @@
AssertStochasticSoilModelsMapData(failureMechanism.StochasticSoilModels, mapDataList[stochasticSoilModelsIndex]);
AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]);
- MapDataTestHelper.AssertAssemblyMapDataCollection(expectedSimpleAssembly,
- expectedDetailedAssembly,
- expectedTailorMadeAssembly,
- expectedCombinedAssembly,
- (MapDataCollection) mapDataList[assemblyResultsIndex],
- failureMechanism);
+ MapDataTestHelper.AssertAssemblyMapData(failureMechanism, failureMechanismSectionAssemblyResult, mapDataList[assemblyResultsIndex]);
}
}
[Test]
[Apartment(ApartmentState.STA)]
- public void GivenViewWithFailureMechanismSectionsData_WhenFailureMechanismSectionsUpdatedAndNotified_ThenMapDataUpdated()
+ public void GivenViewWithFailureMechanismSectionsData_WhenFailureMechanismUpdatedAndNotified_ThenMapDataUpdated()
{
// Given
var failureMechanism = new MacroStabilityInwardsFailureMechanism();
@@ -272,10 +252,6 @@
observers[sectionsObserverIndex].Expect(obs => obs.UpdateObserver());
observers[sectionsStartPointObserverIndex].Expect(obs => obs.UpdateObserver());
observers[sectionsEndPointObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
mocks.ReplayAll();
// When
@@ -298,382 +274,13 @@
[Test]
[Apartment(ApartmentState.STA)]
- public void GivenViewWithCalculationGroupData_WhenCalculationGroupUpdatedAndNotified_ThenMapDataUpdated()
- {
- // Given
- var surfaceLineA = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineA.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.0),
- new Point3D(3.0, 0.0, 1.7)
- });
- surfaceLineA.ReferenceLineIntersectionWorldPoint = new Point2D(1.3, 1.3);
-
- MacroStabilityInwardsCalculationScenario calculationA = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());
- calculationA.InputParameters.SurfaceLine = surfaceLineA;
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- failureMechanism.CalculationsGroup.Children.Add(calculationA);
-
- MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, new AssessmentSectionStub());
-
- IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
-
- var surfaceLineB = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineB.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.5),
- new Point3D(3.0, 0.0, 1.8)
- });
- surfaceLineB.ReferenceLineIntersectionWorldPoint = new Point2D(1.5, 1.5);
-
- MacroStabilityInwardsCalculationScenario calculationB = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());
- calculationB.InputParameters.SurfaceLine = surfaceLineB;
-
- var calculationMapData = (MapLineData) map.Data.Collection.ElementAt(calculationsIndex);
-
- var mocks = new MockRepository();
- IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- mocks.ReplayAll();
-
- // When
- failureMechanism.CalculationsGroup.Children.Add(calculationB);
- failureMechanism.CalculationsGroup.NotifyObservers();
-
- // Then
- AssertCalculationsMapData(failureMechanism.Calculations.Cast(), calculationMapData);
- mocks.VerifyAll();
- }
-
- [Test]
- [Apartment(ApartmentState.STA)]
- public void GivenViewWithCalculationInputData_WhenCalculationInputUpdatedAndNotified_ThenMapDataUpdated()
- {
- // Given
- var surfaceLineA = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineA.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.0),
- new Point3D(3.0, 0.0, 1.7)
- });
- surfaceLineA.ReferenceLineIntersectionWorldPoint = new Point2D(1.3, 1.3);
-
- MacroStabilityInwardsCalculationScenario calculationA = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());
- calculationA.InputParameters.SurfaceLine = surfaceLineA;
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- failureMechanism.CalculationsGroup.Children.Add(calculationA);
-
- MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, new AssessmentSectionStub());
-
- IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
-
- var surfaceLineB = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineB.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.5),
- new Point3D(3.0, 0.0, 1.8)
- });
- surfaceLineB.ReferenceLineIntersectionWorldPoint = new Point2D(1.5, 1.5);
-
- var calculationMapData = (MapLineData) map.Data.Collection.ElementAt(calculationsIndex);
-
- var mocks = new MockRepository();
- IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- mocks.ReplayAll();
-
- // When
- calculationA.InputParameters.SurfaceLine = surfaceLineB;
- calculationA.InputParameters.NotifyObservers();
-
- // Then
- AssertCalculationsMapData(failureMechanism.Calculations.Cast(), calculationMapData);
- mocks.VerifyAll();
- }
-
- [Test]
- [Apartment(ApartmentState.STA)]
- public void GivenViewWithCalculationData_WhenCalculationUpdatedAndNotified_ThenMapDataUpdated()
- {
- // Given
- var surfaceLineA = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineA.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.0),
- new Point3D(3.0, 0.0, 1.7)
- });
- surfaceLineA.ReferenceLineIntersectionWorldPoint = new Point2D(1.3, 1.3);
-
- MacroStabilityInwardsCalculationScenario calculationA = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());
- calculationA.InputParameters.SurfaceLine = surfaceLineA;
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- failureMechanism.CalculationsGroup.Children.Add(calculationA);
-
- MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, new AssessmentSectionStub());
-
- IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
-
- var calculationMapData = (MapLineData) map.Data.Collection.ElementAt(calculationsIndex);
-
- var mocks = new MockRepository();
- IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- mocks.ReplayAll();
-
- // When
- calculationA.Name = "new name";
- calculationA.NotifyObservers();
-
- // Then
- AssertCalculationsMapData(failureMechanism.Calculations.Cast(), calculationMapData);
- mocks.VerifyAll();
- }
-
- [Test]
- [Apartment(ApartmentState.STA)]
- public void GivenViewWithAssemblyData_WhenFailureMechanismNotified_ThenMapDataUpdated()
- {
- // Given
- var random = new Random(39);
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- FailureMechanismTestHelper.AddSections(failureMechanism, random.Next(1, 10));
-
- var originalSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
-
- using (new AssemblyToolCalculatorFactoryConfigOld())
- {
- var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance;
- FailureMechanismSectionAssemblyCalculatorOldStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
-
- calculator.SimpleAssessmentAssemblyOutput = originalSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = originalDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = originalTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = originalCombinedAssembly;
-
- MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, new AssessmentSectionStub());
-
- IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
-
- var mocks = new MockRepository();
- IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
- observers[sectionsObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[sectionsStartPointObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[sectionsEndPointObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- mocks.ReplayAll();
-
- // Precondition
- var assemblyMapData = (MapDataCollection) map.Data.Collection.ElementAt(assemblyResultsIndex);
- MapDataTestHelper.AssertAssemblyMapDataCollection(originalSimpleAssembly,
- originalDetailedAssembly,
- originalTailorMadeAssembly,
- originalCombinedAssembly,
- assemblyMapData,
- failureMechanism);
-
- // When
- var updatedSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- calculator.SimpleAssessmentAssemblyOutput = updatedSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = updatedDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = updatedTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = updatedCombinedAssembly;
- failureMechanism.NotifyObservers();
-
- // Then
- MapDataTestHelper.AssertAssemblyMapDataCollection(updatedSimpleAssembly,
- updatedDetailedAssembly,
- updatedTailorMadeAssembly,
- updatedCombinedAssembly,
- assemblyMapData,
- failureMechanism);
- mocks.VerifyAll();
- }
- }
-
- [Test]
- [Apartment(ApartmentState.STA)]
- public void GivenViewWithAssemblyData_WhenCalculationNotified_ThenMapDataUpdated()
- {
- // Given
- var random = new Random(39);
- var surfaceLineA = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineA.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.0),
- new Point3D(3.0, 0.0, 1.7)
- });
-
- var surfaceLineB = new MacroStabilityInwardsSurfaceLine(string.Empty);
- surfaceLineB.SetGeometry(new[]
- {
- new Point3D(0.0, 0.0, 1.5),
- new Point3D(3.0, 0.0, 1.8)
- });
- surfaceLineA.ReferenceLineIntersectionWorldPoint = new Point2D(1.3, 1.3);
- surfaceLineB.ReferenceLineIntersectionWorldPoint = new Point2D(1.5, 1.5);
-
- MacroStabilityInwardsCalculationScenario calculationA = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());
- calculationA.InputParameters.SurfaceLine = surfaceLineA;
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- failureMechanism.CalculationsGroup.Children.Add(calculationA);
- FailureMechanismTestHelper.AddSections(failureMechanism, random.Next(1, 10));
-
- var originalSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
-
- using (new AssemblyToolCalculatorFactoryConfigOld())
- {
- var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance;
- FailureMechanismSectionAssemblyCalculatorOldStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
-
- calculator.SimpleAssessmentAssemblyOutput = originalSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = originalDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = originalTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = originalCombinedAssembly;
-
- MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, new AssessmentSectionStub());
-
- IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
-
- var mocks = new MockRepository();
- IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- mocks.ReplayAll();
-
- // Precondition
- var assemblyMapData = (MapDataCollection) map.Data.Collection.ElementAt(assemblyResultsIndex);
- MapDataTestHelper.AssertAssemblyMapDataCollection(originalSimpleAssembly,
- originalDetailedAssembly,
- originalTailorMadeAssembly,
- originalCombinedAssembly,
- assemblyMapData,
- failureMechanism);
-
- // When
- var updatedSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- calculator.SimpleAssessmentAssemblyOutput = updatedSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = updatedDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = updatedTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = updatedCombinedAssembly;
- calculationA.NotifyObservers();
-
- // Then
- MapDataTestHelper.AssertAssemblyMapDataCollection(updatedSimpleAssembly,
- updatedDetailedAssembly,
- updatedTailorMadeAssembly,
- updatedCombinedAssembly,
- assemblyMapData,
- failureMechanism);
- mocks.VerifyAll();
- }
- }
-
- [Test]
- [Apartment(ApartmentState.STA)]
- public void GivenViewWithAssemblyData_WhenFailureMechanismSectionResultNotified_ThenMapDataUpdated()
- {
- // Given
- var random = new Random(39);
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- FailureMechanismTestHelper.AddSections(failureMechanism, random.Next(1, 10));
-
- var originalSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var originalCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
-
- using (new AssemblyToolCalculatorFactoryConfigOld())
- {
- var calculatorFactory = (TestAssemblyToolCalculatorFactoryOld) AssemblyToolCalculatorFactoryOld.Instance;
- FailureMechanismSectionAssemblyCalculatorOldStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
-
- calculator.SimpleAssessmentAssemblyOutput = originalSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = originalDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = originalTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = originalCombinedAssembly;
-
- MacroStabilityInwardsFailurePathView view = CreateView(failureMechanism, new AssessmentSectionStub());
-
- IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
-
- var mocks = new MockRepository();
- IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
- observers[simpleAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[detailedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[tailorMadeAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- observers[combinedAssemblyObserverIndex].Expect(obs => obs.UpdateObserver());
- mocks.ReplayAll();
-
- // Precondition
- var assemblyMapData = (MapDataCollection) map.Data.Collection.ElementAt(assemblyResultsIndex);
- MapDataTestHelper.AssertAssemblyMapDataCollection(originalSimpleAssembly,
- originalDetailedAssembly,
- originalTailorMadeAssembly,
- originalCombinedAssembly,
- assemblyMapData,
- failureMechanism);
-
- // When
- var updatedSimpleAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedDetailedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedTailorMadeAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- var updatedCombinedAssembly = new FailureMechanismSectionAssemblyOld(random.NextDouble(), random.NextEnumValue());
- calculator.SimpleAssessmentAssemblyOutput = updatedSimpleAssembly;
- calculator.DetailedAssessmentAssemblyOutput = updatedDetailedAssembly;
- calculator.TailorMadeAssessmentAssemblyOutput = updatedTailorMadeAssembly;
- calculator.CombinedAssemblyOutput = updatedCombinedAssembly;
- failureMechanism.SectionResultsOld.First().NotifyObservers();
-
- // Then
- MapDataTestHelper.AssertAssemblyMapDataCollection(updatedSimpleAssembly,
- updatedDetailedAssembly,
- updatedTailorMadeAssembly,
- updatedCombinedAssembly,
- assemblyMapData,
- failureMechanism);
- mocks.VerifyAll();
- }
- }
-
- [Test]
- [Apartment(ApartmentState.STA)]
public void UpdateObserver_DataUpdated_MapLayersSameOrder()
{
// Setup
const int updatedReferenceLineLayerIndex = referenceLineIndex + 6;
const int updatedSurfaceLineLayerIndex = surfaceLinesIndex - 1;
const int updatedSectionCollectionIndex = sectionsCollectionIndex - 1;
- const int updatedAssemblyResultsCollectionIndex = assemblyResultsIndex - 1;
+ const int updatedAssemblyResultsIndex = assemblyResultsIndex - 1;
const int updatedHydraulicLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1;
const int updatedStochasticSoilModelsLayerIndex = stochasticSoilModelsIndex - 1;
const int updatedCalculationsIndex = calculationsIndex - 1;
@@ -702,8 +309,8 @@
var sectionsData = (MapDataCollection) mapDataCollection.ElementAt(updatedSectionCollectionIndex);
Assert.AreEqual("Vakindeling", sectionsData.Name);
- var assemblyResultsData = (MapDataCollection) mapDataCollection.ElementAt(updatedAssemblyResultsCollectionIndex);
- Assert.AreEqual("Toetsoordeel", assemblyResultsData.Name);
+ var assemblyResultsData = (MapLineData) mapDataCollection.ElementAt(updatedAssemblyResultsIndex);
+ Assert.AreEqual("Duidingsklasse per vak", assemblyResultsData.Name);
var hydraulicLocationsData = (MapPointData) mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);
Assert.AreEqual("Hydraulische belastingen", hydraulicLocationsData.Name);
@@ -736,8 +343,8 @@
var actualSectionsData = (MapDataCollection) mapDataCollection.ElementAt(updatedSectionCollectionIndex);
Assert.AreEqual("Vakindeling", actualSectionsData.Name);
- var actualAssemblyResultsData = (MapDataCollection) mapDataCollection.ElementAt(updatedAssemblyResultsCollectionIndex);
- Assert.AreEqual("Toetsoordeel", actualAssemblyResultsData.Name);
+ var actualAssemblyResultsData = (MapLineData) mapDataCollection.ElementAt(updatedAssemblyResultsIndex);
+ Assert.AreEqual("Duidingsklasse per vak", actualAssemblyResultsData.Name);
var actualHydraulicLocationsData = (MapPointData) mapDataCollection.ElementAt(updatedHydraulicLocationsLayerIndex);
Assert.AreEqual("Hydraulische belastingen", actualHydraulicLocationsData.Name);
@@ -831,18 +438,21 @@
var referenceLineMapData = (MapLineData) mapDataList[referenceLineIndex];
var stochasticSoilModelsMapData = (MapLineData) mapDataList[stochasticSoilModelsIndex];
var surfaceLinesMapData = (MapLineData) mapDataList[surfaceLinesIndex];
+ var assemblyResultsMapData = (MapLineData) mapDataList[assemblyResultsIndex];
var hydraulicBoundaryLocationsMapData = (MapPointData) mapDataList[hydraulicBoundaryLocationsIndex];
var calculationsMapData = (MapLineData) mapDataList[calculationsIndex];
CollectionAssert.IsEmpty(referenceLineMapData.Features);
CollectionAssert.IsEmpty(stochasticSoilModelsMapData.Features);
CollectionAssert.IsEmpty(surfaceLinesMapData.Features);
+ CollectionAssert.IsEmpty(assemblyResultsMapData.Features);
CollectionAssert.IsEmpty(hydraulicBoundaryLocationsMapData.Features);
CollectionAssert.IsEmpty(calculationsMapData.Features);
Assert.AreEqual("Referentielijn", referenceLineMapData.Name);
Assert.AreEqual("Stochastische ondergrondmodellen", stochasticSoilModelsMapData.Name);
Assert.AreEqual("Profielschematisaties", surfaceLinesMapData.Name);
+ Assert.AreEqual("Duidingsklasse per vak", assemblyResultsMapData.Name);
Assert.AreEqual("Hydraulische belastingen", hydraulicBoundaryLocationsMapData.Name);
Assert.AreEqual("Berekeningen", calculationsMapData.Name);
@@ -862,26 +472,6 @@
Assert.AreEqual("Vakindeling (eindpunten)", sectionsEndPointMapData.Name);
Assert.AreEqual("Vakindeling (startpunten)", sectionsStartPointMapData.Name);
Assert.AreEqual("Vakindeling", sectionsMapData.Name);
-
- var assemblyResultsMapDataCollection = (MapDataCollection) mapDataList[assemblyResultsIndex];
- Assert.AreEqual("Toetsoordeel", assemblyResultsMapDataCollection.Name);
- List assemblyMapDataList = assemblyResultsMapDataCollection.Collection.ToList();
- Assert.AreEqual(4, assemblyMapDataList.Count);
-
- var combinedAssemblyMapData = (MapLineData) assemblyMapDataList[combinedAssemblyIndex];
- var simpleAssemblyMapData = (MapLineData) assemblyMapDataList[simpleAssemblyIndex];
- var detailedAssemblyMapData = (MapLineData) assemblyMapDataList[detailedAssemblyIndex];
- var tailorMadeAssemblyMapData = (MapLineData) assemblyMapDataList[tailorMadeAssemblyIndex];
-
- CollectionAssert.IsEmpty(combinedAssemblyMapData.Features);
- CollectionAssert.IsEmpty(simpleAssemblyMapData.Features);
- CollectionAssert.IsEmpty(detailedAssemblyMapData.Features);
- CollectionAssert.IsEmpty(tailorMadeAssemblyMapData.Features);
-
- Assert.AreEqual("Gecombineerd toetsoordeel", combinedAssemblyMapData.Name);
- Assert.AreEqual("Toetsoordeel eenvoudige toets", simpleAssemblyMapData.Name);
- Assert.AreEqual("Toetsoordeel gedetailleerde toets", detailedAssemblyMapData.Name);
- Assert.AreEqual("Toetsoordeel toets op maat", tailorMadeAssemblyMapData.Name);
}
///
@@ -904,29 +494,11 @@
var sectionsEndPointMapDataObserver = mocks.StrictMock();
sectionsCollection[sectionsEndPointIndex].Attach(sectionsEndPointMapDataObserver);
-
- MapData[] assemblyResultsCollection = ((MapDataCollection) mapDataArray[assemblyResultsIndex]).Collection.ToArray();
- var simpleAssemblyMapDataObserver = mocks.StrictMock();
- assemblyResultsCollection[simpleAssemblyIndex].Attach(simpleAssemblyMapDataObserver);
-
- var detailedAssemblyMapDataObserver = mocks.StrictMock();
- assemblyResultsCollection[detailedAssemblyIndex].Attach(detailedAssemblyMapDataObserver);
-
- var tailorMadeAssemblyMapDataObserver = mocks.StrictMock();
- assemblyResultsCollection[tailorMadeAssemblyIndex].Attach(tailorMadeAssemblyMapDataObserver);
-
- var combinedAssemblyMapDataObserver = mocks.StrictMock();
- assemblyResultsCollection[combinedAssemblyIndex].Attach(combinedAssemblyMapDataObserver);
-
return new[]
{
sectionsMapDataObserver,
sectionsStartPointMapDataObserver,
- sectionsEndPointMapDataObserver,
- simpleAssemblyMapDataObserver,
- detailedAssemblyMapDataObserver,
- tailorMadeAssemblyMapDataObserver,
- combinedAssemblyMapDataObserver
+ sectionsEndPointMapDataObserver
};
}
}