Ejemplo n.º 1
0
        public void TestCreateInstanceCore()
        {
            StubTrigger action = new StubTrigger();

            WindowsBase.Freezable freezable = action.GetCreateInstanceCore();
            Assert.AreEqual(freezable.GetType(), typeof(StubTrigger), "freezable.GetType() == typeof(StubTrigger)");
        }
Ejemplo n.º 2
0
        public void TestCreateInstanceCore()
        {
            StubAction action = new StubAction();

            SysWindows.Freezable freezable = action.GetCreateInstanceCore();
            Assert.AreEqual(freezable.GetType(), typeof(StubAction), "freezable.GetType() == typeof(StubAction)");
        }
Ejemplo n.º 3
0
            public FreezableProxyCommand(Freezable freezable, string name)
                : base(null, name)
            {
                _freezable = freezable;

                var evt = _freezable.GetType().GetEvent("InheritanceContextChanged",
                    BindingFlags.Instance | BindingFlags.NonPublic);
                var addMethod = evt.GetAddMethod(true);
                addMethod.Invoke(freezable, new[] {new EventHandler(OnInheritanceContextChanged)});

                SetFrameworkElementFromInheritanceContext();
            }
Ejemplo n.º 4
0
 private static void Debug_VerifyInstance(String methodName, Freezable original, Freezable newInstance)
 {
     if (Invariant.Strict)
     {
         Invariant.Assert(newInstance != null, "{0} should not return null.", methodName);
         Invariant.Assert(newInstance.GetType() == original.GetType(),
             String.Format(System.Globalization.CultureInfo.InvariantCulture,
                 "{0} should return instance of same type. (Expected= '{1}', Actual='{2}')",
                 methodName, original.GetType(), newInstance.GetType()));
         Invariant.Assert(!newInstance.IsFrozen, "{0} should return a mutable instance. Recieved a frozen instance.",
             methodName);
     }
 }