public void GetMyo_ValidState_EqualsConstructorParameter() { // Setup var myo = new Mock<IMyo>(); var args = new ArmRecognizedEventArgs( myo.Object, DateTime.UtcNow, Arm.Unknown, XDirection.Unknown); // Execute var result = args.Myo; // Assert Assert.Equal(myo.Object, result); }
public void GetArm_ValidState_EqualsConstructorParameter() { // Setup var arm = Arm.Left; var args = new ArmRecognizedEventArgs( new Mock<IMyo>().Object, DateTime.UtcNow, arm, XDirection.Unknown); // Execute var result = args.Arm; // Assert Assert.Equal(arm, result); }
/// <summary> /// Called when the Myo has recognized which arm it is on. /// </summary> /// <param name="evt">The pointer to the event.</param> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnArmRecognized(IntPtr evt, DateTime timestamp) { var arm = _myoDeviceDriver.GetArm(evt); this.Arm = arm; var xDirection = _myoDeviceDriver.GetEventDirectionX(evt); this.XDirectionOnArm = xDirection; var handler = ArmRecognized; if (handler != null) { var args = new ArmRecognizedEventArgs( this, timestamp, arm, xDirection); handler.Invoke(this, args); } }
/// <summary> /// Called when the Myo has recognized which arm it is on. /// </summary> /// <param name="evt">The pointer to the event.</param> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnArmRecognized(IntPtr evt, DateTime timestamp) { // Contract.Requires<ArgumentException>(evt != IntPtr.Zero, "The event handle must be set."); var arm = _myoDeviceDriver.GetArm(evt); this.Arm = arm; var xDirection = _myoDeviceDriver.GetEventDirectionX(evt); this.XDirectionOnArm = xDirection; var handler = ArmRecognized; if (handler != null) { var args = new ArmRecognizedEventArgs( this, timestamp, arm, xDirection); handler.Invoke(this, args); } }
public void GetTimestamp_ValidState_EqualsConstructorParameter() { // Setup var timestamp = DateTime.UtcNow; var args = new ArmRecognizedEventArgs( new Mock<IMyo>().Object, timestamp, Arm.Unknown, XDirection.Unknown); // Execute var result = args.Timestamp; // Assert Assert.Equal(timestamp, result); }
public void GetXDirection_ValidState_EqualsConstructorParameter() { // Setup var directionX = XDirection.TowardElbow; var args = new ArmRecognizedEventArgs( new Mock<IMyo>().Object, DateTime.UtcNow, Arm.Unknown, directionX); // Execute var result = args.XDirection; // Assert Assert.Equal(directionX, result); }