Exemple #1
0
        public override void StartPlaybackWithExistingFile(string filePath)
        {
            MActionRecorderLinq tmpMActionRecorder = new MActionRecorderLinq(filePath);

            Win32API.MouseEvent[] actions = tmpMActionRecorder.GetDatas();

            Thread.Sleep(1000);

            foreach (var item in actions)
            {
                mSimulator.Simulate(item.dwFlags, item.pt.x, item.pt.y, 0, UIntPtr.Zero);
                Thread.Sleep(item.delayTime);
            }
        }
 public void WriteDataTest1()
 {
     MActionRecorderLinq target = new MActionRecorderLinq();
     string mouseEvents = "WM_LBUTTONDOWN";
     MSLLHOOKSTRUCT myMouse = new MSLLHOOKSTRUCT() { pt = new Win32API.POINT(0, 0) };
     int delayTime = 10;
     target.WriteData(mouseEvents, myMouse, delayTime);
     target.SaveActions();
     Win32API.MouseEvent Expected = new Win32API.MouseEvent()
     {
         dwFlags = Win32API.MouseEventFlag.LeftDown,
         delayTime = 10,
         pt = new Win32API.POINT(0, 0)
     };
     var actual = target.GetDatas()[0];
     Assert.AreEqual(Expected, actual);
 }
 public void GetDatasTest()
 {
     MActionRecorderLinq target = new MActionRecorderLinq();
     target.WriteData("WM_LBUTTONDOWN", new MSLLHOOKSTRUCT() { pt = new Win32API.POINT(0, 0) }, 10);
     target.SaveActions();
     Win32API.MouseEvent[] expected = new Win32API.MouseEvent[]
     {
         new Win32API.MouseEvent()
         { 
             dwFlags=Win32API.MouseEventFlag.LeftDown,
             pt=new Win32API.POINT(0, 0),
             delayTime=10
         }
         
     };
     Win32API.MouseEvent[] actual;
     actual = target.GetDatas();
     
     Assert.AreEqual(expected[0], actual[0]);
     
 }