public static void Save_Entity_Test() { IUserRepository repository = new UserRepository(_session); User operador = new User { Login = "******", Name = "Operador Teste", Password = "******", }; repository.Insert(operador); User operadorBd = repository.GetById(operador.Id); Assert.AreEqual(operador.Name, operadorBd.Name); }
public static void Get_Entity_By_Id() { long id = 0; IUserRepository repository = new UserRepository(_session); User operadorBd = null; User operador = new User { Login = "******", Name = "Operador Teste Fabrica", Password = "******", }; repository.Insert(operador); id = operador.Id; operadorBd = repository.GetById(id); Assert.That(operadorBd.GetHashCode(), Is.Not.EqualTo(operador.GetHashCode())); Assert.That(operadorBd.Id, Is.EqualTo(operador.Id)); }
public static void Update_Entity_Test() { const string operadorNameAtualizado = "Operador Teste Update"; IUserRepository repository = new UserRepository(_session); User operador = new User { Login = "******", Name = "Operador Teste", Password = "******", }; repository.Insert(operador); User operadorBd = repository.GetAll().First(); operadorBd.Name = operadorNameAtualizado; repository.Update(operadorBd); operadorBd = repository.GetAll().First(); Assert.AreEqual(operadorNameAtualizado, operadorBd.Name); }