public AxisMovement(Axis axis) { left = new ControlledBool(() => axis.Horizontal() < 0); right = new ControlledBool(() => axis.Horizontal() > 0); up = new ControlledBool(() => axis.Vertical() > 0); down = new ControlledBool(() => axis.Vertical() < 0); }
[Test] public void ShouldReturnFalseAfterTrueInputHasAlreadyBeenChecked() { ControlledBool b = new ControlledBool(() => true); Assert.That(b.IsActive(), Is.True); Assert.That(b.IsActive(), Is.False); }
[Test] public void ShouldReturnTrueAfterInputHasBeenResetToFalseForAtLeastOneCheck() { bool input = true; ControlledBool b = new ControlledBool(() => input); Assert.That(b.IsActive(), Is.True); input = false; Assert.That(b.IsActive(), Is.False); input = true; Assert.That(b.IsActive(), Is.True); }
[Test] public void ShouldReturnFalseWhenInputIsFalse() { ControlledBool b = new ControlledBool(() => false); Assert.That(b.IsActive(), Is.False); }
[Test] public void ShouldReturnTrueWhenInputIsTrue() { ControlledBool b = new ControlledBool(() => true); Assert.That(b.IsActive(), Is.True); }