public void GetsTest() { IData target = CreateIData(); LogInfo obj = new LogInfo(1, DateTime.Now, "Debug", "错误!", "错误!"); int id; try { target.BeginTransaction(); id = (int)target.Save(obj); target.Commit(); } catch { target.Rollback(); } finally { target.Dispose(); } target = CreateIData(); IList<LogInfo> list = target.Gets<LogInfo>(); Assert.IsTrue(list.Count > 0); }
public void DeleteTest() { IData target = CreateIData(); LogInfo obj = new LogInfo(1, DateTime.Now, "Debug", "错误!", "错误!"); int actual; try { target.BeginTransaction(); actual = (int)target.Save(obj); LogInfo obj2 = new LogInfo(actual, DateTime.Now, "Debug", "错误UpdateTest!", "错误UpdateTest!"); target.Clear(); target.Delete(obj2); target.Commit(); } catch { target.Rollback(); } finally { target.Dispose(); } }
public void SaveTest() { IData target = CreateIData(); LogInfo obj = new LogInfo(1,DateTime.Now,"Debug","错误!","错误!"); int actual = 0; try { target.BeginTransaction(); actual = (int)target.Save(obj); target.Commit(); } catch { target.Rollback(); } finally { target.Dispose(); } Assert.IsTrue(actual>0); }
public void GetTest() { IData target = CreateIData(); LogInfo obj = new LogInfo(1, DateTime.Now, "Debug", "错误!", "错误!"); int id = -1; try { target.BeginTransaction(); id = (int)target.Save(obj); target.Commit(); } catch { target.Rollback(); } finally { target.Dispose(); } target = CreateIData(); LogInfo obj2 = target.Get<LogInfo>(id); Assert.AreEqual(obj2.LogId, id); }