public void execute_passes_the_speech_text_onto_the_speech_service(string speechText)
        {
            var speechService = new SpeechServiceMock(MockBehavior.Loose);
            var sut = new SayActionBuilder()
                .WithSpeechService(speechService)
                .WithSpeechText(speechText)
                .Build();

            sut.Execute(new ExecutionContext()).Subscribe();

            speechService
                .Verify(x => x.Speak(speechText))
                .WasCalledExactlyOnce();
        }
        public void execute_pauses_if_context_is_paused()
        {
            var speechService = new SpeechServiceMock(MockBehavior.Loose);
            var sut = new SayActionBuilder()
                .WithSpeechService(speechService)
                .Build();

            using (var context = new ExecutionContext())
            {
                context.IsPaused = true;

                sut.Execute(context).Subscribe();

                speechService
                    .Verify(x => x.Speak(It.IsAny<string>()))
                    .WasNotCalled();
            }
        }
        public void execute_async_says_exercise_name_first()
        {
            var speechService = new SpeechServiceMock(MockBehavior.Loose);
            var sut = new ExerciseBuilder()
                .WithName("some name")
                .WithSpeechService(speechService)
                .Build();

            sut.ExecuteAsync(new ExecutionContext());

            speechService
                .Verify(x => x.SpeakAsync("some name", It.IsAny<CancellationToken>()))
                .WasCalledExactlyOnce();
        }
        public void execute_async_passes_the_speech_text_onto_the_speech_service(string speechText)
        {
            var speechService = new SpeechServiceMock(MockBehavior.Loose);
            var sut = new SayActionBuilder()
                .WithSpeechService(speechService)
                .WithSpeechText(speechText)
                .Build();

            sut.ExecuteAsync(new ExecutionContext());

            speechService
                .Verify(x => x.SpeakAsync(speechText, It.IsAny<CancellationToken>()))
                .WasCalledExactlyOnce();
        }
        public void execute_says_exercise_name_first()
        {
            var speechService = new SpeechServiceMock(MockBehavior.Loose);
            var sut = new ExerciseBuilder()
                .WithName("some name")
                .WithSpeechService(speechService)
                .Build();

            sut.Execute(new ExecutionContext()).Subscribe();

            speechService
                .Verify(x => x.Speak("some name"))
                .WasCalledExactlyOnce();
        }
        public void execute_async_uses_the_specified_prompt_speech_text(string promptSpeechText)
        {
            var speechService = new SpeechServiceMock(MockBehavior.Loose);

            var sut = new WaitWithPromptActionBuilder()
                .WithSpeechService(speechService)
                .WithDuration(TimeSpan.FromSeconds(1))
                .WithPromptSpeechText(promptSpeechText)
                .Build();

            sut.ExecuteAsync(new ExecutionContext());

            speechService
                .Verify(x => x.SpeakAsync(promptSpeechText, It.IsAny<CancellationToken>()))
                .WasCalledExactlyOnce();
        }