Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs =================================================================== diff -u -r864206280c7a672e3e7d44305e9cffb75a21fe71 -r2ee0d42baed610a91cad9f08a8e7bfa3141e6afd --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision 864206280c7a672e3e7d44305e9cffb75a21fe71) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision 2ee0d42baed610a91cad9f08a8e7bfa3141e6afd) @@ -24,6 +24,7 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Controls.Views; +using Core.Common.TestUtil; using Core.Common.Utils.Reflection; using NUnit.Framework; using Rhino.Mocks; @@ -268,6 +269,92 @@ } } + [Test] + public void GivenViewWithGeneralResultFuncReturningTestData_WhenSettingData_SelectionChangePropagatedAccordingly() + { + // Setup + var mocks = new MockRepository(); + var data = mocks.Stub(); + + mocks.ReplayAll(); + + var topLevelFaultTreeIllustrationPoint1 = + new TopLevelFaultTreeIllustrationPoint( + WindDirectionTestFactory.CreateTestWindDirection(), + "Closing situation 1", + new IllustrationPointNode(new FaultTreeIllustrationPoint("Fault tree illustration point", + 1.1, + Enumerable.Empty(), + CombinationType.And))); + + var topLevelFaultTreeIllustrationPoint2 = + new TopLevelFaultTreeIllustrationPoint( + WindDirectionTestFactory.CreateTestWindDirection(), + "Closing situation 2", + new IllustrationPointNode(new SubMechanismIllustrationPoint("Sub mechanism illustration point", + 2.2, + Enumerable.Empty(), + Enumerable.Empty()))); + + using (var view = new GeneralResultFaultTreeIllustrationPointView(() => new GeneralResult( + WindDirectionTestFactory.CreateTestWindDirection(), + Enumerable.Empty(), + new List + { + topLevelFaultTreeIllustrationPoint1, + topLevelFaultTreeIllustrationPoint2 + }))) + { + WindowsFormsTestHelper.Show(view); + + var selectionChangedCounter = 0; + view.SelectionChanged += (sender, args) => selectionChangedCounter++; + + // Call + view.Data = data; + + // Assert + Assert.AreNotEqual(0, selectionChangedCounter); + Assert.AreSame(topLevelFaultTreeIllustrationPoint1, view.Selection); + } + + WindowsFormsTestHelper.CloseAll(); + + mocks.VerifyAll(); + } + + [Test] + public void GivenViewWithGeneralResultFuncReturningEmptyData_WhenSettingData_NoSelectionChangePropagated() + { + // Setup + var mocks = new MockRepository(); + var data = mocks.Stub(); + + mocks.ReplayAll(); + + using (var view = new GeneralResultFaultTreeIllustrationPointView(() => new GeneralResult( + WindDirectionTestFactory.CreateTestWindDirection(), + Enumerable.Empty(), + Enumerable.Empty()))) + { + var selectionChangedCounter = 0; + view.SelectionChanged += (sender, args) => selectionChangedCounter++; + + WindowsFormsTestHelper.Show(view); + + // Call + view.Data = data; + + // Assert + Assert.AreEqual(0, selectionChangedCounter); + Assert.IsNull(view.Selection); + } + + WindowsFormsTestHelper.CloseAll(); + + mocks.VerifyAll(); + } + private static GeneralResultFaultTreeIllustrationPointView GetValidView() { return new GeneralResultFaultTreeIllustrationPointView(() => new TestGeneralResultFaultTreeIllustrationPoint()); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs =================================================================== diff -u -r0a8c6f4db5bd26539d8c05d3e0244e656d4720e5 -r2ee0d42baed610a91cad9f08a8e7bfa3141e6afd --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs (.../TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs) (revision 0a8c6f4db5bd26539d8c05d3e0244e656d4720e5) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs (.../TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs) (revision 2ee0d42baed610a91cad9f08a8e7bfa3141e6afd) @@ -57,7 +57,7 @@ } [Test] - public void CreateInstance_StructuresOutputContext_ReturnStructuresOutputProperties() + public void CreateInstance_TopLevelFaultTreeIllustrationPoint_ReturnFaultTreeIllustrationPointBaseProperties() { // Setup var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(