public Guid Add(T t) { DateTime dt = DateTime.Now; t.InsTs = dt; t.UpdTs = dt; _context.Set <T>().Add(t); return(t.Id); }
public void Add(TEntity obj) { Ctx.Set <TEntity>().Add(obj); Ctx.SaveChanges(); }
public void Record_Is_Not_Persisted_Without_Calling_SaveAsync() { int numberOfItems = _context.Set <Task>().Count(); Task newRecord = new TaskBuilder().WithName("NewTask").Build(); DateTime insTsPreAdd = newRecord.InsTs; DateTime updTsPreAdd = newRecord.UpdTs; _repo.Add(newRecord); var records = _context.Set <Task>().ToList(); Assert.AreEqual(numberOfItems, records.Count); Assert.That(!records.Contains(newRecord)); }