Exemplo n.º 1
0
        public void SelectParse()
        {
            var result = DslParser.SelectExprParse().Parse(@"select
alpha = #beta#
#gamma#@my own
theta = #eta.sigma.pi#
#x.y.z#
select end");

            result.Should().NotBeNull();

            var dslFormatBlock = result as DslFormatBlock;

            result.Should().NotBeNull();

            dslFormatBlock.Selects.Should().NotBeNullOrEmpty();
            dslFormatBlock.Selects.Should().HaveCount(4);

            var first = dslFormatBlock.Selects.First();

            first.Name.Should().Be("alpha");
            first.Value.Should().Be("#beta#");

            var second = dslFormatBlock.Selects.Skip(1).First();

            second.Name.Should().BeNull();
            second.Value.Should().Be("#gamma#");
            second.DisplayName.Should().Be("my own");

            var third = dslFormatBlock.Selects.Skip(2).First();

            third.Name.Should().Be("theta");
            third.Value.Should().Be("#eta.sigma.pi#");

            var fourth = dslFormatBlock.Selects.Skip(3).First();

            fourth.Name.Should().BeNull();
            fourth.Value.Should().Be("#x.y.z#");
        }