public void WriteDataTest() { KBMActionRecorderLinq target = new KBMActionRecorderLinq(); string keyEvents = KeyboardEvents.WM_KeyDown.ToString(); Keys myKey = Keys.A; int delayTime = 10; target.WriteData(keyEvents, myKey, delayTime); target.SaveActions(); Win32API.KeyEvent Expected = new Win32API.KeyEvent() { dwFlags = Miku.Client.Win32API_Accessor.KBEventFlag.KeyDown, bVk = Convert.ToInt32(Keys.A), delayTime = 10 }; var actual = target.GetDatas()[0]; Assert.AreEqual(Expected, actual); }
public void GetKeyboardActionDatasTest() { KBMActionRecorderLinq target = new KBMActionRecorderLinq(); target.WriteData(KeyboardEvents.WM_KeyDown.ToString(), Keys.A, 10); target.SaveActions(); Win32API.KeyEvent[] expected = new Win32API.KeyEvent[] { new Win32API.KeyEvent() { dwFlags = Miku.Client.Win32API_Accessor.KBEventFlag.KeyDown, bVk = Convert.ToInt32(Keys.A), delayTime = 10 } }; Win32API.KeyEvent[] actual; actual = target.GetKeyboardActionDatas(); Assert.AreEqual(expected[0], actual[0]); }
public void GetMouseActionDatasTest() { KBMActionRecorderLinq target = new KBMActionRecorderLinq(); target.WriteData("WM_LBUTTONDOWN", new MSLLHOOKSTRUCT() { pt = new Win32API.POINT(0, 0) }, 10); target.SaveActions(); Win32API.MouseEvent[] expected = new Win32API.MouseEvent[] { new Win32API.MouseEvent() { delayTime = 10, dwFlags = Miku.Client.Win32API.MouseEventFlag.LeftDown , pt=new Win32API.POINT(0, 0) } }; Win32API.MouseEvent[] actual; actual = target.GetMouseActionDatas(); Assert.AreEqual(expected[0], actual[0]); }
public void GetDatasTest() { KBMActionRecorderLinq target = new KBMActionRecorderLinq(); target.WriteData("WM_LBUTTONDOWN", new MSLLHOOKSTRUCT() { pt = new Win32API.POINT(0, 0) }, 10); target.SaveActions(); target.WriteData(KeyboardEvents.WM_KeyDown.ToString(), Keys.A, 10); target.SaveActions(); object[] expected = new object[] { new Win32API.MouseEvent() { delayTime = 10, dwFlags = Miku.Client.Win32API.MouseEventFlag.LeftDown , pt=new Win32API.POINT(0, 0) }, new Win32API.KeyEvent() { dwFlags = Miku.Client.Win32API_Accessor.KBEventFlag.KeyDown, bVk = Convert.ToInt32(Keys.A), delayTime = 10 } }; object[] actual; actual = target.GetDatas(); Assert.AreEqual(expected[0], actual[0]); Assert.AreEqual(expected[1], actual[1]); }