public void TestWithContentSelect() { StaticRecorder.CurRow.Add(new RowInfo("Id", 1L)); StaticRecorder.CurRow.Add(new RowInfo("Name", "tom")); var c = WithContent.FindById(1); Assert.AreEqual("tom", c.Name); StaticRecorder.CurRow.Add(new RowInfo("Content", "test")); Assert.AreEqual("test", c.ItemContent.Value); AssertSql(@"SELECT [Content] FROM [With_Content] WHERE [Id] = @Id_0; <Text><60>(@Id_0=1:Int64)"); }
public void TestWithContent() { var c = new WithContent { Name = "tom", ItemContent = "test" }; c.Save(); AssertSql(@"INSERT INTO [With_Content] ([Name],[Content]) VALUES (@Name_0,@Content_1); SELECT LAST_INSERT_ROWID(); <Text><30>(@Name_0=tom:String,@Content_1=test:String)"); c.Name = "jerry"; c.Save(); AssertSql(string.Format(@"UPDATE [With_Content] SET [Name]=@Name_0 WHERE [Id] = @Id_1; <Text><30>(@Name_0=jerry:String,@Id_1={0}:Int64)", c.Id)); c.ItemContent = "update"; c.Save(); AssertSql(string.Format(@"UPDATE [With_Content] SET [Content]=@Content_0 WHERE [Id] = @Id_1; <Text><30>(@Content_0=update:String,@Id_1={0}:Int64)", c.Id)); }