public void cannot_parse_invalid_input(string input)
        {
            var result = ExerciseProgramsParser
                         .GetParser(
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))(new Input(input));

            Assert.False(result.WasSuccessful && result.Remainder.AtEnd);
        }
        public void can_parse_exercise_programs(string input, int expectedExerciseProgramCount)
        {
            var result = ExerciseProgramsParser
                         .GetParser(
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))
                         .Parse(input);

            Assert.NotNull(result);
            Assert.Equal(expectedExerciseProgramCount, result.Programs.Count);
        }
Exemplo n.º 3
0
        public static IResult <ExercisePrograms> TryParse(
            string input,
            IAudioService audioService,
            IDelayService delayService,
            ISpeechService speechService)
        {
            Ensure.ArgumentNotNull(input, nameof(input));
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return(ExerciseProgramsParser.GetParser(audioService, delayService, speechService).TryParse(input));
        }
        public static IResult<ExercisePrograms> TryParse(
            string input,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            input.AssertNotNull(nameof(input));
            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return ExerciseProgramsParser.GetParser(audioService, delayService, loggerService, speechService).TryParse(input);
        }
Exemplo n.º 5
0
 public void get_parser_throws_if_speech_service_is_null()
 {
     Assert.Throws <ArgumentNullException>(() => ExerciseProgramsParser.GetParser(new AudioServiceMock(), new DelayServiceMock(), new LoggerServiceMock(), null));
 }