Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb34e9ad7a6c6bb6fe2037ed501a1aeb7fe5660f0 -r7c9876c38beb573abdd577d0d211fc4b3ffd5b0e --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision b34e9ad7a6c6bb6fe2037ed501a1aeb7fe5660f0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 7c9876c38beb573abdd577d0d211fc4b3ffd5b0e) @@ -1177,7 +1177,7 @@ } [Test] - public void GivenCalculationWithStructureWithOutput_WhenStructureHasChangesAndUpdateClickedAndCancelled_ThenInquiryAndCalculationNotUpdatedAndObserversNotNotified() + public void GivenCalculationWithStructureWithoutOutput_WhenStructureChangedAndUpdateClicked_ThenNoInquiryAndCalculationUpdatedAndInputObserverNotified() { // Given var assessmentSection = mocks.Stub(); @@ -1187,6 +1187,54 @@ InputParameters = { Structure = structure + } + }; + var failureMechanism = new ClosingStructuresFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(calculation); + + var nodeData = new ClosingStructuresCalculationGroupContext(failureMechanism.CalculationsGroup, failureMechanism, assessmentSection); + + var inputObserver = mocks.StrictMock(); + inputObserver.Expect(obs => obs.UpdateObserver()); + calculation.InputParameters.Attach(inputObserver); + + var calculationObserver = mocks.StrictMock(); + calculation.Attach(calculationObserver); + + using (var treeViewControl = new TreeViewControl()) + { + var mainWindow = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(g => g.MainWindow).Return(mainWindow); + mocks.ReplayAll(); + + ChangeStructure(structure); + + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSection, treeViewControl)) + { + // When + menu.Items[contextMenuUpdateStructureAllIndexRootGroup].PerformClick(); + + // Then + Assert.IsFalse(calculation.HasOutput); + Assert.IsTrue(calculation.InputParameters.IsStructureInputSynchronized); + + // Note: observer assertions are verified in the TearDown() + } + } + } + + [Test] + public void GivenCalculationWithStructureWithOutput_WhenStructureChangedAndUpdateClickedAndCancelled_ThenInquiryAndCalculationNotUpdatedAndObserversNotNotified() + { + // Given + var assessmentSection = mocks.Stub(); + var structure = new TestClosingStructure(); + var calculation = new StructuresCalculation + { + InputParameters = + { + Structure = structure }, Output = new TestStructuresOutput() }; @@ -1240,7 +1288,7 @@ } [Test] - public void GivenCalculationWithStructureWithOutput_WhenStructureHasChangesUpdateStructureClickedAndContinued_ThenInquiryAndUpdatesCalculationAndObserversNotified() + public void GivenCalculationWithStructureWithOutput_WhenStructureChangedAndUpdateStructureClickedAndContinued_ThenInquiryAndUpdatesCalculationAndObserversNotified() { // Given var assessmentSection = mocks.Stub(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb34e9ad7a6c6bb6fe2037ed501a1aeb7fe5660f0 -r7c9876c38beb573abdd577d0d211fc4b3ffd5b0e --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision b34e9ad7a6c6bb6fe2037ed501a1aeb7fe5660f0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 7c9876c38beb573abdd577d0d211fc4b3ffd5b0e) @@ -1329,7 +1329,7 @@ } [Test] - public void GivenCalculationWithStructureWithoutOutput_WhenStructureUpdatedAndUpdateClicked_ThenNoInquiryAndCalculationUpdatedAndInputObserverNotified() + public void GivenCalculationWithStructureWithoutOutput_WhenStructureChangedAndUpdateClicked_ThenNoInquiryAndCalculationUpdatedAndInputObserverNotified() { // Given var assessmentSection = mocks.Stub(); @@ -1377,7 +1377,7 @@ } [Test] - public void GivenCalculationWithStructureWithOutput_WhenStructureHasChangesAndUpdateClickedAndCancelled_ThenInquiryAndCalculationNotUpdatedAndObserversNotNotified() + public void GivenCalculationWithStructureWithOutput_WhenStructureChangedAndUpdateClickedAndCancelled_ThenInquiryAndCalculationNotUpdatedAndObserversNotNotified() { // Given var assessmentSection = mocks.Stub(); @@ -1440,7 +1440,7 @@ } [Test] - public void GivenCalculationWithStructureWithOutput_WhenStructureHasChangesUpdateStructureClickedAndContinued_ThenInquiryAndUpdatesCalculationAndObserversNotified() + public void GivenCalculationWithStructureWithOutput_WhenStructureChangedAndUpdateStructureClickedAndContinued_ThenInquiryAndUpdatesCalculationAndObserversNotified() { // Given var assessmentSection = mocks.Stub();