public void TestDontUpdateIfNotSetValue() { var u = new sUser(1, "Tom", 18); DbEntry.Save(u); Assert.AreEqual(0, StaticRecorder.Messages.Count); Assert.AreEqual("", StaticRecorder.LastMessage); }
public void TestPartialUpdateThatSetValue() { var u = new sUser("Tom", 18) { Id = 1, Name = "Tom" }; DbEntry.Save(u); Assert.AreEqual(1, StaticRecorder.Messages.Count); Assert.AreEqual("UPDATE [s_User] SET [Name]=@Name_0 WHERE [Id] = @Id_1;\n<Text><30>(@Name_0=Tom:String,@Id_1=1:Int64)", StaticRecorder.LastMessage); }
public void TestPartialUpdateThatSetedValueByTransactionWithException() { Util.CatchAll(() => DbEntry.NewTransaction(delegate { var u = new sUser(1, "Tom", 18) { Name = "Tom" }; DbEntry.Save(u); throw new Exception(); // emulate exception })); Assert.AreEqual(0, StaticRecorder.Messages.Count); Assert.AreEqual("", StaticRecorder.LastMessage); }