public void UpdateStructuresWithImportedData_CalculationWithStructureImportedStructureWithSameId_UpdatesCalculationInput() { // Setup const string sameId = "sameId"; StabilityPointStructure readStructure = new TestStabilityPointStructure(sameId, "new structure"); StabilityPointStructure structure = new TestStabilityPointStructure(sameId, "original structure"); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = structure }, Output = new TestStructuresOutput() }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { calculation } } }; StructureCollection <StabilityPointStructure> targetDataCollection = failureMechanism.StabilityPointStructures; targetDataCollection.AddRange(new[] { structure }, sourceFilePath); var strategy = new StabilityPointStructureUpdateDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateStructuresWithImportedData(new[] { readStructure }, sourceFilePath); // Assert Assert.IsTrue(calculation.HasOutput); AssertStabilityPointStructure(readStructure, structure); CollectionAssert.AreEqual(new IObservable[] { targetDataCollection, structure, calculation.InputParameters }, affectedObjects); }
public void ContextMenuStrip_FailureMechanismWithCalculationsContainingIllustrationPoints_ContextMenuItemClearIllustrationPointsEnabled() { // Setup var calculationWithIllustrationPoints = new TestStabilityPointStructuresCalculationScenario { Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint()) }; var calculationWithOutput = new TestStabilityPointStructuresCalculationScenario { Output = new TestStructuresOutput() }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { calculationWithIllustrationPoints, calculationWithOutput, new TestStabilityPointStructuresCalculationScenario() } } }; IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath"); var nodeData = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var plugin = new StabilityPointStructuresPlugin()) using (var treeViewControl = new TreeViewControl()) { var gui = mocksRepository.Stub <IGui>(); gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>()); mocksRepository.ReplayAll(); plugin.Gui = gui; TreeNodeInfo info = GetInfo(plugin); using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Call ToolStripItem toolStripItem = contextMenu.Items[contextMenuClearIllustrationPointsIndex]; // Assert Assert.IsTrue(toolStripItem.Enabled); } } }
public void UpdateStructuresWithImportedData_SectionResultWithStructureImportedStructureWithSameIdRemoved_UpdatesCalculationInput() { // Setup const string sameId = "id"; var originalMatchingPoint = new Point2D(0, 0); StabilityPointStructure removedStructure = new TestStabilityPointStructure(originalMatchingPoint, sameId); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = removedStructure } }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { calculation } } }; failureMechanism.StabilityPointStructures.AddRange(new[] { removedStructure }, sourceFilePath); FailureMechanismTestHelper.SetSections(failureMechanism, new[] { FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] { originalMatchingPoint, new Point2D(10, 10) }) }); var strategy = new StabilityPointStructureUpdateDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateStructuresWithImportedData(Enumerable.Empty <StabilityPointStructure>(), sourceFilePath); // Assert CollectionAssert.AreEqual(new IObservable[] { failureMechanism.StabilityPointStructures, calculation.InputParameters }, affectedObjects); }
public void Run_ValidCalculation_PerformValidationAndCalculationAndLogStartAndEnd() { // Setup var mockRepository = new MockRepository(); var calculatorFactory = mockRepository.StrictMock <IHydraRingCalculatorFactory>(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator <StructuresStabilityPointCalculationInput>(null)) .IgnoreArguments() .Return(new TestStructuresCalculator <StructuresStabilityPointCalculationInput>()); mockRepository.ReplayAll(); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); DataImportHelper.ImportHydraulicBoundaryDatabase(assessmentSection, validFilePath); var failureMechanism = new StabilityPointStructuresFailureMechanism(); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = StabilityPointStructureInflowModelType.LowSill, LoadSchematizationType = LoadSchematizationType.Linear } }; CalculatableActivity activity = StabilityPointStructuresCalculationActivityFactory.CreateCalculationActivity(calculation, failureMechanism, assessmentSection); using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { // Call Action call = () => activity.Run(); // Assert TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); Assert.AreEqual(6, msgs.Length); Assert.AreEqual($"Uitvoeren van berekening '{calculation.Name}' is gestart.", msgs[0]); CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]); CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[3]); StringAssert.StartsWith("Puntconstructies berekening is uitgevoerd op de tijdelijke locatie", msgs[4]); CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[5]); }); Assert.AreEqual(ActivityState.Executed, activity.State); } mockRepository.VerifyAll(); }
public void UpdateStructuresWithImportedData_CalculationWithSameReference_OnlyReturnsDistinctCalculationInput() { // Setup const string affectedId = "affectedId"; var affectedStructure = new TestStabilityPointStructure(affectedId, "Old name"); var affectedCalculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = affectedStructure }, Output = new TestStructuresOutput() }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { affectedCalculation, affectedCalculation } } }; StructureCollection <StabilityPointStructure> structures = failureMechanism.StabilityPointStructures; structures.AddRange(new[] { affectedStructure }, sourceFilePath); var structureToUpdateFrom = new TestStabilityPointStructure(affectedId, "New name"); var strategy = new StabilityPointStructureUpdateDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateStructuresWithImportedData(new[] { structureToUpdateFrom }, sourceFilePath); // Assert CollectionAssert.AreEquivalent(new IObservable[] { structures, affectedStructure, affectedCalculation.InputParameters }, affectedObjects); }
public void Run_HydraulicBoundaryDatabaseWithUsePreprocessorFalse_ExpectedPreprocessorDirectorySetToCalculator() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { HydraulicBoundaryDatabase = { FilePath = validFilePath, HydraulicLocationConfigurationSettings = { CanUsePreprocessor = true, UsePreprocessor = false, PreprocessorDirectory = "NonExistingPreprocessorDirectory" } } }; HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(assessmentSection.HydraulicBoundaryDatabase); var mockRepository = new MockRepository(); var calculatorFactory = mockRepository.StrictMock <IHydraRingCalculatorFactory>(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator <StructuresStabilityPointCalculationInput>( Arg <HydraRingCalculationSettings> .Is.NotNull)) .WhenCalled(invocation => { HydraRingCalculationSettingsTestHelper.AssertHydraRingCalculationSettings( HydraulicBoundaryCalculationSettingsFactory.CreateSettings(assessmentSection.HydraulicBoundaryDatabase), (HydraRingCalculationSettings)invocation.Arguments[0]); }) .Return(new TestStructuresCalculator <StructuresStabilityPointCalculationInput>()); mockRepository.ReplayAll(); var failureMechanism = new StabilityPointStructuresFailureMechanism(); var calculation = new TestStabilityPointStructuresCalculationScenario(); CalculatableActivity activity = StabilityPointStructuresCalculationActivityFactory.CreateCalculationActivity(calculation, failureMechanism, assessmentSection); using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { // Call activity.Run(); } // Assert mockRepository.VerifyAll(); }
public void Finish_ValidCalculationAndRan_SetsOutputAndNotifyObserversOfCalculation() { // Setup var mockRepository = new MockRepository(); var observer = mockRepository.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); var calculatorFactory = mockRepository.StrictMock <IHydraRingCalculatorFactory>(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator <StructuresStabilityPointCalculationInput>(null)) .IgnoreArguments() .Return(new TestStructuresCalculator <StructuresStabilityPointCalculationInput>()); mockRepository.ReplayAll(); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); DataImportHelper.ImportHydraulicBoundaryDatabase(assessmentSection, validFilePath); var failureMechanism = new StabilityPointStructuresFailureMechanism(); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = StabilityPointStructureInflowModelType.LowSill, LoadSchematizationType = LoadSchematizationType.Linear } }; calculation.Attach(observer); CalculatableActivity activity = StabilityPointStructuresCalculationActivityFactory.CreateCalculationActivity(calculation, failureMechanism, assessmentSection); using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { activity.Run(); } // Call activity.Finish(); // Assert Assert.IsNotNull(calculation.Output); mockRepository.VerifyAll(); }
public void Run_InvalidCalculationRan_PerformValidationAndCalculationActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var calculator = new TestStructuresCalculator <StructuresStabilityPointCalculationInput> { EndInFailure = endInFailure, LastErrorFileContent = lastErrorFileContent }; var mockRepository = new MockRepository(); var calculatorFactory = mockRepository.StrictMock <IHydraRingCalculatorFactory>(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator <StructuresStabilityPointCalculationInput>(null)) .IgnoreArguments() .Return(calculator); mockRepository.ReplayAll(); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); DataImportHelper.ImportHydraulicBoundaryDatabase(assessmentSection, validFilePath); var failureMechanism = new StabilityPointStructuresFailureMechanism(); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1), InflowModelType = StabilityPointStructureInflowModelType.LowSill, LoadSchematizationType = LoadSchematizationType.Linear } }; CalculatableActivity activity = StabilityPointStructuresCalculationActivityFactory.CreateCalculationActivity(calculation, failureMechanism, assessmentSection); using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { // Call activity.Run(); // Assert Assert.AreEqual(ActivityState.Failed, activity.State); } mockRepository.VerifyAll(); }
public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities() { // Setup StructuresCalculationScenario <StabilityPointStructuresInput> calculation = new TestStabilityPointStructuresCalculationScenario(); calculation.InputParameters.Structure = null; calculation.InputParameters.HydraulicBoundaryLocation = null; var failureMechanism = new StabilityPointStructuresFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup { Name = "A" }); failureMechanism.CalculationsGroup.Children.Add(calculation); var registry = new PersistenceRegistry(); // Call FailureMechanismEntity entity = failureMechanism.Create(registry); // Assert Assert.IsNotNull(entity); Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name); Assert.AreEqual(0, entity.CalculationGroupEntity.Order); CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1 .OrderBy(cge => cge.Order) .ToArray(); Assert.AreEqual(1, childGroupEntities.Length); CalculationGroupEntity childGroupEntity = childGroupEntities[0]; Assert.AreEqual("A", childGroupEntity.Name); Assert.AreEqual(0, childGroupEntity.Order); StabilityPointStructuresCalculationEntity[] calculationEntities = entity.CalculationGroupEntity.StabilityPointStructuresCalculationEntities .OrderBy(ce => ce.Order) .ToArray(); StabilityPointStructuresCalculationEntity calculationEntity = calculationEntities[0]; Assert.AreEqual("Nieuwe berekening", calculationEntity.Name); Assert.AreEqual(1, calculationEntity.Order); }
public void UpdateStructuresWithImportedData_CalculationWithOutputAndStructure_CalculationUpdatedAndReturnsAffectedObject() { // Setup var structure = new TestStabilityPointStructure(); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = structure }, Output = new TestStructuresOutput() }; var failureMechanism = new StabilityPointStructuresFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(calculation); StructureCollection <StabilityPointStructure> targetCollection = failureMechanism.StabilityPointStructures; targetCollection.AddRange(new[] { structure }, sourcePath); var strategy = new StabilityPointStructureReplaceDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateStructuresWithImportedData(Enumerable.Empty <StabilityPointStructure>(), sourcePath); // Assert Assert.IsNull(calculation.InputParameters.Structure); Assert.IsFalse(calculation.HasOutput); CollectionAssert.IsEmpty(targetCollection); CollectionAssert.AreEquivalent(new IObservable[] { calculation, calculation.InputParameters, targetCollection }, affectedObjects); }
public void CreateInstance_WithContext_NewPropertiesWithFailureMechanismContextAsData() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var calculation = new TestStabilityPointStructuresCalculationScenario(); var failureMechanism = new StabilityPointStructuresFailureMechanism(); var context = new StabilityPointStructuresInputContext(calculation.InputParameters, calculation, failureMechanism, assessmentSection); // Call IObjectProperties objectProperties = info.CreateInstance(context); // Assert Assert.IsInstanceOf <StabilityPointStructuresInputContextProperties>(objectProperties); Assert.AreSame(context, objectProperties.Data); mocks.VerifyAll(); }
private static StabilityPointStructuresFailureMechanism CreateStabilityPointStructuresFailureMechanismWithAllUpdateForeshoreProfileScenarios( ForeshoreProfile unaffectedForeshoreProfile) { StabilityPointStructuresFailureMechanism stabilityPointStructuresFailureMechanism = TestDataGenerator.GetStabilityPointStructuresFailureMechanismWithAllCalculationConfigurations(); stabilityPointStructuresFailureMechanism.ForeshoreProfiles.AddRange(new[] { unaffectedForeshoreProfile }, sourceFilePath); var unaffectedCalculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { ForeshoreProfile = unaffectedForeshoreProfile }, Output = new TestStructuresOutput() }; stabilityPointStructuresFailureMechanism.CalculationsGroup.Children.Add(unaffectedCalculation); return(stabilityPointStructuresFailureMechanism); }
public void GivenAssessmentSectionResultObserverWithAttachedObserver_WhenStabilityPointStructuresCalculationNotified_ThenAttachedObserverNotified() { // Given AssessmentSection assessmentSection = CreateAssessmentSection(); var calculation = new TestStabilityPointStructuresCalculationScenario(); assessmentSection.StabilityPointStructures.CalculationsGroup.Children.Add(calculation); using (var resultObserver = new AssessmentSectionResultObserver(assessmentSection)) { var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); resultObserver.Attach(observer); // When calculation.NotifyObservers(); // Then mocks.VerifyAll(); } }
public void UpdateStructuresWithImportedData_MultipleCalculationWithStructuresOneWithRemovedStructure_OnlyUpdatesCalculationWithRemovedStructure() { // Setup const string removedId = "removedId"; const string unaffectedId = "unaffectedId"; const string unaffectedStructureName = "unaffectedStructure"; var removedStructure = new TestStabilityPointStructure(removedId, "Old name"); var unaffectedStructure = new TestStabilityPointStructure(unaffectedId, unaffectedStructureName); var affectedCalculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = removedStructure }, Output = new TestStructuresOutput() }; var unaffectedCalculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = unaffectedStructure }, Output = new TestStructuresOutput() }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { affectedCalculation, unaffectedCalculation } } }; StructureCollection <StabilityPointStructure> targetDataCollection = failureMechanism.StabilityPointStructures; targetDataCollection.AddRange(new[] { removedStructure, unaffectedStructure }, sourceFilePath); var strategy = new StabilityPointStructureUpdateDataStrategy(failureMechanism); StabilityPointStructure readUnaffectedStructure = new TestStabilityPointStructure(unaffectedId, unaffectedStructureName); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateStructuresWithImportedData(new[] { readUnaffectedStructure }, sourceFilePath); // Assert Assert.IsFalse(affectedCalculation.HasOutput); Assert.IsNull(affectedCalculation.InputParameters.Structure); Assert.IsTrue(unaffectedCalculation.HasOutput); StabilityPointStructure inputParametersUnaffectedStructure = unaffectedCalculation.InputParameters.Structure; Assert.AreSame(unaffectedStructure, inputParametersUnaffectedStructure); AssertStabilityPointStructure(readUnaffectedStructure, inputParametersUnaffectedStructure); CollectionAssert.AreEquivalent(new IObservable[] { affectedCalculation, affectedCalculation.InputParameters, targetDataCollection }, affectedObjects); }
public void UpdateStructuresWithImportedData_SectionResultWithStructureImportedStructureWithSameId_UpdatesCalculationInput() { // Setup const string sameId = "sameId"; var originalMatchingPoint = new Point2D(0, 0); var updatedMatchingPoint = new Point2D(20, 20); StabilityPointStructure readStructure = new TestStabilityPointStructure(updatedMatchingPoint, sameId); StabilityPointStructure structure = new TestStabilityPointStructure(originalMatchingPoint, sameId); var calculation = new TestStabilityPointStructuresCalculationScenario { InputParameters = { Structure = structure } }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { calculation } } }; failureMechanism.StabilityPointStructures.AddRange(new[] { structure }, sourceFilePath); var intersectionPoint = new Point2D(10, 10); FailureMechanismTestHelper.SetSections(failureMechanism, new[] { new FailureMechanismSection("OldSection", new[] { originalMatchingPoint, intersectionPoint }), new FailureMechanismSection("NewSection", new[] { intersectionPoint, updatedMatchingPoint }) }); var strategy = new StabilityPointStructureUpdateDataStrategy(failureMechanism); // Call IEnumerable <IObservable> affectedObjects = strategy.UpdateStructuresWithImportedData(new[] { readStructure }, sourceFilePath); // Assert AssertStabilityPointStructure(readStructure, structure); CollectionAssert.AreEqual(new IObservable[] { failureMechanism.StabilityPointStructures, structure, calculation.InputParameters }, affectedObjects); }
public void GivenCalculationsWithIllustrationPoints_WhenClearIllustrationPointsClickedAndContinued_ThenInquiryAndIllustrationPointsCleared() { // Given var calculationWithIllustrationPoints = new TestStabilityPointStructuresCalculationScenario { Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint()) }; var calculationWithOutput = new TestStabilityPointStructuresCalculationScenario { Output = new TestStructuresOutput() }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { calculationWithIllustrationPoints, calculationWithOutput, new TestStabilityPointStructuresCalculationScenario() } } }; var affectedCalculationObserver = mocksRepository.StrictMock <IObserver>(); affectedCalculationObserver.Expect(o => o.UpdateObserver()); calculationWithIllustrationPoints.Attach(affectedCalculationObserver); var unaffectedCalculationObserver = mocksRepository.StrictMock <IObserver>(); calculationWithOutput.Attach(unaffectedCalculationObserver); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath"); var nodeData = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); var messageBoxText = ""; DialogBoxHandler = (name, wnd) => { var helper = new MessageBoxTester(wnd); messageBoxText = helper.Text; helper.ClickOk(); }; using (var plugin = new StabilityPointStructuresPlugin()) using (var treeViewControl = new TreeViewControl()) { var gui = mocksRepository.Stub <IGui>(); gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>()); mocksRepository.ReplayAll(); plugin.Gui = gui; TreeNodeInfo info = GetInfo(plugin); using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // When contextMenu.Items[contextMenuClearIllustrationPointsIndex].PerformClick(); // Then Assert.AreEqual("Weet u zeker dat u alle illustratiepunten wilt wissen?", messageBoxText); Assert.IsTrue(calculationWithOutput.HasOutput); Assert.IsFalse(calculationWithIllustrationPoints.Output.HasGeneralResult); } } }
private StabilityPointStructuresFailureMechanism CreateFullyConfiguredFailureMechanism() { var section1 = new FailureMechanismSection("A", new[] { new Point2D(-1, 0), new Point2D(2, 0) }); var section2 = new FailureMechanismSection("B", new[] { new Point2D(2, 0), new Point2D(4, 0) }); var structure1 = new TestStabilityPointStructure(new Point2D(1, 0), "id structure1"); var structure2 = new TestStabilityPointStructure(new Point2D(3, 0), "id structure2"); var profile = new TestForeshoreProfile(); StructuresCalculation <StabilityPointStructuresInput> calculation1 = new TestStabilityPointStructuresCalculationScenario { InputParameters = { ForeshoreProfile = profile, Structure = structure1 }, Output = new TestStructuresOutput() }; StructuresCalculation <StabilityPointStructuresInput> calculation2 = new TestStabilityPointStructuresCalculationScenario { InputParameters = { ForeshoreProfile = profile, Structure = structure2 } }; StructuresCalculation <StabilityPointStructuresInput> calculation3 = new TestStabilityPointStructuresCalculationScenario { InputParameters = { ForeshoreProfile = profile, Structure = structure1 } }; var failureMechanism = new StabilityPointStructuresFailureMechanism { CalculationsGroup = { Children = { calculation1, new CalculationGroup { Children = { calculation2 } }, calculation3 } } }; failureMechanism.StabilityPointStructures.AddRange(new[] { structure1, structure2 }, "path"); failureMechanism.ForeshoreProfiles.AddRange(new[] { profile }, "path"); FailureMechanismTestHelper.SetSections(failureMechanism, new[] { section1, section2 }); return(failureMechanism); }