public void Parse_ShouldParseHandle_WhenSelectorsAreDefined(String command)
        {
            // Given
            var underTest = new CodeQueryCompiler();

            // When
            var result = underTest.Parse(command);

            // Then
            Assert.That(result, Is.Not.Null);
        }
        public void Parse_ShouldParseCommand_WhenSimpleCommandCallIsPassed()
        {
            // Given
            var underTest = new CodeQueryCompiler();

            // When
            var result = underTest.Parse("@test-command");

            // Then
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.TypeOf<CommandCallControlFlowElement>());
        }
        public void Parse_ShouldReturnSequenceControlFlow_WhenMultipleCommandsArePassed()
        {
            // Given
            var underTest = new CodeQueryCompiler();

            // When
            var result = underTest.Parse("@test-command; @test-command-2") as SequenceControlFlowElement;

            // Then
            Assert.That(result, Is.Not.Null);
            var expectedChildren = result.Children
                                         .Cast<CommandCallControlFlowElement>()
                                         .Select(call => call.CommandCallElement.MethodName);

            Assert.That(expectedChildren, Is.EquivalentTo(new[] { "test-command", "test-command-2" }));
        }
        public void Parse_ShouldParseCommand_WhenSimpleCommandCallWithOneStringParameterIsPassed()
        {
            // Given
            var underTest = new CodeQueryCompiler();

            // When
            var result = underTest.Parse("@test-command \"hello world!\"") as CommandCallControlFlowElement;

            // Then
            Assert.That(result, Is.Not.Null);

            var actualParameters = result.CommandCallElement.ActualParameters.ToArray();
            Assert.That(actualParameters.Length, Is.EqualTo(1));
            Assert.That(actualParameters.Select(parameter => new {
                Position = parameter.Position,
                Value = parameter.Value.Value as String
            }), Is.EquivalentTo(new[] { new { Position = Option.Some(0), Value = "hello world!" } }));
        }