public void FailedMakePersistentSave2Test() { /* * NOTA: * This test tries to save an transient instance which properties state is copied by a persistent instance. * So.. in a few words, the calling of MakePersistent method tries to update the given instance (if this one is persistent) * otherwise MakePersistent method tries to save it, but It can throw an exception if the given transient state instance * is equals to an existing persistent state into data store. */ SessionProvider.BeginTransaction(IsolationLevel.ReadCommitted); Salesman cons = CurrentPagedDAO.ExecuteExpression<Salesman, Salesman>(saleswoman => saleswoman.First()); Salesman cons2 = new Salesman { //ID = cons.ID, IdentityCode = cons.IdentityCode, Name = cons.Name, Surname = cons.Surname, Email = cons.Email }; cons2.UpdateId(cons); cons2.UpdateVersion(cons); try { CurrentPagedDAO.MakePersistent(cons2); SessionProvider.CommitTransaction(); } catch (Exception) { SessionProvider.RollbackTransaction(); DiscardCurrentSession(); throw; } }