Пример #1
0
        public void cannot_parse_invalid_input(string input)
        {
            var result = ExerciseParser
                         .GetParser(
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))(new Input(input));

            Assert.False(result.WasSuccessful && result.Remainder.AtEnd);
        }
Пример #2
0
        public void can_parse_name(string input, string expectedName)
        {
            var result = ExerciseParser
                         .GetParser(
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))
                         .Parse(input);

            Assert.NotNull(result);
            Assert.Equal(expectedName, result.Name);
        }
Пример #3
0
        public void can_parse_matchers_with_actions(string input, Type[] expectedMatcherTypes)
        {
            var result = ExerciseParser
                         .GetParser(
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))
                         .Parse(input);

            Assert.NotNull(result);
            Assert.True(result.MatchersWithActions.Select(x => x.Matcher.GetType()).SequenceEqual(expectedMatcherTypes));
        }
Пример #4
0
        public void can_parse_set_and_repetition_counts(string input, int expectedSetCount, int expectedRepetitionCount)
        {
            var result = ExerciseParser
                         .GetParser(
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))
                         .Parse(input);

            Assert.NotNull(result);
            Assert.Equal(expectedSetCount, result.SetCount);
            Assert.Equal(expectedRepetitionCount, result.RepetitionCount);
        }
 public void get_parser_throws_if_speech_service_is_null()
 {
     Assert.Throws <ArgumentNullException>(() => ExerciseParser.GetParser(new AudioServiceMock(), new DelayServiceMock(), new LoggerServiceMock(), null));
 }