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 AccessingInvalidSliderCausesException()
        {
            var state = new ExtendedGamePadState();

            Assert.Throws <ArgumentOutOfRangeException>(
                delegate() {
                state.GetSlider(ExtendedSliders.Slider1 | ExtendedSliders.Slider2);
            }
                );
        }
        public void ConstructorTakesOverSliderStates()
        {
            var axes    = new float[24];
            var sliders = new float[8];
            var buttons = new bool[128];
            var povs    = new int[4];

            int sliderIndex = 0;

            foreach (ExtendedSliders slider in Enum.GetValues(typeof(ExtendedSliders)))
            {
                Array.Clear(sliders, 0, 8);
                sliders[sliderIndex] = 12.34f;

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

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

                // Ensure only the provided slider has the value assigned
                foreach (ExtendedSliders slider2 in Enum.GetValues(typeof(ExtendedSliders)))
                {
                    if (slider2 == slider)
                    {
                        Assert.AreEqual(12.34f, state.GetSlider(slider2));
                    }
                    else
                    {
                        Assert.AreEqual(0.0f, state.GetSlider(slider2));
                    }
                }

                ++sliderIndex;
            }
        }