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); }
public override void SetUp() { base.SetUp(); _transaction = ClientTransaction.CreateRootTransaction(); _domainObject = DomainObjectIDs.Customer1.GetObject <Customer> (_transaction); _order1 = DomainObjectIDs.Order1.GetObject <Order> (_transaction); _order2 = DomainObjectIDs.Order2.GetObject <Order> (_transaction); _relationEndPointID = RelationEndPointID.Create(DomainObject.ID, "Remotion.Data.DomainObjects.UnitTests.TestDomain.Customer.Orders"); _collectionEndPoint = RelationEndPointObjectMother.CreateCollectionEndPoint( _relationEndPointID, new[] { _order1, _order2 }, _transaction); _collectionMockEventReceiver = MockRepository.GenerateStrictMock <DomainObjectCollectionMockEventReceiver> (_collectionEndPoint.Collection); _collectionDataMock = new MockRepository().StrictMock <IDomainObjectCollectionData> (); CollectionDataMock.Replay(); _endPointProviderStub = MockRepository.GenerateStub <IRelationEndPointProvider>(); _transactionEventSinkMock = MockRepository.GenerateStrictMock <IClientTransactionEventSink>(); }