public void EqualsTest() { try { IavaJointCollection collection1 = new IavaJointCollection(); collection1[IavaJointType.AnkleLeft] = new IavaJoint() { TrackingState = IavaJointTrackingState.Inferred }; collection1[IavaJointType.AnkleRight] = new IavaJoint() { TrackingState = IavaJointTrackingState.NotTracked }; collection1[IavaJointType.ElbowLeft] = new IavaJoint() { TrackingState = IavaJointTrackingState.Tracked }; collection1[IavaJointType.ElbowRight] = new IavaJoint() { TrackingState = IavaJointTrackingState.NotTracked }; IavaJointCollection collection2 = new IavaJointCollection(); collection2[IavaJointType.AnkleLeft] = new IavaJoint() { TrackingState = IavaJointTrackingState.Inferred }; collection2[IavaJointType.AnkleRight] = new IavaJoint() { TrackingState = IavaJointTrackingState.NotTracked }; collection2[IavaJointType.ElbowLeft] = new IavaJoint() { TrackingState = IavaJointTrackingState.Tracked }; collection2[IavaJointType.ElbowRight] = new IavaJoint() { TrackingState = IavaJointTrackingState.NotTracked }; IavaJointCollection collection3 = new IavaJointCollection(); collection3[IavaJointType.HipCenter] = new IavaJoint() { TrackingState = IavaJointTrackingState.Inferred }; collection3[IavaJointType.AnkleRight] = new IavaJoint() { TrackingState = IavaJointTrackingState.NotTracked }; collection3[IavaJointType.ElbowLeft] = new IavaJoint() { TrackingState = IavaJointTrackingState.Tracked }; collection3[IavaJointType.Spine] = new IavaJoint() { TrackingState = IavaJointTrackingState.NotTracked }; // Make sure collection1 does not equal null Assert.IsFalse(collection1.Equals(null)); // Make sure eventArgs1 does not equal a completly different object Assert.IsFalse(collection1.Equals("Not a collection.")); // Make sure collection1 and collection3 are not equal Assert.IsFalse(collection1.Equals(collection3)); // Make sure collection1 and collection2 are equal Assert.IsTrue(collection1.Equals(collection2)); // Make sure collection1 equals itself Assert.IsTrue(collection1.Equals(collection1)); } catch (Exception ex) { Assert.Fail(ex.Message); } }