public void AddTest() { UsuarioGrupo item = new UsuarioGrupo() { Descricao = "UsuarioGrupo01", Tipo = UserGroupType.Administrator }; IUserGroupRepository target = new UserGroupRepository(); target.Add(item); try { // use session to try to load the product using (ISession session = NHibernateHelper.OpenSession()) { var fromDb = session.Get <UsuarioGrupo>(item.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(item, fromDb); Assert.AreEqual(item.Descricao, fromDb.Descricao); Assert.AreEqual(item.Tipo, fromDb.Tipo); } } finally { target.Remove(item); } }
public static void MyClassInitialize(TestContext testContext) { item = new UsuarioGrupo() { Descricao = "UsuarioGrupo01", Tipo = UserGroupType.Administrator }; IUserGroupRepository target = new UserGroupRepository(); target.Add(item); }
public static void TestAddUserGroup() { UserGroup group = new UserGroup { CreateTime=DateTime.Now, Description="", Title="R2Team" }; UserGroupRepository context = new UserGroupRepository(); context.Add(group); }
public void RemoveTest() { UsuarioGrupo item = new UsuarioGrupo() { Descricao = "UsuarioGrupo00", Tipo = UserGroupType.Employee }; IUserGroupRepository target = new UserGroupRepository(); target.Add(item); target.Remove(item); // use session to try to load the product using (ISession session = NHibernateHelper.OpenSession()) { var fromDb = session.Get <UsuarioGrupo>(item.Id); Assert.IsNull(fromDb); Assert.AreNotSame(item, fromDb); } }