public void RemoveTest() { IUserGroupRepository r = new UserGroupRepository(); var list = r.GetAll().GetEnumerator(); list.MoveNext(); Usuario item = new Usuario() { Login = "******", Senha = "senha2", Nome = "Nome2", Email = "*****@*****.**", Situacao = ActiveInactiveType.Active, Grupo = list.Current }; IUserRepository target = new UserRepository(); target.Add(item); target.Remove(item); // use session to try to load the product using (ISession session = NHibernateHelper.OpenSession()) { var fromDb = session.Get <Usuario>(item.Id); Assert.IsNull(fromDb); Assert.AreNotSame(item, fromDb); } }
public static void MyClassInitialize(TestContext testContext) { IUserGroupRepository r = new UserGroupRepository(); var list = r.GetAll().GetEnumerator(); list.MoveNext(); item = new Usuario() { Login = "******", Senha = "senha", Nome = "Nome", Email = "*****@*****.**", Situacao = ActiveInactiveType.Active, Grupo = list.Current }; IUserRepository target = new UserRepository(); target.Add(item); }
public void AddTest() { IUserGroupRepository r = new UserGroupRepository(); var list = r.GetAll().GetEnumerator(); list.MoveNext(); Usuario item = new Usuario() { Login = "******", Senha = "senha1", Nome = "Nome1", Email = "*****@*****.**", Situacao = ActiveInactiveType.Active, Grupo = list.Current }; IUserRepository target = new UserRepository(); target.Add(item); try { // use session to try to load the product using (ISession session = NHibernateHelper.OpenSession()) { var fromDb = session.Get <Usuario>(item.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(item, fromDb); Assert.AreEqual(item.Login, fromDb.Login); Assert.AreEqual(item.Senha, fromDb.Senha); Assert.AreEqual(item.Nome, fromDb.Nome); Assert.AreEqual(item.Email, fromDb.Email); Assert.AreEqual(item.Situacao, fromDb.Situacao); Assert.AreEqual(item.Situacao, fromDb.Situacao); Assert.IsNotNull(fromDb.Grupo); Assert.AreEqual(item.Grupo.Id, fromDb.Grupo.Id); } } finally { target.Remove(item); } }
public List <tbl_UserGroups> GetAllUserGroupsOrdered() { return(UserGroupRepository.GetAll().OrderBy(ug => ug.UG_Order).ToList()); }
public List <tbl_UserGroups> GetAllUserGroups() { return(UserGroupRepository.GetAll().ToList()); }
public IQueryable <UserGroup> GetAll() { return(_userGroupRepository.GetAll()); }