public void MergeEmptyCollectionAndCollection() { DataContainerCollection secondCollection = new DataContainerCollection(); secondCollection.Add(_dataContainer); DataContainerCollection mergedCollection = _collection.Merge(secondCollection); Assert.That(mergedCollection.Count, Is.EqualTo(0)); }
public void MergeTwoCollectionsWithEqualDataContainer() { _collection.Add(_dataContainer); DataContainerCollection secondCollection = new DataContainerCollection(); DataContainer container = TestDataContainerObjectMother.CreateOrder1DataContainer(); secondCollection.Add(container); DataContainerCollection mergedCollection = _collection.Merge(secondCollection); Assert.That(mergedCollection.Count, Is.EqualTo(1)); Assert.That(mergedCollection[0], Is.SameAs(container)); }
public void JoinWithDataContainersOfSameID() { DataContainer dataContainer = TestDataContainerObjectMother.CreateOrder1DataContainer(); DataContainerCollection firstCollection = new DataContainerCollection(); firstCollection.Add(dataContainer); DataContainerCollection secondCollection = new DataContainerCollection(); secondCollection.Add(TestDataContainerObjectMother.CreateOrder1DataContainer()); DataContainerCollection joinedCollection = DataContainerCollection.Join(firstCollection, secondCollection); Assert.That(joinedCollection.Count, Is.EqualTo(1)); Assert.That(joinedCollection[0], Is.SameAs(dataContainer)); }
public void GetDifference() { DataContainer differentDataContainer = TestDataContainerObjectMother.CreateOrder2DataContainer(); _collection.Add(_dataContainer); _collection.Add(differentDataContainer); DataContainerCollection secondCollection = new DataContainerCollection(); secondCollection.Add(_dataContainer); DataContainerCollection difference = _collection.GetDifference(secondCollection); Assert.That(difference.Count, Is.EqualTo(1)); Assert.That(difference[0], Is.SameAs(differentDataContainer)); }
public void Join() { DataContainer firstDataContainer = TestDataContainerObjectMother.CreateOrder1DataContainer(); DataContainerCollection firstCollection = new DataContainerCollection(); firstCollection.Add(firstDataContainer); DataContainer secondDataContainer = TestDataContainerObjectMother.CreateOrder2DataContainer(); DataContainerCollection secondCollection = new DataContainerCollection(); secondCollection.Add(secondDataContainer); DataContainerCollection joinedCollection = DataContainerCollection.Join(firstCollection, secondCollection); Assert.That(joinedCollection.Count, Is.EqualTo(2)); Assert.That(joinedCollection[0].ID, Is.EqualTo(firstDataContainer.ID)); Assert.That(joinedCollection[1].ID, Is.EqualTo(secondDataContainer.ID)); }
public void MergeTwoCollections() { _collection.Add(_dataContainer); DataContainer order3 = TestDataContainerObjectMother.CreateOrder2DataContainer(); _collection.Add(order3); DataContainerCollection secondCollection = new DataContainerCollection(); DataContainer order1 = TestDataContainerObjectMother.CreateOrder1DataContainer(); secondCollection.Add(order1); DataContainerCollection mergedCollection = _collection.Merge(secondCollection); Assert.That(mergedCollection.Count, Is.EqualTo(2)); Assert.That(mergedCollection[_dataContainer.ID], Is.SameAs(order1)); Assert.That(mergedCollection[order3.ID], Is.SameAs(order3)); }
private DataContainerCollection LoadOppositeDataContainers( RelationEndPointID relationEndPointID, VirtualRelationEndPointDefinition virtualEndPointDefinition) { var oppositeEndPointDefinition = virtualEndPointDefinition.GetOppositeEndPointDefinition(); var oppositeProvider = _storageProviderManager.GetMandatory(oppositeEndPointDefinition.ClassDefinition.StorageEntityDefinition.StorageProviderDefinition.Name); var oppositeDataContainers = oppositeProvider.LoadDataContainersByRelatedID( (RelationEndPointDefinition)oppositeEndPointDefinition, virtualEndPointDefinition.GetSortExpression(), relationEndPointID.ObjectID); var oppositeDataContainerCollection = new DataContainerCollection(); foreach (var oppositeDataContainer in oppositeDataContainers) { CheckClassIDForVirtualEndPoint(relationEndPointID, oppositeDataContainer); oppositeDataContainerCollection.Add(oppositeDataContainer); } return(oppositeDataContainerCollection); }
public void Add() { _collection.Add(_dataContainer); Assert.That(_collection.Count, Is.EqualTo(1)); }