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 End() { CollectionMockEventReceiver.Expect(mock => mock.Deleted()).WithCurrentTransaction(Transaction); _command.End(); TransactionEventSinkMock.AssertWasNotCalled(mock => mock.RaiseRelationChangedEvent( Arg <DomainObject> .Is.Anything, Arg <IRelationEndPointDefinition> .Is.Anything, Arg <DomainObject> .Is.Anything, Arg <DomainObject> .Is.Anything)); CollectionMockEventReceiver.VerifyAllExpectations(); }
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 End() { var counter = new OrderedExpectationCounter(); TransactionEventSinkMock .Expect(mock => mock.RaiseRelationChangedEvent(DomainObject, CollectionEndPoint.Definition, _removedRelatedObject, null)) .Ordered(counter); CollectionMockEventReceiver .Expect(mock => mock.Removed(_removedRelatedObject)) .WhenCalledOrdered(counter, mi => Assert.That(ClientTransaction.Current, Is.SameAs(Transaction))); _command.End(); TransactionEventSinkMock.VerifyAllExpectations(); CollectionMockEventReceiver.VerifyAllExpectations(); }
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); }