Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismTest.cs =================================================================== diff -u -r560ea9f96409cc65f4666adf212a1c135c5e626f -r846b1e40df885cc19547b68839c5eccd4f790e2d --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismTest.cs (.../ClosingStructuresFailureMechanismTest.cs) (revision 560ea9f96409cc65f4666adf212a1c135c5e626f) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismTest.cs (.../ClosingStructuresFailureMechanismTest.cs) (revision 846b1e40df885cc19547b68839c5eccd4f790e2d) @@ -21,6 +21,7 @@ using System.Collections.Generic; using System.Linq; +using Core.Common.Base; using Core.Common.Base.Geometry; using NUnit.Framework; using Rhino.Mocks; @@ -61,7 +62,13 @@ public void AddSection_WithSection_AddedClosingStructuresFailureMechanismSectionResult() { // Setup + var mocks = new MockRepository(); + var observer = mocks.Stub(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + var failureMechanism = new ClosingStructuresFailureMechanism(); + failureMechanism.SectionResults.Attach(observer); // Call failureMechanism.AddSection(new FailureMechanismSection("", new[] @@ -70,14 +77,20 @@ })); // Assert - Assert.AreEqual(1, failureMechanism.SectionResults.Count()); + Assert.AreEqual(1, failureMechanism.SectionResults.Count); Assert.IsInstanceOf>(failureMechanism.SectionResults.ElementAt(0)); + mocks.VerifyAll(); } [Test] public void ClearAllSections_WithSectionsAndSectionResults_SectionsAndSectionResultsCleared() { // Setup + var mocks = new MockRepository(); + var observer = mocks.Stub(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + var failureMechanism = new ClosingStructuresFailureMechanism(); failureMechanism.AddSection(new FailureMechanismSection("", new[] @@ -89,23 +102,25 @@ new Point2D(2, 1) })); + failureMechanism.SectionResults.Attach(observer); + // Precondition Assert.AreEqual(2, failureMechanism.Sections.Count()); - Assert.AreEqual(2, failureMechanism.SectionResults.Count()); + Assert.AreEqual(2, failureMechanism.SectionResults.Count); // Call failureMechanism.ClearAllSections(); // Assert Assert.AreEqual(0, failureMechanism.Sections.Count()); - Assert.AreEqual(0, failureMechanism.SectionResults.Count()); + Assert.AreEqual(0, failureMechanism.SectionResults.Count); + mocks.ReplayAll(); } [Test] public void Calculations_MultipleChildrenAdded_ReturnClosingStructuresCalculations() { // Setup - var mocks = new MockRepository(); var failureMechanism = new ClosingStructuresFailureMechanism { CalculationsGroup = @@ -119,15 +134,12 @@ } }; - mocks.ReplayAll(); - // Call List calculations = failureMechanism.Calculations.ToList(); // Assert Assert.AreEqual(2, calculations.Count); Assert.IsTrue(calculations.All(c => c is StructuresCalculation)); - mocks.VerifyAll(); } } } \ No newline at end of file