public UnitOfWork(IGContext _dbContext) { dbContext = _dbContext; IG_ServiceRepository = new IG_ServiceRepository(dbContext); IG_Login_ServiceRepository = new IG_Login_ServiceRepository(dbContext); IG_Rating_Login_ServiceRepository = new IG_Rating_Login_ServiceRepository(dbContext); }
public void RatingTest() { var optionsBuilder = new DbContextOptionsBuilder <IGContext>(); optionsBuilder.UseInMemoryDatabase("IELTS_GiaSu"); var dbContext = new IGContext(optionsBuilder.Options); var dateTime = DateTime.UtcNow; var ratingObj = new IG_Rating_Login_Service { feedback = "Hệ thống tốt", loginToken = MD5Generator.CreateMD5(dateTime.ToString()), timestamp = dateTime, serviceCode = "IG_VeSinh", ratingPoint = 5 }; dbContext.IG_Rating_Login_Service.Add(ratingObj); var result = dbContext.SaveChanges(); if (result > 0) { Assert.Pass(); } else { Assert.Fail(); } }
public IG_ServiceRepository(IGContext _dbContext) : base(_dbContext) { dbContext = _dbContext; }
public IG_Rating_Login_ServiceRepository(IGContext _dbContext) : base(_dbContext) { dbContext = _dbContext; }
public Repository(IGContext _dbContext) { dbContext = _dbContext; dbSet = dbContext.Set <T>(); }