public void MotorController_Stop_CallsMotorActorSetSpeedOnceOnEachSideWithZero() { // Arrange var motorActors = new Mock <IDirectional <IMotorActor> >(); var motorActorLeft = new Mock <IMotorActor>(); var motorActorRight = new Mock <IMotorActor>(); motorActors.SetupGet(_ => _.Right).Returns(motorActorRight.Object); motorActors.SetupGet(_ => _.Left).Returns(motorActorLeft.Object); var motorSpeedConverter = new MotorSpeedConverter(); var testee = new MotorController(motorActors.Object, motorSpeedConverter); // Act testee.Stop(); // Assert motorActors.Verify(p => p.Right.SetSpeed(0), Times.Once()); motorActors.Verify(p => p.Left.SetSpeed(0), Times.Once()); }
public static async Task StopAll() { var stopTask = Task.Run(async() => { ShutdownMotorsServos(); _httpServerController.Stop(); await _camera.Stop(); await _gamepadController.Stop(); await _speechRecognation.Stop(); await _automaticDrive.Stop(); _servoController.Stop(); _motorController.Stop(); await _automaticSpeakController.Stop(); await _accelerometerSensor.Stop(); AudioPlayerController.Stop(); SpeedSensor.Stop(); ShutdownMotorsServos(); }); var timeout = TimeSpan.FromSeconds(5); await TaskHelper.WithTimeoutAfterStart(ct => stopTask.WithCancellation(ct), timeout); }