Beispiel #1
0
        public void GoToStateAction()
        {
            var c = new TestGoToStateAction();

            c.StateName = "State1";
            var t = new MyControl();

            c.Target = t;
            c.TestInvoke();

            Assert.AreEqual(t, c.Element);
            Assert.AreEqual(true, t is Control);
            Assert.AreEqual("State1", c.ReceiveStateName);
            Assert.AreEqual(false, c.Success);
        }
Beispiel #2
0
        public void GoToStateAction_Success()
        {
            var c = new TestGoToStateAction();

            c.StateName = "State1";
            var g = new Grid();
            var v = new VisualStateGroup {
                Name = "States"
            };
            var s1 = new VisualState {
                Name = "State1"
            };

            //var s1 = (VisualState)XamlReader.Parse("<VisualState x:Name=\"State1\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" />");
            v.States.Add(s1);
            VisualStateManager.GetVisualStateGroups(g).Add(v);

            c.Target = g;
            c.TestInvoke();

            Assert.AreEqual(g, c.Element);
            Assert.AreEqual("State1", c.ReceiveStateName);
            Assert.AreEqual(true, c.Success);
        }