public void TrySetState_ReturnsTrue_WhenStateCannotTransition(SimulatorState from, SimulatorState to) { TestSimulator simulator = Substitute.ForPartsOf <TestSimulator>(); while (simulator.State != from) { simulator.SetState(simulator.State + 1); } var result = simulator.TrySetState(to); result.ShouldBeTrue(); }
public void TrySetState_ReturnsTrue_WhenStateDoesNotChange(SimulatorState state) { TestSimulator simulator = Substitute.ForPartsOf <TestSimulator>(); while (simulator.State != state) { simulator.SetState(simulator.State + 1); } var result = simulator.TrySetState(state); result.ShouldBeTrue(); }