public void MarkDataComplete_CreatesNewDataManager()
        {
            bool stateSetterCalled = false;

            _virtualObjectEndPointMock.Stub(stub => stub.ID).Return(_endPointID);
            _virtualObjectEndPointMock.Replay();

            var newManagerMock = MockRepository.GenerateStrictMock <IVirtualObjectEndPointDataManager> ();

            newManagerMock.Replay();
            _dataManagerFactoryStub.Stub(stub => stub.CreateEndPointDataManager(_endPointID)).Return(newManagerMock);

            _loadState.MarkDataComplete(
                _virtualObjectEndPointMock,
                null,
                dataManager =>
            {
                stateSetterCalled = true;
                Assert.That(dataManager, Is.SameAs(newManagerMock));
            });

            Assert.That(stateSetterCalled, Is.True);
            newManagerMock.VerifyAllExpectations();
        }
Пример #2
0
        public override void SetUp()
        {
            base.SetUp();

            _clientTransaction        = ClientTransaction.CreateRootTransaction();
            _endPointProviderStub     = MockRepository.GenerateStub <IRelationEndPointProvider> ();
            _lazyLoaderStub           = MockRepository.GenerateStub <ILazyLoader> ();
            _transactionEventSinkStub = MockRepository.GenerateStub <IClientTransactionEventSink>();

            var virtualObjectEndPointDataManager = MockRepository.GenerateStub <IVirtualObjectEndPointDataManager> ();

            virtualObjectEndPointDataManager.Stub(stub => stub.OriginalOppositeEndPoint).Return(null);
            _virtualObjectEndPointDataManagerFactoryStub = MockRepository.GenerateStub <IVirtualObjectEndPointDataManagerFactory> ();
            _virtualObjectEndPointDataManagerFactoryStub
            .Stub(stub => stub.CreateEndPointDataManager(Arg <RelationEndPointID> .Is.Anything))
            .Return(virtualObjectEndPointDataManager);

            var collectionEndPointDataManager = MockRepository.GenerateStub <ICollectionEndPointDataManager> ();

            collectionEndPointDataManager.Stub(stub => stub.OriginalOppositeEndPoints).Return(new IRealObjectEndPoint[0]);
            _collectionEndPointDataManagerFactoryStub = MockRepository.GenerateStub <ICollectionEndPointDataManagerFactory> ();
            _collectionEndPointDataManagerFactoryStub
            .Stub(stub => stub.CreateEndPointDataManager(Arg <RelationEndPointID> .Is.Anything))
            .Return(collectionEndPointDataManager);

            _collectionEndPointCollectionProviderStub = MockRepository.GenerateStub <ICollectionEndPointCollectionProvider>();
            _associatedCollectionStrategyFactoryStub  = MockRepository.GenerateStub <IAssociatedCollectionDataStrategyFactory>();

            _factory = new RelationEndPointFactory(
                _clientTransaction,
                _endPointProviderStub,
                _lazyLoaderStub,
                _transactionEventSinkStub,
                _virtualObjectEndPointDataManagerFactoryStub,
                _collectionEndPointDataManagerFactoryStub,
                _collectionEndPointCollectionProviderStub,
                _associatedCollectionStrategyFactoryStub);
        }