Ejemplo n.º 1
0
        public void QueryFragment_Parameters_Empty_Success()
        {
            var fragment = new QueryFragment();

            Assert.IsNotNull(fragment.Parameters);
            Assert.AreEqual(0, fragment.Parameters.Count);
        }
        /// <summary>
        /// Executes the construction step the specified node to ensure it is "correct" in the context of the rule doing the valdiation.
        /// </summary>
        /// <param name="context">The validation context encapsulating a <see cref="SyntaxNode" /> that needs to be validated.</param>
        /// <returns><c>true</c> if the node is valid, <c>false</c> otherwise.</returns>
        public override bool Execute(DocumentConstructionContext context)
        {
            var fragmentNode  = (FragmentNode)context.ActiveNode;
            var queryFragment = new QueryFragment(fragmentNode);

            context.AddDocumentPart(queryFragment);
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Executes the construction step the specified node to ensure it is "correct" in the context of the rule doing the valdiation.
        /// </summary>
        /// <param name="context">The validation context encapsulating a <see cref="SyntaxNode" /> that needs to be validated.</param>
        /// <returns><c>true</c> if the node is valid, <c>false</c> otherwise.</returns>
        public override bool Execute(DocumentConstructionContext context)
        {
            var           node     = (FragmentSpreadNode)context.ActiveNode;
            QueryFragment fragment = context.DocumentContext.Fragments.FindFragment(node.PointsToFragmentName.ToString());

            context.AddDocumentPart(fragment);

            fragment.MarkAsReferenced();

            context.AppendNodes(fragment.Node.Children);
            context.BeginNewDocumentScope();
            context.DocumentScope.RestrictFieldsToGraphType(fragment.GraphType);
            return(true);
        }
Ejemplo n.º 4
0
 public TextFragments QueryHighlight(string search)
 {
     return(QueryFragment.HighlightPrimary(search));
 }