Update Unit Test

This commit is contained in:
sunkaixuan
2017-07-25 01:13:31 +08:00
parent e7a061b052
commit 084ecc9b02
3 changed files with 42 additions and 6 deletions

View File

@@ -124,6 +124,23 @@ new List<SugarParameter>() {
(@Name) ;SELECT SCOPE_IDENTITY();", new List<SugarParameter>() {
new SugarParameter("@Name","张三")
}, t11.Key, t11.Value, "Insert t11 error");
var t12 = db.Insertable<Student>(new { Name = "a" }).ToSql();
base.Check(@"INSERT INTO [STudent]
([Name])
VALUES
(@Name) ;SELECT SCOPE_IDENTITY();", new List<SugarParameter>() {
new SugarParameter("@Name","a")
}, t12.Key, t12.Value, "Insert t12 error");
var t13 = db.Insertable<Student>(new Dictionary<string, object>() { {"id",0 },{ "name","2"} }).ToSql();
base.Check(@"INSERT INTO [STudent]
([Name])
VALUES
(@Name) ;SELECT SCOPE_IDENTITY();", new List<SugarParameter>() {
new SugarParameter("@Name","2")
}, t13.Key, t13.Value, "Insert t13 error");
}
}

View File

@@ -144,6 +144,21 @@ namespace OrmTest.UnitTest
"Update 12 error"
);
var t13 = db.Updateable<Student>(new { Name = "a", id=1 }).ToSql();
base.Check(@"UPDATE [STudent] SET
[Name]=@Name WHERE [Id]=@Id", new List<SugarParameter>() {
new SugarParameter("@Name","a"),
new SugarParameter("@ID",1)
}, t13.Key, t13.Value, "Insert t13 error");
var t14 = db.Updateable<Student>(new Dictionary<string, object>() { { "id", 0 }, { "name", "2" } }).ToSql();
base.Check(@"UPDATE [STudent] SET
[Name]=@Name WHERE [Id]=@Id", new List<SugarParameter>() {
new SugarParameter("@Name", "2"),
new SugarParameter("@ID", 0)
}, t14.Key, t14.Value, "Insert t14 error");
}
}