Example #1
0
        public void MoveToTest()
        {
            var rand             = new System.Random();
            var max_cursor_range = 0xFFF;
            var min_cursor_range = -0xFFF;
            var start            = Cursor.Position;

            foreach (int i in Enumerable.Range(0, 100))
            {
                mouseEvents.Clear();
                var x = rand.Next(max_cursor_range - min_cursor_range) - min_cursor_range;
                var y = rand.Next(max_cursor_range - min_cursor_range) - min_cursor_range;
                sender.MoveTo(x, y);
                var evnt = mouseEvents[0].Item1;
                var pos  = mouseEvents[0].Item2.pt;
                Assert.AreEqual(evnt, LowLevelMouseHook.Event.WM_MOUSEMOVE);
                Assert.AreEqual(pos.x, x);
                Assert.AreEqual(pos.y, y);
            }
        }