Ejemplo n.º 1
0
        public void WpfDemoCheckDragDrop()
        {
            Assert.IsTrue(_fixture.SelectItem("Caption:Usual Controls"), "Select 'Usual Controls' tab");
            Assert.IsTrue(_fixture.SelectItem("Caption:Drag Drop"), "Select 'Drag Drop' tab");
            Assert.IsTrue(_fixture.DragControlAndDropOnControl("id:DragFrom", "id:DropTo"), "DragFrom DropTo");
            Assert.AreEqual("...", _fixture.ValueOfControl("id:DragFrom"), "Source value changed");
            Assert.AreEqual("Drag from here", _fixture.ValueOfControl("id:DropTo"), "Target value changed");

            // test used LightSeaGreen first, but that is not visible and therefore fails in Win 2012
            Assert.IsTrue(_fixture.DragControl("id:PapayaWhipItem"), "Drag PapayaWhip");
            Assert.IsTrue(_fixture.DropOnControl("id:ColorDropTextBlock"), "Drop on ColorDropTextBlock");
            Assert.AreEqual("Color is PapayaWhip", _fixture.ValueOfControl("id:ColorDropTextBlock"), "Color has been dropped");

            Assert.IsTrue(_fixture.DragControlAndDropOnControl("id:DragFrom", "id:ColorDropTextBlock"));
            Assert.AreEqual("Could not convert '...' into a color", _fixture.ValueOfControl("id:ColorDropTextBlock"), "Color has been dropped");

            Assert.IsTrue(_fixture.DragControlAndDropOnControl("name:PapayaWhip", "id:DragFrom"),
                          "drag from color and drop on label - but does nothing");
            Assert.AreEqual("...", _fixture.ValueOfControl("id:dragFrom"), "Drop attempt didn't change value");
        }