public async Task Abort_DoesNotThrow_WhenCalledMultipleTimes() { var apiBuilder = new ApiBuilder(Substitute.For <ISimulation>()); var apiSimulator = new ApiSimulator(apiBuilder); await apiSimulator.StartAsync(); try { await Task.Delay(150); apiSimulator.Abort(); apiSimulator.Abort(); } finally { await apiSimulator.StopAsync(); } }
public async Task Abort_SetsStateToStopped() { var apiBuilder = new ApiBuilder(Substitute.For <ISimulation>()); var apiSimulator = new ApiSimulator(apiBuilder); await apiSimulator.StartAsync(); try { apiSimulator.Abort(); apiSimulator.State.ShouldBe(SimulatorState.Stopped); } finally { await apiSimulator.StopAsync(); } }