Ejemplo n.º 1
0
        public override void SetUp()
        {
            base.SetUp();

            _mockRepository = new MockRepository();

            _persistenceStrategyMock = _mockRepository.StrictMock <IFetchEnabledPersistenceStrategy> ();
            _loadedObjectDataRegistrationAgentMock = _mockRepository.StrictMock <ILoadedObjectDataRegistrationAgent> ();
            _loadedObjectDataProviderStub          = _mockRepository.Stub <ILoadedObjectDataProvider> ();
            _eagerFetcherMock = _mockRepository.StrictMock <IEagerFetcher> ();

            _fetchEnabledObjectLoader = new FetchEnabledObjectLoader(
                _persistenceStrategyMock,
                _loadedObjectDataRegistrationAgentMock,
                _loadedObjectDataProviderStub,
                _eagerFetcherMock);

            _resultItem1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order1);
            _resultItem2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order3);
            _resultItemWithSourceData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(DomainObjectIDs.Order1);
            _resultItemWithSourceData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(DomainObjectIDs.Order3);

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

            var fetchQuery1 = CreateFakeQuery();
            var fetchQuery2 = CreateFakeQuery();

            _queryWithFetchQueries = CreateFakeQuery(
                Tuple.Create(_orderTicketEndPointDefinition, fetchQuery1),
                Tuple.Create(_customerEndPointDefinition, fetchQuery2));
        }
            public static IDisposable CreatePersistenceStrategyScope(IFetchEnabledPersistenceStrategy persistenceStrategy)
            {
                var mixinConfigurationScope = MixinConfiguration.BuildFromActive()
                                              .ForClass <RootClientTransactionComponentFactory> ()
                                              .AddMixin <RootClientTransactionComponentFactoryMixin> ()
                                              .EnterScope();

                s_persistenceStrategy = persistenceStrategy;
                return(new PostActionDisposableDecorator(mixinConfigurationScope, () => { s_persistenceStrategy = null; }));
            }
        public FetchEnabledObjectLoader(
            IFetchEnabledPersistenceStrategy persistenceStrategy,
            ILoadedObjectDataRegistrationAgent loadedObjectDataRegistrationAgent,
            ILoadedObjectDataProvider loadedObjectDataProvider,
            IEagerFetcher eagerFetcher)
            : base(persistenceStrategy, loadedObjectDataRegistrationAgent, loadedObjectDataProvider)
        {
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);
            ArgumentUtility.CheckNotNull("eagerFetcher", eagerFetcher);

            _persistenceStrategy = persistenceStrategy;
            _eagerFetcher        = eagerFetcher;
        }
 public RootPersistenceStrategyMockFacade(IFetchEnabledPersistenceStrategy mock)
 {
     ArgumentUtility.CheckNotNull("mock", mock);
     _mock = mock;
 }