public void OnDockPaneRemovedTest()
        {
            var target = new DockBayLayoutEngine(new DockBayBase());
            var neighA = new DockPaneLayoutEngine(new DockPaneBase());
            var neighB = new DockPaneLayoutEngine(new DockPaneBase());
            var logger = new bool[2];
            var counter = 0;
            target.PaneRemovedInBay += (sender, e) =>
            {
                //[0]はneighAのeventが呼ばれたかを記録
                //[1]はneighBのeventが呼ばれたかを記録
                logger[0] |= neighA == e.DockPane;
                logger[1] |= neighB == e.DockPane;
                counter++;
                if (counter > 2)
                    Assert.Fail("DockPaneAddedの呼び出し回数が多すぎです");
            };
            target.Add(neighA, DockDirection.Top);
            neighA.Add(neighB, DockDirection.Left);
            neighA.Remove(neighB);
            target.Remove(neighA);

            Assert.AreEqual<int>(counter, 2, "DockPaneAddedの呼び出し回数が少なすぎです。");
        }
        public void RemoveTest()
        {
            //テスト事項
            //Bay: 子要素の最初の時
            //Pane: 子要素がある場合の処理, 独身の場合

            var bay = new DockBayLayoutEngine(new DockBayBase());
            var lv1A = new DockPaneLayoutEngine(new DockPaneBase());
            var lv1B = new DockPaneLayoutEngine(new DockPaneBase());
            var lv2A = new DockPaneLayoutEngine(new DockPaneBase());
            var flg_removed = false;
            bay.PaneRemoved += (sender, e) => flg_removed = true;

            //lv0A
            //-lv1A(Top)
            //-lv1B(Left)
            // -lv2A(Bottom)
            bay.Add(lv1A, DockDirection.Top);
            bay.Add(lv1B, DockDirection.Left);
            lv1B.Add(lv2A, DockDirection.Bottom);

            var lv1ASeq = new[]
                {
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = lv2A, Right = (DockPaneLayoutEngine)null, Align = DockDirection.Top, Parent = (DockNodeLayoutEngine)bay },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = lv2A, Right = (DockPaneLayoutEngine)null, Align = DockDirection.Top, Parent = (DockNodeLayoutEngine)bay },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = lv2A, Right = (DockPaneLayoutEngine)null, Align = DockDirection.Top, Parent = (DockNodeLayoutEngine)bay },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = (DockPaneLayoutEngine)null, Align = DockDirection.None, Parent = (DockNodeLayoutEngine)null },
                };
            var lv1BSeq = new[]
                {
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = (DockPaneLayoutEngine)null, Align = DockDirection.None, Parent = (DockNodeLayoutEngine)null },
                    new { Top = lv1B, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = lv2A, Align = DockDirection.Bottom, Parent = (DockNodeLayoutEngine)lv2A },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = (DockPaneLayoutEngine)null, Align = DockDirection.None, Parent = (DockNodeLayoutEngine)null },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = (DockPaneLayoutEngine)null, Align = DockDirection.None, Parent = (DockNodeLayoutEngine)null },
                };
            var lv2ASeq = new[]
                {
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = lv2A, Align = DockDirection.Left, Parent = (DockNodeLayoutEngine)bay },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = lv1B, Left = (DockPaneLayoutEngine)null, Right = lv2A, Align = DockDirection.Left, Parent = (DockNodeLayoutEngine)bay },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = lv2A, Align = DockDirection.Left, Parent = (DockNodeLayoutEngine)bay },
                    new { Top = (DockPaneLayoutEngine)null, Bottom = (DockPaneLayoutEngine)null, Left = (DockPaneLayoutEngine)null, Right = (DockPaneLayoutEngine)null, Align = DockDirection.Left, Parent = (DockNodeLayoutEngine)bay },
                };
            var testFunc = (Action<int>)(idx =>
                {
                    Assert.AreEqual(lv1ASeq[idx].Align, lv1A.Align);
                    Assert.AreEqual(lv1ASeq[idx].Parent, lv1A.Parent);
                    Assert.AreEqual(lv1ASeq[idx].Top, lv1A.Top);
                    Assert.AreEqual(lv1ASeq[idx].Bottom, lv1A.Bottom);
                    Assert.AreEqual(lv1ASeq[idx].Left, lv1A.Left);
                    Assert.AreEqual(lv1ASeq[idx].Right, lv1A.Right);

                    Assert.AreEqual(lv1BSeq[idx].Align, lv1B.Align);
                    Assert.AreEqual(lv1BSeq[idx].Parent, lv1B.Parent);
                    Assert.AreEqual(lv1BSeq[idx].Top, lv1B.Top);
                    Assert.AreEqual(lv1BSeq[idx].Bottom, lv1B.Bottom);
                    Assert.AreEqual(lv1BSeq[idx].Left, lv1B.Left);
                    Assert.AreEqual(lv1BSeq[idx].Right, lv1B.Right);

                    Assert.AreEqual(lv2ASeq[idx].Align, lv2A.Align);
                    Assert.AreEqual(lv2ASeq[idx].Parent, lv2A.Parent);
                    Assert.AreEqual(lv2ASeq[idx].Top, lv2A.Top);
                    Assert.AreEqual(lv2ASeq[idx].Bottom, lv2A.Bottom);
                    Assert.AreEqual(lv2ASeq[idx].Left, lv2A.Left);
                    Assert.AreEqual(lv2ASeq[idx].Right, lv2A.Right);
                });

            //lv0A
            //-lv1A(Top)
            //-lv2A(Bottom->Left)
            bay.Remove(lv1B);
            testFunc(0);

            //lv0A
            //-lv1A(Top)
            //-lv2A(Bottom->Left)
            // -lv1B(Left->Bottom)
            lv2A.Add(lv1B, DockDirection.Bottom);
            testFunc(1);

            //lv0A
            //-lv1A(Top)
            //-lv2A(Bottom->Left)
            lv2A.Remove(lv1B);
            testFunc(2);

            //lv0A
            //-lv2A(Bottom->Left)
            bay.Remove(lv1A);
            testFunc(3);

            Assert.IsTrue(flg_removed, "Removed eventが発生してません。");
        }