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); }
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); }
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(); }