コード例 #1
0
        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());
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        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());
        }