public void Save(ml_ForumThread model) { if (model.ID <= 0) { _repo.Insert(model); } else { _repo.Update(model); } }
public void MemoryRepository_TestGetAllWithPredicate() { var thread = new ml_ForumThread(); thread.ID = -1; thread.Title = "Test Thread for Get with predicate"; _repo.Insert(thread); _unitOfWork.SaveChanges(); var threadFromRepo = _repo.GetAll(t => t.Title == "Test Thread for Get with predicate").FirstOrDefault(); Assert.IsNotNull(threadFromRepo); }
public void MemoryRepository_TestInsertEntity() { int countBefore = _repo.GetAll().Count(); var thread = new ml_ForumThread(); thread.ID = -1; thread.Title = "Test Thread #1"; _repo.Insert(thread); _unitOfWork.SaveChanges(); Assert.AreEqual((countBefore + 1), _repo.GetAll().Count()); }