public void DoPostReplacementUpdates_DuneLocationsAdded_DoNothing() { // Setup var mocks = new MockRepository(); var viewCommands = mocks.StrictMock <IViewCommands>(); mocks.ReplayAll(); var failureMechanism = new DuneErosionFailureMechanism(); failureMechanism.SetDuneLocations(new[] { new TestDuneLocation(), new TestDuneLocation() }); var handler = new DuneLocationsReplacementHandler(viewCommands, failureMechanism); handler.Replace(new[] { new HydraulicBoundaryLocation(1, "Locatie_1_100", 205354, 609735) }); // Precondition Assert.AreEqual(1, failureMechanism.DuneLocations.Count()); // Call handler.DoPostReplacementUpdates(); // Assert mocks.VerifyAll(); // Expect no calls in 'viewCommands' }
public void DoPostReplacementUpdates_NoDuneLocationsAdded_CloseAllViewsForFailureMechanism() { // Setup var failureMechanism = new DuneErosionFailureMechanism(); failureMechanism.SetDuneLocations(new[] { new TestDuneLocation(), new TestDuneLocation() }); var mocks = new MockRepository(); var viewCommands = mocks.StrictMock <IViewCommands>(); viewCommands.Expect(vc => vc.RemoveAllViewsForItem(failureMechanism)); mocks.ReplayAll(); var handler = new DuneLocationsReplacementHandler(viewCommands, failureMechanism); handler.Replace(new HydraulicBoundaryLocation[] { new TestHydraulicBoundaryLocation() }); // Precondition CollectionAssert.IsEmpty(failureMechanism.DuneLocations); // Call handler.DoPostReplacementUpdates(); // Assert mocks.VerifyAll(); }