Exemplo n.º 1
0
       // [Test]
        public void HistoryLogUpdate()
        {
            DbDataContext db = new DbDataContext();
            db.HistoryLogs.DeleteAllOnSubmit(db.HistoryLogs);

            const string roleName = "TestRole";
            const string roleNameUpdated = "NewRoleName";

            Role role = new Role();
            role.Name = roleName;
            db.Roles.InsertOnSubmit(role);
            db.SubmitChanges();

            db.Dispose();
            db = new DbDataContext();
            role = db.Roles.Where(r => r.ID == role.ID).First();
            role.Name = roleNameUpdated;
            db.SubmitChanges();

            List<HistoryLog> logs = db.HistoryLogs.Where(h => h.KeyValue == role.ID && h.TypeOfUpdate == "Update").ToList();
            HistoryLog hlName = logs.Where(h => h.FieldName == "Name").FirstOrDefault();
            Assert.IsNotNull(hlName, "No new record in history table with FieldName = 'Name' was found.");
            Assert.AreEqual(hlName.TableName, "Role");
            Assert.AreEqual(hlName.FieldName, "Name");
            Assert.AreEqual(hlName.NewValue, roleNameUpdated);
            Assert.AreEqual(hlName.TypeOfUpdate, "Update");
            Assert.AreEqual(hlName.OldValue, roleName);
            Assert.IsNotNull(hlName.ModifiedDate);

            //db.HistoryLogs.DeleteAllOnSubmit(db.HistoryLogs);
            //db.Roles.DeleteOnSubmit(role);
            //db.SubmitChanges();
        }
Exemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         dbDataContext.Dispose();
     }
     base.Dispose(disposing);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public virtual void Dispose(bool disposing)

        {
            if (disposing)
            {
                Table = null;
                DbDataContext.Dispose();
                DbDataContext = null;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     Table = null;
     DbDataContext.Dispose();
     DbDataContext = null;
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     _context.Dispose();
 }
Exemplo n.º 6
0
 public void TearDown()
 {
     db.Transaction.Rollback();
     db.Connection.Close();
     db.Dispose();
 }
 public void Dispose()
 {
     _dbContext.Dispose();
 }