コード例 #1
0
        public static CollectionEndPoint CreateCollectionEndPoint(
            RelationEndPointID endPointID,
            IEnumerable <DomainObject> initialContents,
            ClientTransaction clientTransaction = null)
        {
            clientTransaction = clientTransaction ?? ClientTransactionScope.CurrentTransaction;
            var dataManager             = ClientTransactionTestHelper.GetDataManager(clientTransaction);
            var changeDetectionStrategy = new RootCollectionEndPointChangeDetectionStrategy();
            var dataStrategyFactory     = new AssociatedCollectionDataStrategyFactory(dataManager);
            var collectionEndPoint      = new CollectionEndPoint(
                clientTransaction,
                endPointID,
                new CollectionEndPointCollectionManager(endPointID, new CollectionEndPointCollectionProvider(dataStrategyFactory), dataStrategyFactory),
                dataManager,
                dataManager,
                ClientTransactionTestHelper.GetEventBroker(clientTransaction),
                new CollectionEndPointDataManagerFactory(changeDetectionStrategy));

            if (initialContents != null)
            {
                CollectionEndPointTestHelper.FillCollectionEndPointWithInitialContents(collectionEndPoint, initialContents);
            }

            return(collectionEndPoint);
        }
        public override void SetUp()
        {
            base.SetUp();

            _order1 = DomainObjectIDs.Order1.GetObject <Order> ();
            _order3 = DomainObjectIDs.Order3.GetObject <Order> ();
            _order4 = DomainObjectIDs.Order4.GetObject <Order> ();

            _currentData = new DomainObjectCollectionData(new[] { _order1, _order3 });

            _strategy = new RootCollectionEndPointChangeDetectionStrategy();
        }