Exemple #1
0
        public override void SetUp()
        {
            base.SetUp();

            _persistenceStrategyMock      = MockRepository.GenerateStrictMock <IPersistenceStrategy> ();
            _objectLoaderMock             = MockRepository.GenerateStrictMock <IObjectLoader> ();
            _transactionEventSinkWithMock = MockRepository.GenerateStrictMock <IClientTransactionEventSink>();

            _queryManager = new QueryManager(
                _persistenceStrategyMock,
                _objectLoaderMock,
                _transactionEventSinkWithMock);

            _collectionQuery = QueryFactory.CreateQueryFromConfiguration("OrderQuery");
            _scalarQuery     = QueryFactory.CreateQueryFromConfiguration("OrderNoSumByCustomerNameQuery");
            _customQuery     = QueryFactory.CreateQueryFromConfiguration("CustomQuery");

            _fakeOrder1 = DomainObjectMother.CreateFakeObject <Order> ();
            _fakeOrder2 = DomainObjectMother.CreateFakeObject <Order>();

            _loadedObjectDataStub1 = MockRepository.GenerateStub <ILoadedObjectData> ();
            _loadedObjectDataStub2 = MockRepository.GenerateStub <ILoadedObjectData> ();

            _rowConversion = qrr => qrr.GetRawValue(0);
        }
Exemple #2
0
        public void BeginRegisterIfRequired_ConsolidatesDuplicates()
        {
            var freshlyLoadedObject1a       = GetFreshlyLoadedObject();
            var registerableDataContainer1a = freshlyLoadedObject1a.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer1a.HasDomainObject, Is.False);

            var freshlyLoadedObject1b       = GetFreshlyLoadedObject(freshlyLoadedObject1a.ObjectID);
            var registerableDataContainer1b = freshlyLoadedObject1b.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer1b.HasDomainObject, Is.False);

            _mockRepository.ReplayAll();

            var allObjects = new ILoadedObjectData[] { freshlyLoadedObject1a, freshlyLoadedObject1b };
            var collector  = new LoadedObjectDataPendingRegistrationCollector();
            var result     = _agent.BeginRegisterIfRequired(allObjects, false, collector);

            _mockRepository.VerifyAll();
            CheckHasEnlistedDomainObject(registerableDataContainer1a);

            Assert.That(collector.DataPendingRegistration, Is.EquivalentTo(new[] { freshlyLoadedObject1a }));
            Assert.That(result, Is.EqualTo(new[] { freshlyLoadedObject1a, freshlyLoadedObject1a }));

            Assert.That(registerableDataContainer1b.HasDomainObject, Is.False);
        }
Exemple #3
0
        public override void SetUp()
        {
            base.SetUp();

            _loadedObjectData = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order1);
            _dataSourceData   = DataContainer.CreateForExisting(DomainObjectIDs.Order1, null, pd => pd.DefaultValue);
        }
Exemple #4
0
        public void BeginRegisterIfRequired_WithNotFoundObjects_AndThrowOnNotFoundFalse_RaisesOnNotFoundAndProceeds()
        {
            var freshlyLoadedObject       = GetFreshlyLoadedObject();
            var registerableDataContainer = freshlyLoadedObject.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer.HasDomainObject, Is.False);

            var notFoundLoadedObject = GetNotFoundLoadedObject();

            using (_mockRepository.Ordered())
            {
                _registrationListenerMock
                .Expect(
                    mock => mock.OnObjectsNotFound(
                        Arg <ReadOnlyCollection <ObjectID> > .List.Equal(new[] { notFoundLoadedObject.ObjectID })));
            }
            _mockRepository.ReplayAll();

            var allObjects =
                new ILoadedObjectData[]
            {
                freshlyLoadedObject,
                notFoundLoadedObject
            };
            var collector = new LoadedObjectDataPendingRegistrationCollector();
            var result    = _agent.BeginRegisterIfRequired(allObjects, false, collector);

            _mockRepository.VerifyAll();
            CheckHasEnlistedDomainObject(registerableDataContainer);

            Assert.That(collector.DataPendingRegistration, Is.EqualTo(new[] { freshlyLoadedObject }));
            Assert.That(result, Is.EqualTo(allObjects));
        }
Exemple #5
0
        public void BeginRegisterIfRequired_WithNotFoundObjects_AndThrowOnNotFoundTrue_RaisesdOnNotFoundAndThrows()
        {
            var freshlyLoadedObject       = GetFreshlyLoadedObject();
            var registerableDataContainer = freshlyLoadedObject.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer.HasDomainObject, Is.False);

            var notFoundLoadedObject = GetNotFoundLoadedObject();

            _registrationListenerMock
            .Expect(
                mock => mock.OnObjectsNotFound(
                    Arg <ReadOnlyCollection <ObjectID> > .List.Equal(new[] { notFoundLoadedObject.ObjectID })));
            _mockRepository.ReplayAll();

            var allObjects =
                new ILoadedObjectData[]
            {
                freshlyLoadedObject,
                notFoundLoadedObject
            };
            var collector = new LoadedObjectDataPendingRegistrationCollector();

            Assert.That(() => _agent.BeginRegisterIfRequired(allObjects, true, collector), Throws.TypeOf <ObjectsNotFoundException> ());

            _mockRepository.VerifyAll();

            // Note: In this case, we currently set the DomainObjects of the freshly loaded DataContainer, and we also add them to the collector. This
            // shouldn't make any difference, and it's easier to implement.
            Assert.That(registerableDataContainer.HasDomainObject, Is.True);
            Assert.That(collector.DataPendingRegistration, Is.EquivalentTo(new[] { freshlyLoadedObject }));
        }
Exemple #6
0
        public void BeginRegisterIfRequired_RaisesBeginEvent_AndSetsDomainObjects_ButDoesNotRegister()
        {
            var freshlyLoadedObject       = GetFreshlyLoadedObject();
            var registerableDataContainer = freshlyLoadedObject.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer.HasDomainObject, Is.False);

            var alreadyExistingLoadedObject = GetAlreadyExistingLoadedObject();
            var nullLoadedObject            = GetNullLoadedObject();
            var invalidLoadedObject         = GetInvalidLoadedObject();

            _mockRepository.ReplayAll();

            var allObjects =
                new ILoadedObjectData[]
            {
                freshlyLoadedObject,
                alreadyExistingLoadedObject,
                nullLoadedObject,
                invalidLoadedObject
            };
            var collector = new LoadedObjectDataPendingRegistrationCollector();
            var result    = _agent.BeginRegisterIfRequired(allObjects, false, collector);

            _mockRepository.VerifyAll();
            CheckHasEnlistedDomainObject(registerableDataContainer);

            Assert.That(collector.DataPendingRegistration, Is.EquivalentTo(new[] { freshlyLoadedObject }));
            Assert.That(result, Is.EqualTo(allObjects));
        }
Exemple #7
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 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();
        }
Exemple #9
0
        public void RegisterIfRequired_MultipleObjects_ThrowOnNotFoundFalse()
        {
            var freshlyLoadedObject1       = GetFreshlyLoadedObject();
            var registerableDataContainer1 = freshlyLoadedObject1.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer1.HasDomainObject, Is.False);

            var freshlyLoadedObject2       = GetFreshlyLoadedObject();
            var registerableDataContainer2 = freshlyLoadedObject2.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer2.HasDomainObject, Is.False);

            var alreadyExistingLoadedObject = GetAlreadyExistingLoadedObject();
            var nullLoadedObject            = GetNullLoadedObject();
            var invalidLoadedObject         = GetInvalidLoadedObject();
            var notFoundLoadedObject1       = GetNotFoundLoadedObject();
            var notFoundLoadedObject2       = GetNotFoundLoadedObject();

            var loadedObjectIDs = new[] { registerableDataContainer1.ID, registerableDataContainer2.ID };

            using (_mockRepository.Ordered())
            {
                _registrationListenerMock
                .Expect(
                    mock => mock.OnObjectsNotFound(
                        Arg <ReadOnlyCollection <ObjectID> > .List.Equal(new[] { notFoundLoadedObject1.ObjectID, notFoundLoadedObject2.ObjectID })));
                _registrationListenerMock.Expect(mock => mock.OnBeforeObjectRegistration(Arg <ReadOnlyCollection <ObjectID> > .List.Equal(loadedObjectIDs)));
                _dataManagerMock
                .Expect(mock => mock.RegisterDataContainer(registerableDataContainer1))
                .WhenCalled(mi => CheckHasEnlistedDomainObject(registerableDataContainer1));
                _dataManagerMock
                .Expect(mock => mock.RegisterDataContainer(registerableDataContainer2))
                .WhenCalled(mi => CheckHasEnlistedDomainObject(registerableDataContainer2));
                _registrationListenerMock
                .Expect(mock => mock.OnAfterObjectRegistration(
                            Arg <ReadOnlyCollection <ObjectID> > .List.Equal(loadedObjectIDs),
                            // Lazy matching because DataContainers don't have DomainObjects from the start
                            Arg <ReadOnlyCollection <DomainObject> > .Matches(list => list.SequenceEqual(
                                                                                  new[] { registerableDataContainer1.DomainObject, registerableDataContainer2.DomainObject }))));
            }
            _mockRepository.ReplayAll();

            var allObjects =
                new ILoadedObjectData[]
            {
                freshlyLoadedObject1,
                alreadyExistingLoadedObject,
                freshlyLoadedObject2,
                nullLoadedObject,
                invalidLoadedObject,
                notFoundLoadedObject1,
                notFoundLoadedObject2
            };
            var result = _agent.RegisterIfRequired(allObjects, false);

            _mockRepository.VerifyAll();
            Assert.That(_clientTransaction.IsDiscarded, Is.False);
            Assert.That(result, Is.EqualTo(allObjects));
        }
Exemple #10
0
        public void RegisterIfRequired_MultipleObjects_ThrowOnNotFoundTrue()
        {
            var freshlyLoadedObject1       = GetFreshlyLoadedObject();
            var registerableDataContainer1 = freshlyLoadedObject1.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer1.HasDomainObject, Is.False);

            var freshlyLoadedObject2       = GetFreshlyLoadedObject();
            var registerableDataContainer2 = freshlyLoadedObject2.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer2.HasDomainObject, Is.False);

            var alreadyExistingLoadedObject = GetAlreadyExistingLoadedObject();
            var nullLoadedObject            = GetNullLoadedObject();
            var invalidLoadedObject         = GetInvalidLoadedObject();
            var notFoundLoadedObject1       = GetNotFoundLoadedObject();
            var notFoundLoadedObject2       = GetNotFoundLoadedObject();

            _registrationListenerMock
            .Expect(
                mock => mock.OnObjectsNotFound(
                    Arg <ReadOnlyCollection <ObjectID> > .List.Equal(new[] { notFoundLoadedObject1.ObjectID, notFoundLoadedObject2.ObjectID })));
            _mockRepository.ReplayAll();

            var allObjects =
                new ILoadedObjectData[]
            {
                freshlyLoadedObject1,
                alreadyExistingLoadedObject,
                freshlyLoadedObject2,
                nullLoadedObject,
                invalidLoadedObject,
                notFoundLoadedObject1,
                notFoundLoadedObject2
            };

            Assert.That(
                () => _agent.RegisterIfRequired(allObjects, true),
                Throws.TypeOf <ObjectsNotFoundException>().With.Message.EqualTo(
                    string.Format("Object(s) could not be found: '{0}', '{1}'.", notFoundLoadedObject1.ObjectID, notFoundLoadedObject2.ObjectID)));

            _registrationListenerMock.AssertWasNotCalled(mock => mock.OnBeforeObjectRegistration(Arg <ReadOnlyCollection <ObjectID> > .Is.Anything));
            _registrationListenerMock.VerifyAllExpectations();

            _dataManagerMock.AssertWasNotCalled(mock => mock.RegisterDataContainer(Arg <DataContainer> .Is.Anything));
        }
        public override void SetUp()
        {
            base.SetUp();

            _mockRepository = new MockRepository();

            _persistenceStrategyMock = _mockRepository.StrictMock <IPersistenceStrategy> ();
            _loadedObjectDataRegistrationAgentMock = _mockRepository.StrictMock <ILoadedObjectDataRegistrationAgent>();
            _loadedObjectDataProviderStub          = _mockRepository.Stub <ILoadedObjectDataProvider>();

            _objectLoader = new ObjectLoader(_persistenceStrategyMock, _loadedObjectDataRegistrationAgentMock, _loadedObjectDataProviderStub);

            _fakeQuery = CreateFakeQuery();

            _loadedObjectDataStub1 = MockRepository.GenerateStub <ILoadedObjectData> ();
            _loadedObjectDataStub2 = MockRepository.GenerateStub <ILoadedObjectData> ();
        }
        public void PerformEagerFetching_NoOriginatingObjects()
        {
            var fetchQueries = new EagerFetchQueryCollection {
                { _orderTicketEndPointDefinition, _fetchQueryStub1 }
            };

            var originatingObjectsData = new ILoadedObjectData[0];

            _fetchResultLoaderMock.Replay();
            _registrationAgentMock.Replay();

            _eagerFetcher.PerformEagerFetching(originatingObjectsData, fetchQueries, _fetchResultLoaderMock, _pendingRegistrationCollector);

            _fetchResultLoaderMock.AssertWasNotCalled(mock => mock.GetOrLoadFetchQueryResult(_fetchQueryStub1, _pendingRegistrationCollector));

            _fetchResultLoaderMock.VerifyAllExpectations();
            _registrationAgentMock.VerifyAllExpectations();
        }
        public LoadedObjectDataWithDataSourceData(ILoadedObjectData loadedObjectData, DataContainer dataSourceData)
        {
            ArgumentUtility.CheckNotNull("loadedObjectData", loadedObjectData);

            if (!loadedObjectData.IsNull && dataSourceData == null)
            {
                throw new ArgumentException("The dataSourceData parameter must not be null when loadedObjectData.IsNull is false.", "dataSourceData");
            }
            if (loadedObjectData.IsNull && dataSourceData != null)
            {
                throw new ArgumentException("The dataSourceData parameter must be null when loadedObjectData.IsNull is true.", "dataSourceData");
            }
            if (!loadedObjectData.IsNull && loadedObjectData.ObjectID != dataSourceData.ID)
            {
                throw new ArgumentException("The ID of the dataSourceData parameter does not match the loadedObjectData.", "dataSourceData");
            }

            _loadedObjectData = loadedObjectData;
            _dataSourceData   = dataSourceData;
        }
        public override void SetUp()
        {
            base.SetUp();

            _agent = new FetchedRealObjectRelationDataRegistrationAgent();

            var originatingOrderTicket1 = DomainObjectMother.CreateFakeObject <OrderTicket> (DomainObjectIDs.OrderTicket1);
            var originatingOrderTicket2 = DomainObjectMother.CreateFakeObject <OrderTicket> (DomainObjectIDs.OrderTicket2);

            _originatingOrderTicketData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(originatingOrderTicket1);
            _originatingOrderTicketData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(originatingOrderTicket2);

            var fetchedOrder1 = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order1);
            var fetchedOrder2 = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order3);
            var fetchedOrder3 = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order4);

            _fetchedOrderData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(fetchedOrder1);
            _fetchedOrderData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(fetchedOrder2);
            _fetchedOrderData3 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(fetchedOrder3);
        }
        public override void SetUp()
        {
            base.SetUp();

            _virtualEndPointProviderMock = MockRepository.GenerateStrictMock <IVirtualEndPointProvider> ();

            _agent = new FetchedCollectionRelationDataRegistrationAgent(_virtualEndPointProviderMock);

            _originatingCustomer1 = DomainObjectMother.CreateFakeObject <Customer> (DomainObjectIDs.Customer1);
            _originatingCustomer2 = DomainObjectMother.CreateFakeObject <Customer> (DomainObjectIDs.Customer2);

            _originatingCustomerData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(_originatingCustomer1);
            _originatingCustomerData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(_originatingCustomer2);

            _fetchedOrder1 = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order1);
            _fetchedOrder2 = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order3);
            _fetchedOrder3 = DomainObjectMother.CreateFakeObject <Order> (DomainObjectIDs.Order4);

            _fetchedOrderData1 = CreateFetchedOrderData(_fetchedOrder1, _originatingCustomer1.ID);
            _fetchedOrderData2 = CreateFetchedOrderData(_fetchedOrder2, _originatingCustomer2.ID);
            _fetchedOrderData3 = CreateFetchedOrderData(_fetchedOrder3, _originatingCustomer1.ID);
        }
Exemple #16
0
        public void RegisterIfRequired_MultipleObjects_DuplicateFreshlyLoadedObjects_AreConsolidated()
        {
            var freshlyLoadedObject1a       = GetFreshlyLoadedObject();
            var registerableDataContainer1a = freshlyLoadedObject1a.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer1a.HasDomainObject, Is.False);

            var freshlyLoadedObject1b       = GetFreshlyLoadedObject(freshlyLoadedObject1a.ObjectID);
            var registerableDataContainer1b = freshlyLoadedObject1b.FreshlyLoadedDataContainer;

            Assert.That(registerableDataContainer1b.HasDomainObject, Is.False);

            var loadedObjectIDs = new[] { registerableDataContainer1a.ID };

            using (_mockRepository.Ordered())
            {
                _registrationListenerMock.Expect(mock => mock.OnBeforeObjectRegistration(Arg <ReadOnlyCollection <ObjectID> > .List.Equal(loadedObjectIDs)));
                _dataManagerMock
                .Expect(mock => mock.RegisterDataContainer(registerableDataContainer1a))
                .WhenCalled(mi => CheckHasEnlistedDomainObject(registerableDataContainer1a));
                _registrationListenerMock
                .Expect(mock => mock.OnAfterObjectRegistration(
                            Arg <ReadOnlyCollection <ObjectID> > .List.Equal(loadedObjectIDs),
                            // Lazy matching because DataContainers don't have DomainObjects from the start
                            Arg <ReadOnlyCollection <DomainObject> > .Matches(list => list.SequenceEqual(
                                                                                  new[] { registerableDataContainer1a.DomainObject }))));
            }
            _mockRepository.ReplayAll();

            var allObjects = new ILoadedObjectData[] { freshlyLoadedObject1a, freshlyLoadedObject1b };
            var result     = _agent.RegisterIfRequired(allObjects, false).ToArray();

            _mockRepository.VerifyAll();
            Assert.That(_clientTransaction.IsDiscarded, Is.False);
            Assert.That(result, Is.EqualTo(new[] { freshlyLoadedObject1a, freshlyLoadedObject1a }));

            Assert.That(registerableDataContainer1b.HasDomainObject, Is.False);
        }
Exemple #17
0
        public override void SetUp()
        {
            base.SetUp();

            _loadedDataContainerProviderStub = MockRepository.GenerateStub <ILoadedDataContainerProvider> ();
            _virtualEndPointProviderMock     = MockRepository.GenerateStrictMock <IVirtualEndPointProvider> ();

            _agent = new FetchedVirtualObjectRelationDataRegistrationAgent(_virtualEndPointProviderMock);

            _originatingEmployee1 = DomainObjectMother.CreateFakeObject <Employee> (DomainObjectIDs.Employee1);
            _originatingEmployee2 = DomainObjectMother.CreateFakeObject <Employee> (DomainObjectIDs.Employee2);

            _originatingEmployeeData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(_originatingEmployee1);
            _originatingEmployeeData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(_originatingEmployee2);

            _fetchedComputer1 = DomainObjectMother.CreateFakeObject <Computer> (DomainObjectIDs.Computer1);
            _fetchedComputer2 = DomainObjectMother.CreateFakeObject <Computer> (DomainObjectIDs.Computer2);
            _fetchedComputer3 = DomainObjectMother.CreateFakeObject <Computer> (DomainObjectIDs.Computer3);

            _fetchedComputerData1 = CreateFetchedComputerData(_fetchedComputer1, _originatingEmployee1.ID);
            _fetchedComputerData2 = CreateFetchedComputerData(_fetchedComputer2, _originatingEmployee2.ID);
            _fetchedComputerData3 = CreateFetchedComputerData(_fetchedComputer3, DomainObjectIDs.Employee3);
        }
        private void CheckClassDefinitionOfOriginatingObject(IRelationEndPointDefinition relationEndPointDefinition, ILoadedObjectData originatingObject)
        {
            ArgumentUtility.CheckNotNull("relationEndPointDefinition", relationEndPointDefinition);
            ArgumentUtility.CheckNotNull("originatingObject", originatingObject);

            var relationEndPointDefinitionInheritanceRoot = relationEndPointDefinition.ClassDefinition.GetInheritanceRootClass();
            var originatingObjectInheritanceRoot          = originatingObject.ObjectID.ClassDefinition.GetInheritanceRootClass();

            if (ReferenceEquals(relationEndPointDefinitionInheritanceRoot, originatingObjectInheritanceRoot))
            {
                return;
            }

            var message = string.Format(
                "Cannot register relation end-point '{0}' for domain object '{1}'. The end-point belongs to an object of "
                + "class '{2}' but the domain object has class '{3}'.",
                relationEndPointDefinition.PropertyName,
                originatingObject.ObjectID,
                relationEndPointDefinition.ClassDefinition.ID,
                originatingObject.ObjectID.ClassDefinition.ID);

            throw new InvalidOperationException(message);
        }
Exemple #19
0
        public static LoadedObjectDataWithDataSourceData CreateLoadedObjectDataWithDataSourceData(ILoadedObjectData loadedObjectData)
        {
            var dataContainer = DataContainer.CreateForExisting(loadedObjectData.ObjectID, null, pd => pd.DefaultValue);

            return(new LoadedObjectDataWithDataSourceData(loadedObjectData, dataContainer));
        }
Exemple #20
0
 private ILoadedObjectData CreateEquivalentData(ILoadedObjectData loadedObjectData)
 {
     return(LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(loadedObjectData.ObjectID));
 }
Exemple #21
0
 public void RegisterIfRequired(ILoadedObjectData loadedObjectData, bool throwOnNotFound)
 {
     throw new System.NotImplementedException();
 }