Exemplo n.º 1
0
        public void BatchStatement_Should_Throw_When_Child_Statement_Has_Proxy_Auth_Set()
        {
            var batch          = new BatchStatement();
            var childStatement = new SimpleStatement("DELETE FROM tbl1 WHERE KEY = ?", Guid.NewGuid());

            childStatement.ExecutingAs("bob");
            Assert.Throws <ArgumentException>(() => batch.Add(childStatement));
        }
Exemplo n.º 2
0
 private void ConnectAndQuery(IAuthProvider authProvider, string executeAs = null, string query = "SELECT * FROM aliceks.alicetable")
 {
     using (var cluster = Cluster.Builder()
                          .AddContactPoint(_testCluster.InitialContactPoint)
                          .WithAuthProvider(authProvider)
                          .Build())
     {
         var session   = cluster.Connect();
         var statement = new SimpleStatement(query);
         if (executeAs != null)
         {
             statement.ExecutingAs(executeAs);
         }
         var rs = session.Execute(statement);
         Assert.NotNull(rs.FirstOrDefault());
     }
 }