Exemple #1
0
  [TestMethod] public void get_email() {
    var db = new session();
    var emails = db.all<string>("select email from users");
    assert(emails.Count > 1);

    var email = db.one<string>("select email from users where id = 2");
    assert(email.Contains("@"));
  }
Exemple #2
0
  [TestMethod] public void cache() {
    var db = new session();
    var count = db
      .cache("count")
      .one<int>("select count(email) from users");
    
    db.execute("insert into users (email, password) values ('*****@*****.**', 'blood')");

    var new_count = db
      .cache("count")
      .one<int>("select count(email) from users");

    assert(count == new_count);

    var diff = db.one<int>("select count(email) from users");

    assert(diff > count);
  }