예제 #1
0
        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);
        }
예제 #2
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();
            }
        }
예제 #3
0
        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);
        }
예제 #4
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);
        }