Exemple #1
0
		public void UT_hasChanges() {
			string _testid = DateTime.Now.Ticks.ToString();
			bool _constraint;
			long _iduser;

			DO_User _user = new DO_User();
			_user.Connection.Open();
			_user.Connection.Transaction.Begin();

			Assert.IsFalse(_user.Fields.hasChanges, "unexpected changes, object just instantiated and no changes have been made");
			_user.Fields.Login = _testid;
			_user.Fields.Password = _testid;
			Assert.IsTrue(_user.Fields.hasChanges, "expected changes, changes have been made over object");
			_iduser = _user.insObject(true, out _constraint);
			Assert.IsFalse(_user.Fields.hasChanges, "unexpected changes, object state commited (insert) over data base");
			_user.Fields.Login = _testid;
			_user.Fields.Password = _testid;
			Assert.IsFalse(_user.Fields.hasChanges, "unexpected changes, no real changes have been made");
			_user.Fields.Password = string.Empty;
			Assert.IsTrue(_user.Fields.hasChanges, "expected changes, real changes have been made");
			_user.updObject(false, out _constraint);
			Assert.IsFalse(_user.Fields.hasChanges, "unexpected changes, object state commited (update) over data base");
			_user.clrObject();
			Assert.IsTrue(_user.Fields.hasChanges, "expected changes, object state cleared");
			_user.getObject_byLogin(_testid);
			Assert.IsFalse(_user.Fields.hasChanges, "unexpected changes, object state sinchronized (select) with data base");
			_user.delObject();
			Assert.IsTrue(_user.Fields.hasChanges, "expected changes, object erased (delete on data base)");
			
			_user.Connection.Transaction.Rollback();
			_user.Connection.Transaction.Terminate();
			_user.Connection.Close();
			_user.Dispose(); _user = null;
		}