Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismSectionResultRow.cs
===================================================================
diff -u -r5090445c100bd14f56e423a26e1c6305eccc3301 -r6db413e69ecbda9e1be48e269f8fa1a16fff1275
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismSectionResultRow.cs (.../FailureMechanismSectionResultRow.cs) (revision 5090445c100bd14f56e423a26e1c6305eccc3301)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismSectionResultRow.cs (.../FailureMechanismSectionResultRow.cs) (revision 6db413e69ecbda9e1be48e269f8fa1a16fff1275)
@@ -36,12 +36,12 @@
///
/// Fired when the row has started updating.
///
- public EventHandler RowUpdated;
+ public event EventHandler RowUpdated;
///
/// Fired when the row has finished updating.
///
- public EventHandler RowUpdateDone;
+ public event EventHandler RowUpdateDone;
///
/// Creates a new instance of .
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs
===================================================================
diff -u -r8aee604ae7d00c69d9e96f035129ba578311791b -r6db413e69ecbda9e1be48e269f8fa1a16fff1275
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision 8aee604ae7d00c69d9e96f035129ba578311791b)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision 6db413e69ecbda9e1be48e269f8fa1a16fff1275)
@@ -292,7 +292,7 @@
}
[Test]
- public void GivenFailureMechanismResultView_WhenRowUpdatedEventFiredAndSectionResultNotified_ThenRowNotUpdatedAndViewInvalidatedAndAssemblyResultControlUpdated()
+ public void GivenFailureMechanismResultView_WhenRowUpdatingAndSectionResultNotified_ThenNothingUpdates()
{
// Given
TestFailureMechanismSectionResult sectionResult = FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult();
@@ -315,14 +315,13 @@
Assert.IsFalse(row.Updated);
// When
- row.RowUpdated?.Invoke(row, EventArgs.Empty);
+ TypeUtils.SetField(view, "rowUpdating", true);
sectionResult.NotifyObservers();
- row.RowUpdateDone?.Invoke(row, EventArgs.Empty);
// Then
- Assert.IsTrue(invalidated);
+ Assert.IsFalse(invalidated);
Assert.IsFalse(row.Updated);
- Assert.IsTrue(view.AssemblyResultControlUpdated);
+ Assert.IsFalse(view.AssemblyResultControlUpdated);
}
}
@@ -459,17 +458,25 @@
DataGridView dataGridView = GetDataGridView();
var row = (TestRow) dataGridView.Rows[0].DataBoundItem;
+ var rowUpdated = false;
+ row.RowUpdated += (sender, args) => rowUpdated = true;
+ var rowUpdateDone = false;
+ row.RowUpdateDone += (sender, args) => rowUpdateDone = true;
+
// Precondition
- Assert.IsNotNull(row.RowUpdated);
- Assert.IsNotNull(row.RowUpdateDone);
+ row.UpdateInternal();
+ Assert.IsTrue(rowUpdated);
+ Assert.IsTrue(rowUpdateDone);
// When
+ rowUpdated = false;
+ rowUpdateDone = false;
sectionResults.Remove(sectionResult);
sectionResults.NotifyObservers();
// Then
- Assert.IsNull(row.RowUpdated);
- Assert.IsNull(row.RowUpdateDone);
+ Assert.IsFalse(rowUpdated);
+ Assert.IsFalse(rowUpdateDone);
}
}
@@ -543,6 +550,11 @@
public bool Updated { get; private set; }
+ public void UpdateInternal()
+ {
+ UpdateInternalData();
+ }
+
public override void Update()
{
Updated = true;