/// <summary>
        /// Creates an <see cref="IDomainObjectCollectionData"/> object for stand-alone collections. The returned object takes care of argument checks,
        /// required item checks, and event raising.
        /// </summary>
        /// <param name="dataStore">The data store to use for the collection.</param>
        /// <param name="requiredItemType">The required item type to use for the collection.</param>
        /// <param name="eventRaiser">The event raiser to use for raising events.</param>
        /// <returns>An instance of <see cref="IDomainObjectCollectionData"/> that can be used for stand-alone collections.</returns>
        public static IDomainObjectCollectionData CreateDataStrategyForStandAloneCollection(
            IDomainObjectCollectionData dataStore,
            Type requiredItemType,
            IDomainObjectCollectionEventRaiser eventRaiser)
        {
            ArgumentUtility.CheckNotNull("dataStore", dataStore);
            ArgumentUtility.CheckNotNull("eventRaiser", eventRaiser);

            return(new ModificationCheckingCollectionDataDecorator(requiredItemType, new EventRaisingCollectionDataDecorator(eventRaiser, dataStore)));
        }
Пример #2
0
        public override void SetUp()
        {
            base.SetUp();

            _mockRepository  = new MockRepository();
            _eventRaiserMock = _mockRepository.StrictMock <IDomainObjectCollectionEventRaiser> ();

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

            var realContent = new DomainObjectCollectionData(new[] { _order1, _order3, _order4 });

            _eventRaisingDecoratorWithRealContent = new EventRaisingCollectionDataDecorator(_eventRaiserMock, realContent);

            _eventRaiserMock.BackToRecord();
            _eventRaiserMock.Replay();
        }
        public override void SetUp()
        {
            base.SetUp();

            _definition = Configuration.GetTypeDefinition(typeof(Customer)).GetRelationEndPointDefinition(typeof(Customer).FullName + ".Orders");

            _collectionEndPointMock = MockRepository.GenerateStrictMock <ICollectionEndPoint>();
            _dataManagerMock        = MockRepository.GenerateStrictMock <ICollectionEndPointDataManager>();
            _dataManagerMock.Stub(stub => stub.EndPointID).Return(RelationEndPointID.Create(DomainObjectIDs.Customer1, _definition));
            _endPointProviderStub     = MockRepository.GenerateStub <IRelationEndPointProvider> ();
            _transactionEventSinkStub = MockRepository.GenerateStub <IClientTransactionEventSink> ();
            _eventRaiserMock          = MockRepository.GenerateStrictMock <IDomainObjectCollectionEventRaiser>();

            _loadState = new CompleteCollectionEndPointLoadState(_dataManagerMock, _endPointProviderStub, _transactionEventSinkStub);

            _relatedObject       = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order1);
            _relatedEndPointStub = MockRepository.GenerateStub <IRealObjectEndPoint> ();
            _relatedEndPointStub.Stub(stub => stub.GetDomainObjectReference()).Return(_relatedObject);
            _relatedEndPointStub.Stub(stub => stub.ObjectID).Return(_relatedObject.ID);
            _owningObject          = DomainObjectMother.CreateFakeObject <Customer>();
            _collectionManagerStub = MockRepository.GenerateStub <ICollectionEndPointCollectionManager> ();
        }
 public IndirectDomainObjectCollectionEventRaiser(IDomainObjectCollectionEventRaiser eventRaiser)
 {
     EventRaiser = eventRaiser;
 }
Пример #5
0
 public EventRaisingCollectionDataDecorator(IDomainObjectCollectionEventRaiser eventRaiser, IDomainObjectCollectionData wrappedData)
     : base(wrappedData)
 {
     ArgumentUtility.CheckNotNull("eventRaiser", eventRaiser);
     _eventRaiser = eventRaiser;
 }