public void ExtendedGamePadStateCanBeConstructedFromGamePadState(Buttons button)
        {
            var state = new GamePadState(
                new Vector2(0.12f, 0.34f),
                new Vector2(0.56f, 0.78f),
                0.1234f, 0.5678f,
                button
                );
            var extendedState = new ExtendedGamePadState(ref state);

            Assert.AreEqual(0.12f, extendedState.GetAxis(ExtendedAxes.X));
            Assert.AreEqual(0.34f, extendedState.GetAxis(ExtendedAxes.Y));
            Assert.AreEqual(0.56f, extendedState.GetAxis(ExtendedAxes.RotationX));
            Assert.AreEqual(0.78f, extendedState.GetAxis(ExtendedAxes.RotationY));
            Assert.AreEqual(0.1234f, extendedState.GetSlider(ExtendedSliders.Slider1));
            Assert.AreEqual(0.5678f, extendedState.GetSlider(ExtendedSliders.Slider2));

            switch (button)
            {
            case Buttons.DPadUp: {
                Assert.AreEqual(0, extendedState.GetPov(0));
                break;
            }

            case Buttons.DPadRight: {
                Assert.AreEqual(9000, extendedState.GetPov(0));
                break;
            }

            case Buttons.DPadDown: {
                Assert.AreEqual(18000, extendedState.GetPov(0));
                break;
            }

            case Buttons.DPadLeft: {
                Assert.AreEqual(27000, extendedState.GetPov(0));
                break;
            }

            default: {
                Assert.IsTrue(
                    extendedState.IsButtonDown(
                        Array.IndexOf(ExtendedGamePadState.ButtonOrder, button)
                        )
                    );
                break;
            }
            }
        }
        public void AccessingInvalidAxisCausesException()
        {
            var state = new ExtendedGamePadState();

            Assert.Throws <ArgumentOutOfRangeException>(
                delegate() {
                state.GetAxis(ExtendedAxes.X | ExtendedAxes.Y);
            }
                );
        }
        public void ConstructorTakesOverAxisStates()
        {
            var axes    = new float[24];
            var sliders = new float[8];
            var buttons = new bool[128];
            var povs    = new int[4];

            int axisIndex = 0;

            foreach (ExtendedAxes axis in Enum.GetValues(typeof(ExtendedAxes)))
            {
                Array.Clear(axes, 0, 24);
                axes[axisIndex] = 12.34f;

                ExtendedGamePadState state = new ExtendedGamePadState(
                    axis, axes,
                    0, sliders,
                    0, buttons,
                    0, povs
                    );

                // Only the provided axis should be reported as available by the state
                Assert.AreEqual(state.AvailableAxes, axis);

                // Ensure only the provided axis has the value assigned
                foreach (ExtendedAxes axis2 in Enum.GetValues(typeof(ExtendedAxes)))
                {
                    if (axis2 == axis)
                    {
                        Assert.AreEqual(12.34f, state.GetAxis(axis2));
                    }
                    else
                    {
                        Assert.AreEqual(0.0f, state.GetAxis(axis2));
                    }
                }

                ++axisIndex;
            }
        }