public void Perform () { bool relationChangingCalled = false; bool relationChangedCalled = false; DomainObject.RelationChanging += (sender, args) => relationChangingCalled = true; DomainObject.RelationChanged += (sender, args) => relationChangedCalled = true; CollectionDataMock.BackToRecord (); CollectionDataMock.Replay (); _command.Perform (); CollectionDataMock.VerifyAllExpectations (); Assert.That (relationChangingCalled, Is.False); // operation was not started Assert.That (relationChangedCalled, Is.False); // operation was not finished CollectionMockEventReceiver.AssertWasNotCalled (mock => mock.Adding()); CollectionMockEventReceiver.AssertWasNotCalled (mock => mock.Added()); CollectionMockEventReceiver.AssertWasNotCalled (mock => mock.Removing ()); CollectionMockEventReceiver.AssertWasNotCalled (mock => mock.Removed()); Assert.That (CollectionEndPoint.HasBeenTouched, Is.True); }
public void Perform() { CollectionDataMock.BackToRecord(); CollectionDataMock.Expect(mock => mock.Remove(_removedRelatedObject)).Return(true); CollectionDataMock.Replay(); _command.Perform(); CollectionDataMock.VerifyAllExpectations(); CollectionMockEventReceiver.AssertWasNotCalled(mock => mock.Removing()); CollectionMockEventReceiver.AssertWasNotCalled(mock => mock.Removed()); Assert.That(CollectionEndPoint.HasBeenTouched, Is.True); }
public void Perform() { CollectionDataMock.BackToRecord(); CollectionDataMock.Expect(mock => mock.Clear()); CollectionDataMock.Replay(); Assert.That(CollectionEndPoint.HasBeenTouched, Is.False); _command.Perform(); CollectionDataMock.VerifyAllExpectations(); CollectionMockEventReceiver.AssertWasNotCalled(mock => mock.Deleting()); CollectionMockEventReceiver.AssertWasNotCalled(mock => mock.Deleted()); Assert.That(CollectionEndPoint.HasBeenTouched, Is.True); }