public void SingletonErrorTest1(TestMethodRecord tmr)
 {
     using (SystemHookTestWrapper hook1 = new SystemHookTestWrapper(HookTypes.MouseLL))
     {
         tmr.RegisterException("Creating a second hook of the same type will fail.", typeof(ManagedHooksException));
         SystemHookTestWrapper hook2 = new SystemHookTestWrapper(HookTypes.MouseLL);
     }
 }
        public void ConstructionUnsupportedTypeTests(TestMethodRecord tmr)
        {
            HookTypes type = HookTypes.Hardware;

            tmr.WriteLine("If you implement the hook type HookTypes." + type +
                          ", change the type parameter to continue testing this senario.");

            tmr.RegisterException("An unimplemented hook type will cause an exception.",
                                  typeof(HookTypeNotImplementedException));

            SystemHookTestWrapper hook = new SystemHookTestWrapper(type);
        }
Пример #3
0
        public void UtilityMethodTests2(TestMethodRecord tmr)
        {
            using (SystemHookTestWrapper hook = new SystemHookTestWrapper(HookTypes.MouseLL))
            {
                int x = 0, y = 0;

                tmr.RegisterException("Invalid LPARAM in GetMousePosition utility method is not allowed..",
                                      typeof(ManagedHooksException));

                hook.GetMousePositionWrapper(new UIntPtr(512), new IntPtr(0), ref x, ref y);
            }
        }
Пример #4
0
        public void UtilityMethodTests1(TestMethodRecord tmr)
        {
            using (SystemHookTestWrapper hook = new SystemHookTestWrapper(HookTypes.MouseLL))
            {
                int vkCode = 0;

                tmr.RegisterException("Invalid LPARAM in GetKeyboardReading utility method is not allowed..",
                                      typeof(ManagedHooksException));

                hook.GetKeyboardReadingWrapper(new UIntPtr(512), new IntPtr(0), ref vkCode);
            }
        }
        public void UnsupportedFilterTypesTest1(TestMethodRecord tmr)
        {
            HookTypes type = HookTypes.Hardware;

            tmr.WriteLine("If you implement the hook type HookTypes." + type +
                          ", change the type parameter to continue testing this senario.");

            using (SystemHookTestWrapper hook = new SystemHookTestWrapper(HookTypes.MouseLL))
            {
                tmr.RegisterException("An unimplemented hook type will cause an exception (filter message).",
                                      typeof(ManagedHooksException));

                hook.FilterMessageWrapper(type, 12345);
            }
        }
 public void NullImplementationTest(TestMethodRecord tmr)
 {
     tmr.RegisterException("Null implementation causes an exception.", typeof(ArgumentNullException));
     IKeyboardHookExt keyboard = HookFactory.CreateKeyboardHookExt(null);
 }