Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/LocationsViewSynchronizationTester.cs =================================================================== diff -u -rea806dcdb54587994d490902a55cf4a680899090 -r69d6acd84acd14d6739e70fad44ef155fe1e0f08 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/LocationsViewSynchronizationTester.cs (.../LocationsViewSynchronizationTester.cs) (revision ea806dcdb54587994d490902a55cf4a680899090) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/LocationsViewSynchronizationTester.cs (.../LocationsViewSynchronizationTester.cs) (revision 69d6acd84acd14d6739e70fad44ef155fe1e0f08) @@ -338,9 +338,7 @@ illustrationPointsDataGridView.CurrentCell = illustrationPointsDataGridView.Rows[1].Cells[0]; // Then - var selection = view.Selection as SelectedTopLevelSubMechanismIllustrationPoint; - Assert.IsNotNull(selection); - Assert.AreSame(GetIllustrationPointsControl().Data.ElementAt(1).Source, selection.TopLevelSubMechanismIllustrationPoint); + AssertIllustrationPointControlSelection(view.Selection); } [Test] @@ -358,9 +356,7 @@ // Precondition Assert.AreEqual(4, locationsDataGridView.CurrentRow?.Index); Assert.AreEqual(1, illustrationPointsDataGridView.CurrentRow?.Index); - var selection = view.Selection as SelectedTopLevelSubMechanismIllustrationPoint; - Assert.IsNotNull(selection); - Assert.AreSame(GetIllustrationPointsControl().Data.ElementAt(1).Source, selection.TopLevelSubMechanismIllustrationPoint); + AssertIllustrationPointControlSelection(view.Selection); // When ReplaceHydraulicBoundaryDatabaseAndNotifyObservers(view); @@ -385,9 +381,7 @@ // Precondition Assert.AreEqual(4, locationsDataGridView.CurrentRow?.Index); Assert.AreEqual(1, illustrationPointsDataGridView.CurrentRow?.Index); - var selection = view.Selection as SelectedTopLevelSubMechanismIllustrationPoint; - Assert.IsNotNull(selection); - Assert.AreSame(GetIllustrationPointsControl().Data.ElementAt(1).Source, selection.TopLevelSubMechanismIllustrationPoint); + AssertIllustrationPointControlSelection(view.Selection); // When ClearLocationOutputAndNotifyObservers(view); @@ -412,21 +406,25 @@ // Precondition Assert.AreEqual(4, locationsDataGridView.CurrentRow?.Index); Assert.AreEqual(1, illustrationPointsDataGridView.CurrentRow?.Index); - var selection = view.Selection as SelectedTopLevelSubMechanismIllustrationPoint; - Assert.IsNotNull(selection); - Assert.AreSame(GetIllustrationPointsControl().Data.ElementAt(1).Source, selection.TopLevelSubMechanismIllustrationPoint); + AssertIllustrationPointControlSelection(view.Selection); // When AddLocationOutputAndNotifyObservers(view); // Then Assert.AreEqual(4, locationsDataGridView.CurrentRow?.Index); Assert.AreEqual(1, illustrationPointsDataGridView.CurrentRow?.Index); - selection = view.Selection as SelectedTopLevelSubMechanismIllustrationPoint; - Assert.IsNotNull(selection); - Assert.AreSame(GetIllustrationPointsControl().Data.ElementAt(1).Source, selection.TopLevelSubMechanismIllustrationPoint); + AssertIllustrationPointControlSelection(view.Selection); } + private void AssertIllustrationPointControlSelection(object selection) + { + var illustrationPointSelection = selection as SelectedTopLevelSubMechanismIllustrationPoint; + Assert.IsNotNull(illustrationPointSelection); + Assert.AreSame(GetIllustrationPointsControl().Data.ElementAt(1).Source, illustrationPointSelection.TopLevelSubMechanismIllustrationPoint); + CollectionAssert.AreEqual(GetIllustrationPointsControl().Data.Select(data => data.ClosingSituation), illustrationPointSelection.ClosingSituations); + } + #endregion } } \ No newline at end of file