Index: Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r29ca79417b77f2ef9e1d69c19b1b152c25b020e4 -r561d42449ccfee6435955d8a6d77b720f5e576d6
--- Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 29ca79417b77f2ef9e1d69c19b1b152c25b020e4)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 561d42449ccfee6435955d8a6d77b720f5e576d6)
@@ -1119,6 +1119,15 @@
}
///
+ /// Looks up a localized string similar to Wis alle berekende illustratiepunten..
+ ///
+ public static string CreateClearIllustrationPointsOfCalculationsItem_Clear_IllustrationPoints {
+ get {
+ return ResourceManager.GetString("CreateClearIllustrationPointsOfCalculationsItem_Clear_IllustrationPoints", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Wis alle berekende illustratiepunten binnen deze map met berekeningen..
///
public static string CreateClearIllustrationPointsOfCalculationsItem_Clear_IllustrationPoints_In_Group {
Index: Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r29ca79417b77f2ef9e1d69c19b1b152c25b020e4 -r561d42449ccfee6435955d8a6d77b720f5e576d6
--- Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 29ca79417b77f2ef9e1d69c19b1b152c25b020e4)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 561d42449ccfee6435955d8a6d77b720f5e576d6)
@@ -1509,6 +1509,9 @@
Wis alle illustratiepunten...
+
+ Wis alle berekende illustratiepunten.
+
Wis alle berekende illustratiepunten binnen deze map met berekeningen.
Index: Riskeer/Common/src/Riskeer.Common.Forms/TreeNodeInfos/RiskeerContextMenuItemFactory.cs
===================================================================
diff -u -r78b6df61d5905147137d8bade762490d127f4695 -r561d42449ccfee6435955d8a6d77b720f5e576d6
--- Riskeer/Common/src/Riskeer.Common.Forms/TreeNodeInfos/RiskeerContextMenuItemFactory.cs (.../RiskeerContextMenuItemFactory.cs) (revision 78b6df61d5905147137d8bade762490d127f4695)
+++ Riskeer/Common/src/Riskeer.Common.Forms/TreeNodeInfos/RiskeerContextMenuItemFactory.cs (.../RiskeerContextMenuItemFactory.cs) (revision 561d42449ccfee6435955d8a6d77b720f5e576d6)
@@ -509,6 +509,21 @@
///
/// Creates a which is bound to the action of clearing illustration points for a
+ /// collection of calculations.
+ ///
+ /// The function to determine whether the context menu item should be enabled.
+ /// Object responsible for clearing the illustration point results.
+ /// The created .
+ public static StrictContextMenuItem CreateClearIllustrationPointsOfCalculationsItem(
+ Func isContextItemEnabledFunc, IClearIllustrationPointsOfCalculationCollectionChangeHandler changeHandler)
+ {
+ return CreateClearIllustrationPointsOfCalculationsItem(
+ isContextItemEnabledFunc, changeHandler,
+ Resources.CreateClearIllustrationPointsOfCalculationsItem_Clear_IllustrationPoints);
+ }
+
+ ///
+ /// Creates a which is bound to the action of clearing illustration points for a
/// collection of calculations in a group.
///
/// The function to determine whether the context menu item should be enabled.
Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/TreeNodeInfos/RiskeerContextMenuItemFactoryTest.cs
===================================================================
diff -u -r78b6df61d5905147137d8bade762490d127f4695 -r561d42449ccfee6435955d8a6d77b720f5e576d6
--- Riskeer/Common/test/Riskeer.Common.Forms.Test/TreeNodeInfos/RiskeerContextMenuItemFactoryTest.cs (.../RiskeerContextMenuItemFactoryTest.cs) (revision 78b6df61d5905147137d8bade762490d127f4695)
+++ Riskeer/Common/test/Riskeer.Common.Forms.Test/TreeNodeInfos/RiskeerContextMenuItemFactoryTest.cs (.../RiskeerContextMenuItemFactoryTest.cs) (revision 561d42449ccfee6435955d8a6d77b720f5e576d6)
@@ -1702,6 +1702,98 @@
#endregion
+ #region CreateClearIllustrationPointsOfCalculationsItem
+
+ [Test]
+ public void CreateClearIllustrationPointsOfCalculationsItem_Always_CreatesExpectedItem()
+ {
+ // Setup
+ bool isEnabled = new Random(21).NextBoolean();
+
+ var mocks = new MockRepository();
+ var handler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ StrictContextMenuItem toolStripItem = RiskeerContextMenuItemFactory.CreateClearIllustrationPointsOfCalculationsItem(() => isEnabled,
+ handler);
+
+ // Assert
+ Assert.AreEqual("Wis alle illustratiepunten...", toolStripItem.Text);
+ TestHelper.AssertImagesAreEqual(RiskeerFormsResources.ClearIllustrationPointsIcon, toolStripItem.Image);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void CreateClearIllustrationPointsOfCalculationsItem_EnabledSituation_ReturnsExpectedEnabledStateAndToolTipMessage(bool isEnabled)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var handler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ StrictContextMenuItem toolStripItem = RiskeerContextMenuItemFactory.CreateClearIllustrationPointsOfCalculationsItem(() => isEnabled,
+ handler);
+
+ // Assert
+ Assert.AreEqual(isEnabled, toolStripItem.Enabled);
+
+ string expectedToolTipMessage = isEnabled
+ ? "Wis alle berekende illustratiepunten."
+ : "Er zijn geen berekeningen met illustratiepunten om te wissen.";
+ Assert.AreEqual(expectedToolTipMessage, toolStripItem.ToolTipText);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenEnabledCreateClearIllustrationPointsOfCalculationsItemm_WhenClickPerformedAndActionCancelled_ThenNothingHappens()
+ {
+ // Given
+ var mocks = new MockRepository();
+ var handler = mocks.StrictMock();
+ handler.Expect(h => h.InquireConfirmation()).Return(false);
+ mocks.ReplayAll();
+
+ StrictContextMenuItem toolStripItem = RiskeerContextMenuItemFactory.CreateClearIllustrationPointsOfCalculationsItem(() => true,
+ handler);
+
+ // When
+ toolStripItem.PerformClick();
+
+ // Then
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenEnabledCreateClearIllustrationPointsOfCalculationsItem_WhenClickPerformedAndActionContinued_ThenIllustrationPointsClearedAndObserversUpdated()
+ {
+ // Given
+ var mocks = new MockRepository();
+ var observable = mocks.StrictMock();
+ observable.Expect(o => o.NotifyObservers());
+ var handler = mocks.StrictMock();
+ handler.Expect(h => h.InquireConfirmation()).Return(true);
+ handler.Expect(h => h.ClearIllustrationPoints()).Return(new[]
+ {
+ observable
+ });
+ mocks.ReplayAll();
+
+ StrictContextMenuItem toolStripItem = RiskeerContextMenuItemFactory.CreateClearIllustrationPointsOfCalculationsItem(() => true,
+ handler);
+
+ // When
+ toolStripItem.PerformClick();
+
+ // Then
+ mocks.VerifyAll();
+ }
+
+ #endregion
+
#region CreateClearIllustrationPointsOfCalculationsInGroupItem
[Test]