public override void Perform()
        {
            // After this operation, NewCollection will be associated with the end-point and ModifiedEndPoint.Collection will return NewCollection.
            // The previous ModifiedEndPoint.Collection will be a standalone copy of the end-point data.
            var oldDataStrategyOfNewCollection = CollectionEndPointCollectionManager.AssociateCollectionWithEndPoint(NewCollection);

            // Now, replace end-point's data with the data that was held by NewCollection before it was associated.
            ModifiedCollectionData.ReplaceContents(oldDataStrategyOfNewCollection);

            ModifiedEndPoint.Touch();
        }
コード例 #2
0
        public void Serialization()
        {
            var instance = new CollectionEndPointCollectionManager(
                _endPointID,
                new SerializableCollectionEndPointCollectionProviderFake(),
                new SerializableAssociatedCollectionDataStrategyFactoryFake());

            var deserializedInstance = Serializer.SerializeAndDeserialize(instance);

            Assert.That(deserializedInstance.EndPointID, Is.Not.Null);
            Assert.That(deserializedInstance.CollectionProvider, Is.Not.Null);
            Assert.That(deserializedInstance.DataStrategyFactory, Is.Not.Null);
        }
コード例 #3
0
        public override void SetUp()
        {
            base.SetUp();

            _collectionProviderMock = MockRepository.GenerateStrictMock <ICollectionEndPointCollectionProvider>();
            _associatedCollectionDataStrategyFactoryMock = MockRepository.GenerateStrictMock <IAssociatedCollectionDataStrategyFactory>();
            _endPointID = RelationEndPointID.Create(DomainObjectIDs.Customer1, typeof(Customer), "Orders");

            _manager = new CollectionEndPointCollectionManager(_endPointID, _collectionProviderMock, _associatedCollectionDataStrategyFactoryMock);

            _associatedDataStrategyStub = MockRepository.GenerateStub <IDomainObjectCollectionData> ();
            _associatedDataStrategyStub.Stub(stub => stub.RequiredItemType).Return(typeof(Order));
            _associatedDataStrategyStub.Stub(stub => stub.AssociatedEndPointID).Return(_endPointID);
        }