public void DpadTest(ButtonState up, ButtonState down, ButtonState left, ButtonState right) { var pad = new GamePadDPad(up, down, left, right); Assert.AreEqual(up, pad.Up); Assert.AreEqual(down, pad.Down); Assert.AreEqual(left, pad.Left); Assert.AreEqual(right, pad.Right); #if !XNA var pad2 = new GamePadDPad { Up = up, Down = down, Left = left, Right = right }; Assert.AreEqual(pad, pad2); Assert.AreEqual(pad.GetHashCode(), pad2.GetHashCode()); var buttons = (Buttons)0; if (up == ButtonState.Pressed) { buttons |= Buttons.DPadUp; } if (down == ButtonState.Pressed) { buttons |= Buttons.DPadDown; } if (left == ButtonState.Pressed) { buttons |= Buttons.DPadLeft; } if (right == ButtonState.Pressed) { buttons |= Buttons.DPadRight; } var pad3 = new GamePadDPad(buttons); Assert.AreEqual(pad, pad3); Assert.AreEqual(pad.GetHashCode(), pad3.GetHashCode()); #endif }