public void ResolveCollectionRelationData() { var parentObjects = new DomainObject[] { DomainObjectMother.CreateFakeObject <OrderItem>(), DomainObjectMother.CreateFakeObject <OrderItem>() }; _parentTransactionContextMock .Expect(mock => mock.ResolveRelatedObjects(_collectionEndPointID)) .Return(parentObjects.AsOneTime()); var alreadyLoadedObjectData = MockRepository.GenerateStub <ILoadedObjectData> (); _alreadyLoadedObjectDataProviderMock .Expect(mock => mock.GetLoadedObject(parentObjects[0].ID)) .Return(alreadyLoadedObjectData); _alreadyLoadedObjectDataProviderMock .Expect(mock => mock.GetLoadedObject(parentObjects[1].ID)) .Return(null); var parentDataContainer = CreateChangedDataContainer(parentObjects[1].ID, 4711, _productPropertyDefinition, "Keyboard"); CheckDataContainer(parentDataContainer, parentObjects[1].ID, 4711, StateType.Changed, _productPropertyDefinition, "Keyboard", "", true); _parentTransactionContextMock .Expect(mock => mock.GetDataContainerWithLazyLoad(parentObjects[1].ID, true)) .Return(parentDataContainer); var result = _persistenceStrategy.ResolveCollectionRelationData(_collectionEndPointID, _alreadyLoadedObjectDataProviderMock).ToList(); _parentTransactionContextMock.VerifyAllExpectations(); _alreadyLoadedObjectDataProviderMock.VerifyAllExpectations(); Assert.That(result[0], Is.SameAs(alreadyLoadedObjectData)); Assert.That(result[1], Is.TypeOf <FreshlyLoadedObjectData> ()); var dataContainer = ((FreshlyLoadedObjectData)result[1]).FreshlyLoadedDataContainer; CheckDataContainer(dataContainer, parentDataContainer.ID, 4711, StateType.Unchanged, _productPropertyDefinition, "Keyboard", "Keyboard", false); }