Пример #1
0
        public void pressing_up(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.UP_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Up, sut.Direction);
        }
Пример #2
0
        public void pressing_right(IFixture fixture, TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.RIGHT_BUTTON.Center.ToVector2().Yield());
            var aa = new TouchControlInputs(fixture.Create <TouchInputs>());

            sut.Update();

            Assert.Equal(DpadDirection.Right, sut.Direction);
        }
Пример #3
0
        public void pressing_right_from_down_right(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns((sut.Dpad.RIGHT_BUTTON.Center.ToVector2() + new Microsoft.Xna.Framework.Vector2(0, TouchControllerRenderer.BUTTON_HEIGHT)).Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Right, sut.Direction);
        }
Пример #4
0
        public void pressing_dowm_from_up_left(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns((sut.Dpad.LEFT_BUTTON.Center.ToVector2() + new Microsoft.Xna.Framework.Vector2(0, -TouchControllerRenderer.BUTTON_HEIGHT)).Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Down, sut.Direction);
        }
Пример #5
0
        public void pressing_center_from_right(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.CENTER_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Left, sut.Direction);
        }
Пример #6
0
        public void pressing_left_from_down(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.LEFT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Left, sut.Direction);
        }
Пример #7
0
        public void pressing_dowm_downRight_downRight(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();
            sut.Update();

            Assert.Equal(DpadDirection.Right, sut.Direction);
        }