[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); }
public Translation Translation() { if (left.IsActive()) { return(new Translation(-1, 0)); } if (right.IsActive()) { return(new Translation(1, 0)); } if (up.IsActive()) { return(new Translation(0, 1)); } if (down.IsActive()) { return(new Translation(0, -1)); } return(new Translation(0, 0)); }
[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); }