Exemplo n.º 1
0
        public void KeyReleasedTest()
        {
            ValueSpy <bool> spy = new ValueSpy <bool>(Key.Released(KeyCode.Space));

            spy.SimulateInput(i => i.GetKeyUp(KeyCode.Space).Returns(true));
            spy.AssertWasUpdatedTo(true);

            spy.SimulateInput(i => i.GetKeyUp(KeyCode.Space).Returns(false));
            spy.AssertWasUpdatedTo(false);
        }
Exemplo n.º 2
0
        public void KeyHeldTest()
        {
            ValueSpy <bool> spy = new ValueSpy <bool>(Key.Held(KeyCode.Space));

            spy.SimulateInput(i => i.GetKey(KeyCode.Space).Returns(true));
            spy.AssertWasUpdatedTo(true);

            spy.WaitFrame();
            spy.AssertNothingHappened();

            spy.SimulateInput(i => i.GetKey(KeyCode.Space).Returns(false));
            spy.AssertWasUpdatedTo(false);
        }
Exemplo n.º 3
0
        public void RawAxisTest()
        {
            ValueSpy <float> spy = new ValueSpy <float>(ValueOf.RawAxis("Horizontal"));

            spy.SimulateInput(i => i.GetAxisRaw("Horizontal").Returns(2.0f));
            spy.AssertWasUpdatedTo(2.0f);

            spy.WaitFrame();
            spy.AssertNothingHappened();
        }