Exemple #1
0
 public void initialize() {
    session = new session();
    user = new user();
    user.email = "*****@*****.**";
    user.password = "******";
    user.age = 33;
 }
Exemple #2
0
 [TestMethod] public void domain_member_and_column_name_differ_but_are_mapped() {
    var age = user.age;
    session.insert(user);
    user = session
       .param("@email", user.email)
       .one<user>("where email = @email");
    assert(user.age == age);
 }
Exemple #3
0
 [TestMethod] public void dispose_connection() {
    using (session.open_connection()) {
       session.insert(user);
       user = session
          .param("@email", user.email)
          .one<user>("where email=@email");
    }
    assert(user.email != null);
 }
Exemple #4
0
 [TestMethod] public void share_connection() {
    var email = user.email;
    var session = new session().open_connection();
       session.insert(user);
       user = session
          .param("@email", email)
          .one<user>("where email=@email");
    session.close_connection();
    assert(user.email == email);
 }
Exemple #5
0
   [TestMethod] public void insert_update_select_delete() {
      var user = new user();
      user.email = "*****@*****.**";
      user.password = "******";

      user.id = db.insert(user);
      assert(user.id > 0);

      user.password = "******";
      var rows_affected = db.update(user);
      assert(rows_affected == 1);

      user = db.one<user>(user.id);
      assert(user.password == "new");

      rows_affected = db.delete<user>(user.id);
      assert(rows_affected == 1);

      // throws exception since user does not exist
      //user = db.one<user>(user.id);
      //assert(user.id == 0);
   }
Exemple #6
0
 [TestMethod] public void prepare_database() {
    var user = new user() { email="*****@*****.**", password="******" };
    db.insert<user>(user);
 }
Exemple #7
0
   [TestMethod] public void rollback_uncommitted_transaction() {
      var id = session.insert(user);
      var email = user.email;

      var updated_email = "*****@*****.**";
      using (session.start_transaction())
         session
            .execute("update users set email = '{0}'"
            .plug(updated_email));
    
      user = session.one<user>(id);
      assert(user.email == email);
      assert(user.email != updated_email);
  }