예제 #1
0
        public void cannot_parse_invalid_input(string input, int indentLevel)
        {
            var result = ActionListParser
                         .GetParser(
                indentLevel,
                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_valid_input(string input, int indentLevel, Type[] expectedActionTypes)
        {
            var result = ActionListParser
                         .GetParser(
                indentLevel,
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))(new Input(input));

            Assert.True(result.WasSuccessful);
            Assert.True(result.Remainder.AtEnd);
            Assert.NotNull(result.Value);
            Assert.True(result.Value.Select(x => x.GetType()).SequenceEqual(expectedActionTypes));
        }
 public void get_parser_throws_if_speech_service_is_null()
 {
     Assert.Throws <ArgumentNullException>(() => ActionListParser.GetParser(0, new AudioServiceMock(), new DelayServiceMock(), new LoggerServiceMock(), null));
 }
 public void get_parser_throws_if_indent_level_is_less_than_zero()
 {
     Assert.Throws <ArgumentException>(() => ActionListParser.GetParser(-1, new AudioServiceMock(), new DelayServiceMock(), new LoggerServiceMock(), new SpeechServiceMock()));
 }