Exemplo n.º 1
0
        public void Group_Shapes_Remove_And_Add_To_Source()
        {
            var shape1 = new Class1();
            var shape2 = new Class1();
            var point1 = new PointShape();
            var point2 = new PointShape();

            var shapes = new BaseShape[] { shape1, shape2, point1, point2 };
            var source = shapes.ToList();

            var target = shapes.Group("g", source);

            Assert.Equal("g", target.Name);

            Assert.Contains(shape1, target.Shapes);
            Assert.Contains(shape2, target.Shapes);

            var lengthShapes = target.Shapes.Length;

            Assert.Equal(2, lengthShapes);

            Assert.Contains(point1, target.Connectors);
            Assert.Contains(point2, target.Connectors);

            var lengthConnectors = target.Connectors.Length;

            Assert.Equal(2, lengthConnectors);

            Assert.Contains(target, source);

            var count = source.Count;

            Assert.Equal(1, count);
        }
Exemplo n.º 2
0
        public void Group_Shapes_Do_Not_Update_Source()
        {
            var shape1 = new Class1();
            var shape2 = new Class1();
            var point1 = new PointShape();
            var point2 = new PointShape();

            var shapes = new BaseShape[] { shape1, shape2, point1, point2 };
            var source = shapes.ToList();

            shapes.Group("g", null);

            Assert.Contains(shape1, source);
            Assert.Contains(shape2, source);
            Assert.Contains(point1, source);
            Assert.Contains(point2, source);

            var count = source.Count;

            Assert.Equal(4, count);
        }