public override void SetUp()
        {
            base.SetUp();

            _registrationAgentMock = MockRepository.GenerateStrictMock <IFetchedRelationDataRegistrationAgent>();
            _fetchResultLoaderMock = MockRepository.GenerateStrictMock <IFetchEnabledObjectLoader>();

            _eagerFetcher = new EagerFetcher(_registrationAgentMock);

            _fetchQueryStub1 = MockRepository.GenerateStub <IQuery> ();
            _fetchQueryStub2 = MockRepository.GenerateStub <IQuery> ();

            _orderTicketEndPointDefinition      = GetEndPointDefinition(typeof(Order), "OrderTicket");
            _customerEndPointDefinition         = GetEndPointDefinition(typeof(Order), "Customer");
            _industrialSectorEndPointDefinition = GetEndPointDefinition(typeof(Company), "IndustrialSector");

            _originatingOrder1 = DomainObjectMother.CreateFakeObject <Order>();
            _originatingOrder2 = DomainObjectMother.CreateFakeObject <Order>();

            _originatingOrderData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(_originatingOrder1);
            _originatingOrderData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(_originatingOrder2);

            _fetchedOrderItem1 = DomainObjectMother.CreateFakeObject <OrderItem>();
            _fetchedOrderItem2 = DomainObjectMother.CreateFakeObject <OrderItem>();
            _fetchedOrderItem3 = DomainObjectMother.CreateFakeObject <OrderItem>();

            _fetchedOrderItemData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(_fetchedOrderItem1);
            _fetchedOrderItemData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(_fetchedOrderItem2);
            _fetchedOrderItemData3 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(_fetchedOrderItem3);

            _fetchedCustomer     = DomainObjectMother.CreateFakeObject <Customer>();
            _fetchedCustomerData = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(_fetchedCustomer);

            _pendingRegistrationCollector = new LoadedObjectDataPendingRegistrationCollector();
        }
        protected override IObjectLoader CreateObjectLoader(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IPersistenceStrategy persistenceStrategy,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IDataManager dataManager,
            ITransactionHierarchyManager hierarchyManager)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            var fetchEnabledPersistenceStrategy =
                ArgumentUtility.CheckNotNullAndType <IFetchEnabledPersistenceStrategy> ("persistenceStrategy", persistenceStrategy);

            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);
            ArgumentUtility.CheckNotNull("hierarchyManager", hierarchyManager);

            var loadedObjectDataProvider          = new LoadedObjectDataProvider(dataManager, invalidDomainObjectManager);
            var registrationListener              = new LoadedObjectDataRegistrationListener(eventSink, hierarchyManager);
            var loadedObjectDataRegistrationAgent = new LoadedObjectDataRegistrationAgent(constructedTransaction, dataManager, registrationListener);

            IFetchedRelationDataRegistrationAgent registrationAgent =
                new DelegatingFetchedRelationDataRegistrationAgent(
                    new FetchedRealObjectRelationDataRegistrationAgent(),
                    new FetchedVirtualObjectRelationDataRegistrationAgent(dataManager),
                    new FetchedCollectionRelationDataRegistrationAgent(dataManager));
            var eagerFetcher = new EagerFetcher(registrationAgent);

            return(new FetchEnabledObjectLoader(
                       fetchEnabledPersistenceStrategy,
                       loadedObjectDataRegistrationAgent,
                       loadedObjectDataProvider,
                       eagerFetcher));
        }
        public void Serialization()
        {
            var instance = new EagerFetcher(new SerializableFetchedRelationDataRegistrationAgentFake());

            var deserializedInstance = Serializer.SerializeAndDeserialize(instance);

            Assert.That(deserializedInstance.RegistrationAgent, Is.Not.Null);
        }