Exemplo n.º 1
0
		public void UT_InsGetDelSequence() {
			DO_Permition _permition;
			try {
				_permition = new DO_Permition();
			} catch (Exception e) {
				Assert.IsTrue(false, "some error trying to instantiate DO_Permition\n---\n{0}\n---", e.Message);
				return; // no need...
			}
			_permition.Connection.Open();
			_permition.Connection.Transaction.Begin();



			_permition.Fields.Name = "123";
			long _idpermition;
			try {
				_idpermition = _permition.insObject(true);
			} catch (Exception e) {
				Assert.IsTrue(false, "some error running insObject\n---\n{0}\n---", e.Message);
				return; // no need...
			}
			Assert.IsTrue(_idpermition > 0L, "failed to retrieve identity seed (insObject)");
			_permition.clrObject();
			bool _exists;
			try {
				_exists = _permition.getObject(_idpermition);
			} catch (Exception e) {
				Assert.IsTrue(false, "some error running getObject\n---\n{0}\n---", e.Message);
				return; // no need...
			}
			Assert.IsTrue(_exists, "can't read inserted item (getObject)");
			Assert.AreEqual("123", _permition.Fields.Name, "inserted values difer those just read (insObject/getObject)");
			try {
				_permition.delObject(_idpermition);
			} catch (Exception e) {
				Assert.IsTrue(false, "some error trying to delete (delObject)\n---\n{0}\n---", e.Message);
				return; // no need...
			}



			_permition.Connection.Transaction.Rollback();
			_permition.Connection.Transaction.Terminate();
			_permition.Connection.Close();
			_permition.Dispose(); _permition = null;
		}