public void EqualsTest()
        {
            try {
                IavaJoint joint1 = new IavaJoint() { JointType = IavaJointType.HandLeft, TrackingState = IavaJointTrackingState.NotTracked };
                IavaJoint joint2 = new IavaJoint() { JointType = IavaJointType.HandLeft, TrackingState = IavaJointTrackingState.NotTracked };
                IavaJoint joint3 = new IavaJoint() { JointType = IavaJointType.KneeLeft, TrackingState = IavaJointTrackingState.Inferred };

                // Make sure joint1 does not equal null
                Assert.IsFalse(joint1.Equals(null));

                // Make sure joint1 does not equal a completly different object
                Assert.IsFalse(joint1.Equals("Not a joint."));

                // Make sure joint1 and joint3 are not equal
                Assert.IsFalse(joint1.Equals(joint3));

                // Make sure joint1 and joint2 are equal
                Assert.IsTrue(joint1.Equals(joint2));

                // Make sure joint1 equals itself
                Assert.IsTrue(joint1.Equals(joint1));
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        /// <summary>
        /// Default Constructor
        /// </summary>
        public IavaSkeleton()
        {
            Joints = new IavaJointCollection();

            IavaJoint iavaJoint = new IavaJoint();

            // Initialize the Joint Collection
            for (IavaJointType type = 0; type < IavaJointType.Count; type++) {
                iavaJoint.JointType = type;
                Joints[type] = iavaJoint;
            }
        }
        public void EqualityTest()
        {
            try {
                IavaJoint joint1 = new IavaJoint() { JointType = IavaJointType.HandLeft, TrackingState = IavaJointTrackingState.NotTracked };
                IavaJoint joint2 = new IavaJoint() { JointType = IavaJointType.HandLeft, TrackingState = IavaJointTrackingState.NotTracked };
                IavaJoint joint3 = new IavaJoint() { JointType = IavaJointType.KneeLeft, TrackingState = IavaJointTrackingState.Inferred };

                // Make sure joint1 does not equal null
                Assert.IsFalse(joint1 == null);

                // Make sure joint1 and joint3 are not equal
                Assert.IsFalse(joint1 == joint3);

                // Make sure joint1 and joint2 are equal
                Assert.IsTrue(joint1 == joint2);

                // Make sure joint1 equals itself
                Assert.IsTrue(joint1 == joint1);
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        public void ItemTest()
        {
            try {
                IavaJointCollection jointCollection = new IavaJointCollection();

                IavaJoint joint = new IavaJoint() { TrackingState = IavaJointTrackingState.Inferred };

                jointCollection[IavaJointType.AnkleLeft] = joint;

                Assert.AreEqual(joint, jointCollection[IavaJointType.AnkleLeft]);
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        /// <summary>
        /// Preps the IavaSkeleton object so it can be tested for performed gestures
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">IavaSkeletonEventArgs containing the Skeleton object</param>
        protected void OnSkeletonReady(object sender, IavaSkeletonEventArgs e)
        {
            if (!_detectingGestures) { return; }

            IavaSkeletonPoint translationVector = e.Skeleton.Joints[IavaJointType.HipCenter].Position;

            IavaJoint joint = new IavaJoint();

            // Translate all the points in the skeleton to the center of the kinect view
            for (IavaJointType jointID = 0; jointID < IavaJointType.Count; jointID++) {
                // Refer to http://stackoverflow.com/questions/1003772/setting-margin-properties-in-code
                // for why things are done this way
                joint = e.Skeleton.Joints[jointID];
                joint.Position = Geometry.Translate(joint.Position, translationVector);

                // Set the point to the point with the updated position
                e.Skeleton.Joints[jointID] = joint;
            }

            // If we're synced up look for gestures
            if (m_isSynced) { _engine.CheckForGesture(e.Skeleton); }

            // Check for the sync gesture
            else { _engine.CheckForSyncGesture(e.Skeleton); }
        }
        public void ExplicitCastTest()
        {
            try {
                // Create the Kinect object
                Joint kinectJoint = new Joint();
                PrivateObject po = new PrivateObject(kinectJoint);

                // Set the read only fields
                po.SetFieldOrProperty("JointType", JointType.ElbowLeft);
                po.SetFieldOrProperty("TrackingState", JointTrackingState.Inferred);

                // Cast the PrivateObject back to its Kinect equivalent
                kinectJoint = (Joint)po.Target;

                // Create the Iava Equivalent
                IavaJoint iavaJoint = new IavaJoint();
                iavaJoint.JointType = IavaJointType.ElbowLeft;
                iavaJoint.TrackingState = IavaJointTrackingState.Inferred;

                // Test object as a whole
                Assert.AreEqual(iavaJoint, (IavaJoint)kinectJoint);
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        public void TrackingStateTest()
        {
            try {
                IavaJoint joint = new IavaJoint();

                // Set the TrackingState
                joint.TrackingState = IavaJointTrackingState.NotTracked;

                // Make sure the property set correctly
                Assert.AreEqual(IavaJointTrackingState.NotTracked, joint.TrackingState);
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        public void PositionTest()
        {
            try {
                IavaJoint joint = new IavaJoint();

                IavaSkeletonPoint position = new IavaSkeletonPoint() { X = 0, Y = -1.3, Z = 7.8 };

                // Set the Position
                joint.Position = position;

                // Make sure the property set correctly
                Assert.AreEqual(position, joint.Position);
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        public void JointTypeTest()
        {
            try {
                IavaJoint joint = new IavaJoint();

                // Set the JointType
                joint.JointType = IavaJointType.ShoulderLeft;

                // Make sure the property set correctly
                Assert.AreEqual(IavaJointType.ShoulderLeft, joint.JointType);
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }