public void GetHeightTest()
        {
            var items = new List<ICanvasItem>
                        {
                            Item1,
                            Item2,
                        };

            var group = new CanvasItemSelection(items);

            Assert.AreEqual(60, group.Height);
        }
        public void SetWidthTest()
        {
            var items = new List<ICanvasItem>
                        {
                            Item1,
                            Item2,
                        };

            var group = new CanvasItemSelection(items);

            group.Width = 280;


            var item1 = items[0];
            var item2 = items[1];

            Assert.AreEqual(280, group.Width);
            Assert.AreEqual(240, item1.Width);
            Assert.AreEqual(220, item2.Width);
        }
        public void GetWidthTest()
        {
            var items = new List<ICanvasItem>
                        {
                            Item1,
                            Item2,
                        };

            var group = new CanvasItemSelection(items);

            Assert.AreEqual(140, group.Width);
        }
        public void GetLeftTest()
        {
            var group = new CanvasItemSelection(Items);

            Assert.AreEqual(10, group.Left);
        }
        public void GetTopTest()
        {
            var group = new CanvasItemSelection(Items);

            Assert.AreEqual(20, group.Top);
        }
        public void ZeroItemsHeightGroupTest()
        {
            var items = new List<ICanvasItem>();

            var group = new CanvasItemSelection(items);
            Assert.AreEqual(double.NaN, group.Height);
        }
        public void ItemsWithZeroHeight()
        {
            var item = new CanvasModelItem() { Left = 0, Top = 0, Width = 0, Height = 0 };

            var items = new List<ICanvasItem>() { item };

            var group = new CanvasItemSelection(items);
            Assert.AreEqual(0, group.Height);
        }
        public void SetTopTest()
        {
            var items = Items;

            var group = new CanvasItemSelection(items);
            group.Top = 30;

            var item1 = group.Children[0];
            var item2 = group.Children[1];

            Assert.AreEqual(30, group.Top);
            Assert.AreEqual(30, item1.Top);
            Assert.AreEqual(70, item2.Top);
        }
        public void SetLeftTest()
        {
            var items = Items;

            var group = new CanvasItemSelection(items);
            group.Left = 20;

            var item1 = group.Children[0];
            var item2 = group.Children[1];

            Assert.AreEqual(20, group.Left);
            Assert.AreEqual(20, item1.Left);
            Assert.AreEqual(50, item2.Left);
        }
        public void SetHeightTest()
        {
            var items = new List<ICanvasItem>
                        {
                            Item1,
                            Item2,
                        };

            var group = new CanvasItemSelection(items);

            group.Height = 120;


            var item1 = group.Children[0];
            var item2 = group.Children[1];

            Assert.AreEqual(120, group.Height);
            Assert.AreEqual(60, item1.Height);
            Assert.AreEqual(40, item2.Height);
        }
        private void WrapSelectedItems()
        {
            var items = SelectionAdorners.Keys.ToList();

            if (WrappedSelectedItems !=null)
            {
                WrappedSelectedItems.Dispose();
            }

            if (items.Any())
            {
                WrappedSelectedItems = new CanvasItemSelection(items);
            }
            else
            {

                WrappedSelectedItems = null;
            }
        }
        private void WrapSelectedItems()
        {
            if (WrappedSelectedItems != null)
            {
                WrappedSelectedItems.Dispose();
            }

            if (DesignSurface.SelectedItems.Count > 0)
            {
                WrappedSelectedItems = new CanvasItemSelection(DesignSurface.SelectedItems.Cast<ICanvasItem>());
            }
            else
            {

                WrappedSelectedItems = null;
            }
        }