//just map enteties public virtual bool Update(T item) { //return false, if we try to update item, which diesnt exist in DB if (IsIdExists(item) == false) { return(false); } var mapper = new MapperConfiguration(cfg => cfg.CreateMap <T, K>()).CreateMapper(); var itemToUpdate = mapper.Map <T, K>(item); bool updResult = _curEFRep.Update(itemToUpdate); return(updResult); }
public void Given_InstanciaRepositorio_When_Update_Then_ReturnTrue() { Personal persona = new Personal { Id = 19, Nombre = "Jazmin", Apellidos = "Zarate Marin", Edad = 36 }; bool?result; using (var repository = new RepositoryEF(new CSIContext(connectionString))) { result = repository.Update <Personal>(persona); } if (result != null) { Assert.IsTrue((bool)result); } else { Assert.IsNotNull(result); } }