public void ShouldGetElementsInSameLockGroupWhenRequested() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var element2 = new TimelineElement(); var element3 = new TimelineElement(); var element4 = new TimelineElement(); var group1 = new List <TimelineElement> { element1, element2 }; var group2 = new List <TimelineElement> { element3, element4 }; manager.LockElements(group1); manager.LockElements(group2); IEnumerable <TimelineElement> elementsGroupedWithElement2 = manager.GetGroupedElements(element2); Assert.AreEqual(2, elementsGroupedWithElement2.Count()); Assert.IsTrue(elementsGroupedWithElement2.Contains(element1)); Assert.IsTrue(elementsGroupedWithElement2.Contains(element2)); IEnumerable <TimelineElement> elementsGroupedWithElement4 = manager.GetGroupedElements(element4); Assert.IsTrue(elementsGroupedWithElement4.Contains(element3)); Assert.IsTrue(elementsGroupedWithElement4.Contains(element4)); Assert.AreEqual(2, elementsGroupedWithElement4.Count()); }
public void ShouldUpdateGroupToWhichElementBelongsToAfterGroupsAreMerged() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var element2 = new TimelineElement(); var element3 = new TimelineElement(); var element4 = new TimelineElement(); var group1 = new List <TimelineElement> { element1, element2 }; var group2 = new List <TimelineElement> { element3, element4 }; manager.LockElements(group1); manager.LockElements(group2); var group3 = new List <TimelineElement> { element1, element4 }; manager.LockElements(group3); var elements = manager.GetGroupedElements(element3); Assert.IsTrue(elements.Contains(element1)); Assert.IsTrue(elements.Contains(element2)); Assert.IsTrue(elements.Contains(element3)); Assert.IsTrue(elements.Contains(element4)); }
public void ShouldReturnElementWhenTryingToGetElementInGroupOfNotGroupedElement() { var element = new TimelineElement(); ILockGroupManager manager = this.CreateGroupLockManager(); var elements = manager.GetGroupedElements(element); Assert.AreEqual(1, elements.Count()); Assert.AreSame(element, elements.First()); }
public void ShouldReturnSingleElementAfterUnlockingGroup() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var element2 = new TimelineElement(); var group1 = new List <TimelineElement> { element1, element2 }; manager.LockElements(group1); manager.UnlockElementLockGroup(element2); Assert.AreEqual(0, manager.LockGroups.Count); var elements = manager.GetGroupedElements(element1); Assert.AreEqual(1, elements.Count()); elements = manager.GetGroupedElements(element2); Assert.AreEqual(1, elements.Count()); }