Exemplo n.º 1
0
        public void cannot_parse_invalid_input(string input, int indentLevel)
        {
            var result = DoNotAwaitActionParser
                         .GetParser(
                indentLevel,
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))(new Input(input));

            Assert.False(result.WasSuccessful && result.Remainder.AtEnd);
        }
Exemplo n.º 2
0
        public void can_parse_valid_input(string input, int indentLevel, Type[] expectedActionTypes)
        {
            var result = DoNotAwaitActionParser
                         .GetParser(
                indentLevel,
                new AudioServiceMock(MockBehavior.Loose),
                new DelayServiceMock(MockBehavior.Loose),
                new SpeechServiceMock(MockBehavior.Loose))
                         .Parse(input);

            Assert.NotNull(result);
            var sequence = result.InnerAction as SequenceAction;

            Assert.NotNull(sequence);
            Assert.True(sequence.Children.Select(x => x.GetType()).SequenceEqual(expectedActionTypes));
        }
 public void get_parser_throws_if_speech_service_is_null()
 {
     Assert.Throws <ArgumentNullException>(() => DoNotAwaitActionParser.GetParser(0, new AudioServiceMock(), new DelayServiceMock(), new LoggerServiceMock(), null));
 }
 public void get_parser_throws_if_indent_level_is_less_than_zero()
 {
     Assert.Throws <ArgumentException>(() => DoNotAwaitActionParser.GetParser(-1, new AudioServiceMock(), new DelayServiceMock(), new LoggerServiceMock(), new SpeechServiceMock()));
 }