コード例 #1
0
 public void TraversalBatch_Should_Use_GraphOptions()
 {
     TraversalUnitTest.WithMock((ISession session, ref IGraphStatement statement) =>
     {
         var g       = DseGraph.Traversal(session);
         var options = new GraphOptions().SetName("name1")
                       .SetReadConsistencyLevel(ConsistencyLevel.LocalQuorum)
                       .SetWriteConsistencyLevel(ConsistencyLevel.Quorum)
                       .SetReadTimeoutMillis(123499);
         var batch = DseGraph.Batch(options);
         batch
         .Add(g.AddV("person").Property("name", "Matias").Property("age", 12))
         .Add(g.AddV("person").Property("name", "Olivia").Property("age", 8));
         session.ExecuteGraph(batch);
         Assert.NotNull(statement);
         Assert.IsInstanceOf <FluentGraphStatement>(statement);
         var query = (IEnumerable <Bytecode>)((FluentGraphStatement)statement).QueryBytecode;
         Assert.AreEqual("bytecode-json", statement.GraphLanguage);
         TraversalUnitTest.CompareGraphOptionsOnStatement(options, statement);
         var traversals = query.ToList();
         Assert.AreEqual(2, traversals.Count);
         Assert.AreEqual(3, traversals.ElementAt(0).StepInstructions.Count);
         Assert.AreEqual(3, traversals.ElementAt(1).StepInstructions.Count);
     });
 }
コード例 #2
0
 public void Should_Set_The_Graph_Language()
 {
     TraversalUnitTest.WithMock((ISession session, ref IGraphStatement statement) =>
     {
         var g = DseGraph.Traversal(session);
         g.V().ToList();
         Assert.NotNull(statement);
         Assert.AreEqual("bytecode-json", statement.GraphLanguage);
     });
 }
コード例 #3
0
 public void Extension_Async_Method_Should_Build_Traversal_And_Execute()
 {
     TraversalUnitTest.WithMock((ISession session, ref IGraphStatement statement) =>
     {
         var g = DseGraph.Traversal(session);
         session.ExecuteGraphAsync(g.V());
         Assert.NotNull(statement);
         Assert.IsInstanceOf <FluentGraphStatement>(statement);
         var s = (FluentGraphStatement)statement;
         Assert.IsInstanceOf <Bytecode>(s.QueryBytecode);
     });
 }
コード例 #4
0
 public void Should_Use_The_Graph_Options()
 {
     TraversalUnitTest.WithMock((ISession session, ref IGraphStatement statement) =>
     {
         var options = new GraphOptions()
                       .SetName("my_graph")
                       .SetSource("my_source")
                       .SetReadTimeoutMillis(100)
                       .SetReadConsistencyLevel(ConsistencyLevel.EachQuorum)
                       .SetWriteConsistencyLevel(ConsistencyLevel.LocalQuorum);
         var g = DseGraph.Traversal(session, options);
         g.V().ToList();
         Assert.NotNull(statement);
         Assert.AreEqual("bytecode-json", statement.GraphLanguage);
         TraversalUnitTest.CompareGraphOptionsOnStatement(options, statement);
     });
 }