Пример #1
0
        public void TestCreateInstanceCore()
        {
            StubTrigger action = new StubTrigger();

            WindowsBase.Freezable freezable = action.GetCreateInstanceCore();
            Assert.AreEqual(freezable.GetType(), typeof(StubTrigger), "freezable.GetType() == typeof(StubTrigger)");
        }
Пример #2
0
        public void TestCreateInstanceCore()
        {
            StubAction action = new StubAction();

            SysWindows.Freezable freezable = action.GetCreateInstanceCore();
            Assert.AreEqual(freezable.GetType(), typeof(StubAction), "freezable.GetType() == typeof(StubAction)");
        }
Пример #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();
            }
Пример #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);
     }
 }