public void Perform__NonCollectible() { _endPointMock1.Expect(mock => mock.MarkDataIncomplete()); _endPointMock1.Stub(stub => stub.CanBeCollected).Return(false); _endPointMock2.Expect(mock => mock.MarkDataIncomplete()); _endPointMock2.Stub(stub => stub.CanBeCollected).Return(false); _mockRepository.ReplayAll(); _command.Perform(); _mockRepository.VerifyAll(); }
private void ExpectLoadOpposite() { var oppositeID = RelationEndPointID.CreateOpposite(_endPointID.Definition, DomainObjectIDs.Customer1); _virtualEndPointProviderMock.Expect(mock => mock.GetOrCreateVirtualEndPoint(oppositeID)).Return(_oppositeEndPointMock); _oppositeEndPointMock.Expect(mock => mock.EnsureDataComplete()); }
public void MarkDataIncomplete_ExecutesStateSetter_AndSynchronizesOppositeEndPoints() { // ReSharper disable AccessToModifiedClosure bool stateSetterCalled = false; var synchronizedOppositeEndPointStub = MockRepository.GenerateStub <IRealObjectEndPoint> (); _loadState.StubOriginalOppositeEndPoints(new[] { synchronizedOppositeEndPointStub }); var unsynchronizedOppositeEndPointMock = MockRepository.GenerateStrictMock <IRealObjectEndPoint> (); unsynchronizedOppositeEndPointMock.Stub(stub => stub.ObjectID).Return(DomainObjectIDs.Order1); AddUnsynchronizedOppositeEndPoint(_loadState, unsynchronizedOppositeEndPointMock); unsynchronizedOppositeEndPointMock.Replay(); _virtualEndPointMock .Stub(stub => stub.ID) .Return(RelationEndPointID.Create(DomainObjectIDs.Customer1, _definition)); _virtualEndPointMock .Expect(mock => mock.RegisterOriginalOppositeEndPoint(synchronizedOppositeEndPointStub)) .WhenCalled(mi => Assert.That(stateSetterCalled, Is.True)); _virtualEndPointMock .Expect(mock => mock.RegisterOriginalOppositeEndPoint(unsynchronizedOppositeEndPointMock)) .WhenCalled(mi => Assert.That(stateSetterCalled, Is.True)); _virtualEndPointMock.Replay(); _dataManagerMock.Stub(stub => stub.HasDataChanged()).Return(false); _dataManagerMock.Replay(); _transactionEventSinkWithMock.Stub(mock => mock.RaiseRelationEndPointBecomingIncompleteEvent(Arg <RelationEndPointID> .Is.Anything)); _loadState.MarkDataIncomplete(_virtualEndPointMock, () => stateSetterCalled = true); _virtualEndPointMock.VerifyAllExpectations(); unsynchronizedOppositeEndPointMock.VerifyAllExpectations(); _dataManagerMock.VerifyAllExpectations(); Assert.That(stateSetterCalled, Is.True); // ReSharper restore AccessToModifiedClosure }
public void Perform() { _decoratedCommandMock.Stub(stub => stub.GetAllExceptions()).Return(new Exception[0]); using (_mockRepository.Ordered()) { _oldRelatedEndPointMock.Expect(mock => mock.UnregisterCurrentOppositeEndPoint(_realObjectEndPointStub)); _decoratedCommandMock.Expect(mock => mock.Perform()); _newRelatedEndPointMock.Expect(mock => mock.RegisterCurrentOppositeEndPoint(_realObjectEndPointStub)); } _mockRepository.ReplayAll(); _decorator.Perform(); _mockRepository.VerifyAll(); }