public void GestureSyncUnsyncTest()
        {
            try {
                GestureRecognizer recognizer = new GestureRecognizer(_directoryPath);

                bool syncEventFired = false;
                bool unsyncEventFired = false;

                // Register for the Synced and Unsynced events
                recognizer.Synced += (param1, param2) => syncEventFired = true;
                recognizer.Unsynced += (param1, param2) => unsyncEventFired = true;

                recognizer.Start();

                // Set the Sync Timeout to 5 seconds
                recognizer.SyncTimeoutValue = 5000;

                // Set the Sync Gesture
                PrivateObject privateObject = new PrivateObject(recognizer);
                privateObject.SetProperty("SyncGesture", new IavaGesture("Sync", new List<IavaSnapshot>()));

                // Recognize the 'Sync' Gesture
                privateObject.Invoke("OnGestureRecognized", null, new GestureEventArgs("Sync"));
                Thread.Sleep(50);

                // Make sure the Sync Event fired
                Assert.IsTrue(syncEventFired);

                // Make sure the Unsync Event did not fire
                Assert.IsFalse(unsyncEventFired);

                // Reset the sync event
                syncEventFired = false;

                // Wait for the timeout to occur
                Thread.Sleep(recognizer.SyncTimeoutValue);

                // Make sure the Unsync Event fired
                Assert.IsTrue(unsyncEventFired);

                // Make sure the Sync Event did not fire
                Assert.IsFalse(syncEventFired);

                recognizer.Stop();
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        public void OnGestureRecognizedTest()
        {
            try {
                GestureRecognizer recognizer = new GestureRecognizer(_directoryPath);

                bool syncEventFired = false;
                bool waveCallbackInvoked = false;
                bool shakeCallbackInvoked = false;

                // Set the Sync Gesture
                PrivateObject privateObject = new PrivateObject(recognizer);
                privateObject.SetProperty("SyncGesture", new IavaGesture("Sync", new List<IavaSnapshot>()));

                // Register for some Gestures
                recognizer.Synced += (parm1, param2) => { syncEventFired = true; };
                recognizer.Subscribe("Wave", (eventArgs) => { waveCallbackInvoked = true; });
                recognizer.Subscribe("Shake", (eventArgs) => { shakeCallbackInvoked = true; });
                recognizer.Start();

                try {
                    // Recognize the Wave gesture
                    privateObject.Invoke("OnGestureRecognized", null, new GestureEventArgs("Wave"));
                    Thread.Sleep(50);

                    // Make sure the Wave callback fired
                    Assert.IsTrue(waveCallbackInvoked);

                }
                catch (Exception ex) {
                    Assert.Fail(ex.Message);
                }

                try {
                    // Recognize the Shake gesture
                    privateObject.Invoke("OnGestureRecognized", null, new GestureEventArgs("Shake"));
                    Thread.Sleep(50);

                    // Make sure the Shake callback fired
                    Assert.IsTrue(shakeCallbackInvoked);

                }
                catch (Exception ex) {
                    Assert.Fail(ex.Message);
                }

                try {
                    // Recognize the Sync gesture
                    privateObject.Invoke("OnGestureRecognized", null, new GestureEventArgs("Sync"));
                    Thread.Sleep(50);

                    // Make sure the Sync event fired,
                    Assert.IsTrue(syncEventFired);

                }
                catch (Exception ex) {
                    Assert.Fail(ex.Message);
                }

                try {
                    // Reset the Sync, Wave, and Shake callbacks
                    syncEventFired = false;
                    waveCallbackInvoked = false;
                    shakeCallbackInvoked = false;

                    // Recognize the Wave gesture again
                    privateObject.Invoke("OnGestureRecognized", null, new GestureEventArgs("Wave"));
                    Thread.Sleep(50);

                    // Make sure the Wave callback fired
                    Assert.IsTrue(waveCallbackInvoked);

                    // Recognize the Shake gesture again
                    privateObject.Invoke("OnGestureRecognized", null, new GestureEventArgs("Shake"));
                    Thread.Sleep(50);

                    // Make sure the Shake callback fired
                    Assert.IsTrue(shakeCallbackInvoked);
                }
                catch (Exception ex) {
                    Assert.Fail(ex.Message);
                }

                recognizer.Stop();
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        public void GestureStopTest()
        {
            try {
                GestureRecognizer recognizer = new GestureRecognizer(_directoryPath);

                // Make sure the Recognizer isn't showing a faulty status
                Assert.AreEqual(RecognizerStatus.NotReady, recognizer.Status);

                bool eventFired = false;

                // Register for the Recognizer Stopped Event
                recognizer.Stopped += (param1, param2) => eventFired = true;

                try {
                    // Start the Recognizer
                    recognizer.Start();
                    Thread.Sleep(50);

                    // Make sure we're showing the correct status
                    Assert.AreEqual(RecognizerStatus.Running, recognizer.Status);

                    // Stop the Recognizer
                    recognizer.Stop();
                    Thread.Sleep(50);

                    // Make sure we're showing the correct status
                    Assert.AreEqual(RecognizerStatus.Ready, recognizer.Status);

                    // Make sure the Recognizer Stopped Event was fired
                    Assert.IsTrue(eventFired);
                }
                catch (Exception ex) {
                    Assert.Fail(ex.Message);
                }
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }