public void CreateContinuation_equal() { var query1 = g .UseModel(GraphModel.FromBaseTypes <IVertex, IEdge>()) .UseExecutionPipeline(GremlinQueryExecutionPipeline.EchoGroovyString) .V() .OfType <Person>(); var query2 = query1; var cont = ((IGremlinQuery)query1).CreateContinuationFrom(query2); cont(GremlinQuery .Anonymous(query1.AsAdmin().Environment)) .Should() .SerializeToGroovy("__.identity()"); }
public void CreateContinuation_equal() { var query1 = g .ConfigureEnvironment(env => env .UseModel(GraphModel.FromBaseTypes <IVertex, IEdge>(lookup => lookup .IncludeAssembliesOfBaseTypes())) .UseExecutionPipeline(GremlinQueryExecutionPipeline.EchoGroovy)) .V() .OfType <Person>(); var query2 = query1; var cont = ((IGremlinQueryBase)query1).CreateContinuationFrom(query2); cont(GremlinQuery .Anonymous(query1.AsAdmin().Environment)) .Should() .SerializeToGroovy("identity()"); }
public void CreateContinuation() { var query1 = g .UseModel(GraphModel.FromBaseTypes <IVertex, IEdge>()) .UseExecutionPipeline(b => b .EchoGremlinQueryAsString()) .V() .OfType <Person>(); var query2 = query1 .Where(x => x.Age == 36); var cont = ((IGremlinQuery)query1).CreateContinuationFrom(query2); cont(GremlinQuery .Anonymous(query1.AsAdmin().Environment)) .Should() .SerializeToGroovy("__.has(_a, _b)"); }
public void ChangeQueryType() { var anon = GremlinQuery.Anonymous() .AsAdmin(); var interfaces = typeof(GremlinQuery) .Assembly .GetTypes() .Where(iface => iface.IsInterface) .Where(iface => typeof(IGremlinQuery).IsAssignableFrom(iface)) .Select(iface => iface.IsGenericTypeDefinition ? iface.MakeGenericType(iface.GetGenericArguments().Select(_ => typeof(object)).ToArray()) : iface) .ToArray(); foreach (var iface in interfaces) { typeof(IGremlinQueryAdmin).GetMethod(nameof(IGremlinQueryAdmin.ChangeQueryType)).MakeGenericMethod(iface).Invoke(anon, Array.Empty <object>()); } }