Esempio n. 1
0
        public void Parse_Single_Chain_With_ScopedVariable()
        {
            // arrange
            var pathString = "foo(bar: $fields:foo)";

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

            // assert
            Assert.Collection(path,
                              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);
                });
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Determines whether the specified <see cref="ScopedVariableNode"/>
        /// is equal to the current <see cref="ScopedVariableNode"/>.
        /// </summary>
        /// <param name="other">
        /// The <see cref="ScopedVariableNode"/> to compare with the current
        /// <see cref="ScopedVariableNode"/>.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="ScopedVariableNode"/>
        /// is equal to the current <see cref="ScopedVariableNode"/>;
        /// otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(ScopedVariableNode other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(other, this))
            {
                return(true);
            }

            return(other.Value.Equals(Value, StringComparison.Ordinal));
        }