Exemplo n.º 1
0
        public void TestUpate2()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;

            db.Update("sore="+db.GetParameterName("sore"), "where sore>=100", "students", null,new KeyValuePair<string, object>(db.GetParameterName("sore"),50));
        }
Exemplo n.º 2
0
 public void TestInsert()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     Student student=new Student();
     student.ID = 4;
     student.StudentName = "Student4";
     student.ClassName = "Class4";
     student.Score = 30;
     student.InTime=DateTime.Now;
     Student stu2=new Student();
     stu2.ID = 4; 
     stu2.StudentName = "stu5";
     stu2.ClassName = "Class5";
     stu2.Score = 40;
     stu2.InTime = DateTime.Now;
     Assert.AreEqual(db.ExceuteTrans(trans =>
     {
         db.Insert(student, trans);
         db.Insert(stu2, trans);
         
         return true;
     }),true);
     //Assert.AreEqual(db.Insert(student),true);
 }
 public void TestDelete2()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     Assert.AreEqual(db.Delete("where sore<" + db.GetParameterName("sore"), "students", null,
                               new KeyValuePair <string, object>(db.GetParameterName("sore"), 50)), true);
 }
Exemplo n.º 4
0
        public void TestIsExist()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;
            Assert.AreEqual(db.IsExist(new Student() { ID = 1 }), true);

        }
        public void TestUpate2()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;

            db.Update("sore=" + db.GetParameterName("sore"), "where sore>=100", "students", null, new KeyValuePair <string, object>(db.GetParameterName("sore"), 50));
        }
        public void TestInsert()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;
            Student student = new Student();

            student.ID          = 4;
            student.StudentName = "Student4";
            student.ClassName   = "Class4";
            student.Score       = 30;
            student.InTime      = DateTime.Now;
            Student stu2 = new Student();

            stu2.ID          = 4;
            stu2.StudentName = "stu5";
            stu2.ClassName   = "Class5";
            stu2.Score       = 40;
            stu2.InTime      = DateTime.Now;
            Assert.AreEqual(db.ExceuteTrans(trans =>
            {
                db.Insert(student, trans);
                db.Insert(stu2, trans);

                return(true);
            }), true);
            //Assert.AreEqual(db.Insert(student),true);
        }
Exemplo n.º 7
0
 public void TestQueryModels()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     var models = db.QueryModels<Student>("select * from td_student");
     Assert.AreEqual(models.Count>0 ,true);
 }
Exemplo n.º 8
0
 public void TestDelete2()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     Assert.AreEqual(db.Delete("where sore<" + db.GetParameterName("sore"), "students", null,
         new KeyValuePair<string, object>(db.GetParameterName("sore"), 50)),true);
 }
        public void TestQueryModels()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;
            var models = db.QueryModels <Student>("select * from td_student");

            Assert.AreEqual(models.Count > 0, true);
        }
Exemplo n.º 10
0
 public void TestDelete()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     Student student=new Student();
     student.ID = 6;
     Assert.AreEqual(db.Delete(student),true);
 }
        public void TestDelete()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;
            Student student = new Student();

            student.ID = 6;
            Assert.AreEqual(db.Delete(student), true);
        }
 public void TestIsExist()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     Assert.AreEqual(db.IsExist(new Student()
     {
         ID = 1
     }), true);
 }
Exemplo n.º 13
0
 public void TestUpdate()
 {
     DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
     db.DbConnectStr = ConnStr;
     Student student = db.QueryModel<Student>("select * from td_student where id=" + db.GetParameterName("id"),
         new KeyValuePair<string, object>(db.GetParameterName("id"), 6));
     student.ID =6;
     student.StudentName = "Studentfsafasfasf";
     student.ClassName = "Class4sfasdfas";
     student.InTime=DateTime.Now;
     student.Score = 30;
     db.Update(student);
 }
        public void TestUpdate()
        {
            DbObjects.SQLServer.DbObject db = new DbObjects.SQLServer.DbObject();
            db.DbConnectStr = ConnStr;
            Student student = db.QueryModel <Student>("select * from td_student where id=" + db.GetParameterName("id"),
                                                      new KeyValuePair <string, object>(db.GetParameterName("id"), 6));

            student.ID          = 6;
            student.StudentName = "Studentfsafasfasf";
            student.ClassName   = "Class4sfasdfas";
            student.InTime      = DateTime.Now;
            student.Score       = 30;
            db.Update(student);
        }