Esempio n. 1
0
 public void JudgeMouseeventTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     XElement item = new XElement(
         "Action", new XAttribute("Type", "MouseAct"),
         new XAttribute("DelayTime", 10),
      new XElement("Position", new Win32API.POINT(0, 0)),
      new XElement("MouseEvent", "WM_LBUTTONDOWN"));
     Win32API.MouseEvent mouseEvent = new Win32API.MouseEvent()
     {
         delayTime = 10,
         dwFlags = Miku.Client.Win32API.MouseEventFlag.LeftDown,
         pt = new Win32API.POINT(0, 0)
     };
     Win32API.MouseEvent mouseEventExpected = new Win32API.MouseEvent()
     {
         delayTime = 10,
         
         pt = new Win32API.POINT(0, 0)
     };
     target.JudgeMouseevent(item, ref mouseEventExpected);
     
     Assert.AreEqual(mouseEventExpected, mouseEvent);
    
 }
Esempio n. 2
0
 public void AddActionNodesToActionListTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     List<object> datas = new List<object>();
     IEnumerable<XElement> re = new List<XElement>()
     {
         new XElement(
         "Action", new XAttribute("Type", "MouseAct"),
         new XAttribute("DelayTime", 10),
      new XElement("Position", new Win32API.POINT(0, 0)),
      new XElement("MouseEvent", "WM_LBUTTONDOWN")),
       new XElement(new XElement(
         "Action", new XAttribute("Type", "KeyboardAct"),
         new XAttribute("DelayTime", 10.ToString()),
        new XElement("KeyData", ((int)Keys.A).ToString()), new XAttribute("FriendlyName", Keys.A.ToString()),
        new XElement("KeyEvent", KeyboardEvents.WM_KeyDown.ToString())))
     };
     target.AddActionNodesToActionList(datas, re);
     Assert.AreEqual(datas.Count, 2);
 }
Esempio n. 3
0
 public void GetMouseActionNodesTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     target.WriteData("WM_LBUTTONDOWN", new MSLLHOOKSTRUCT() { pt = new Win32API.POINT(0, 0) }, 10);
     target.SaveActions();
     IEnumerable<XElement> actual;
     actual = target.GetMouseActionNodes();
     Assert.IsNotNull(actual);
     //Assert.IsNull(actual);
 }
Esempio n. 4
0
        public void JudgeKeyeventTest()
        {
            KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
            Win32API.KeyEvent keyEvent = new Win32API.KeyEvent()
            {
                dwFlags = Miku.Client.Win32API_Accessor.KBEventFlag.KeyUp,
                bVk = Convert.ToInt32(Keys.A),
                delayTime = 10
            };
            Win32API.KeyEvent keyEventExpected = new Win32API.KeyEvent()
            {
                dwFlags = Miku.Client.Win32API_Accessor.KBEventFlag.KeyDown,
                bVk = Convert.ToInt32(Keys.A),
                delayTime = 10,    
            };

            string eventName = KeyboardEvents.WM_KeyDown.ToString(); 
            target.JudgeKeyevent(ref keyEvent, eventName); 
            Assert.AreEqual(keyEventExpected, keyEvent);
        }
Esempio n. 5
0
 public void GetKeyboradActionNodesTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();            
     target.WriteData(KeyboardEvents.WM_KeyDown.ToString(), Keys.A, 10);
     target.SaveActions();
     IEnumerable<XElement> expected = new List<XElement>()
     {
         new XElement(
         "Action", new XAttribute("Type", "KeyboardAct"),
         new XAttribute("DelayTime", 10.ToString()),
        new XElement("KeyData", ((int)Keys.A).ToString()), new XAttribute("FriendlyName", Keys.A.ToString()),
        new XElement("KeyEvent", KeyboardEvents.WM_KeyDown.ToString()))
     };
     IEnumerable<XElement> actual;
     actual = target.GetKeyboradActionNodes();
     Assert.IsNotNull(actual);
    
 }
Esempio n. 6
0
 public void GetActionNodesTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     target.WriteData(KeyboardEvents.WM_KeyDown.ToString(), Keys.A, 10);
     target.SaveActions();            
     IEnumerable<XElement> actual;
     actual = target.GetActionNodes();
     Assert.IsNotNull( actual);           
 }
Esempio n. 7
0
 public void AddMouseActionToActionListTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     List<object> datas =new List<object>();      
     XElement item = new XElement(
         "Action", new XAttribute("Type", "MouseAct"),
         new XAttribute("DelayTime", 10),
      new XElement("Position", new Win32API.POINT(0, 0)),
      new XElement("MouseEvent", "WM_LBUTTONDOWN"));
     target.AddMouseActionToActionList(datas, item);
     Assert.IsNotNull(datas);
 }
Esempio n. 8
0
 public void AddMouseActionNodesToActionListTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     List<Win32API.MouseEvent> datas = new List<Win32API.MouseEvent>();
     IEnumerable<XElement> re = new List<XElement>() 
     {
         new XElement(
         "Action", new XAttribute("Type", "MouseAct"),
         new XAttribute("DelayTime", 10),
      new XElement("Position", new Win32API.POINT(0, 0)),
      new XElement("MouseEvent", "WM_LBUTTONDOWN"))
     };
     target.AddMouseActionNodesToActionList(datas, re);
     Assert.AreEqual(datas.Count, 1);
 }
Esempio n. 9
0
 public void AddKeyboardActionToActionListTest()
 {
     KBMActionRecorderLinq_Accessor target = new KBMActionRecorderLinq_Accessor();
     List<object> datas = new List<object>();     
     XElement item = new XElement(
         "Action", new XAttribute("Type", "KeyboardAct"), 
         new XAttribute("DelayTime", 10),
       new XElement("KeyData", (int)Keys.A),
       new XElement("KeyEvent", KeyboardEvents.WM_KeyDown.ToString()));
     target.AddKeyboardActionToActionList(datas, item);
     Assert.IsNotNull(datas);
     Assert.IsNotNull(target);
 }