示例#1
0
        public void Parse_Two_Chain_With_ScopedVariable()
        {
            // arrange
            var pathString = "foo(bar: $fields:foo).baz(quox: 1)";

            // act
            IImmutableStack <SelectionPathComponent> path =
                SelectionPathParser.Parse(pathString);

            // assert
            Assert.Collection(path.Reverse(),
                              segment =>
            {
                Assert.Equal("foo", segment.Name.Value);
                Assert.Collection(segment.Arguments,
                                  argument =>
                {
                    Assert.Equal("bar", argument.Name.Value);

                    ScopedVariableNode variable =
                        Assert.IsType <ScopedVariableNode>(argument.Value);

                    Assert.Equal("fields", variable.Scope.Value);
                    Assert.Equal("foo", variable.Name.Value);
                });
            },
                              segment =>
            {
                Assert.Equal("baz", segment.Name.Value);
                Assert.Collection(segment.Arguments,
                                  argument =>
                {
                    Assert.Equal("quox", argument.Name.Value);
                    Assert.Equal("1", argument.Value.Value);
                });
            });
        }
示例#2
0
 string PassAsString(IImmutableStack <int> password)
 {
     return(string.Join("", password.Reverse().Select(i => (char)(i + (int)'a'))));
 }