public AuthController(IUserBL userBL, IUnitOfWorkFactory unitOfWorkFactory, MovieSearchDbContext movieSearchDbContext) { this.userBL = userBL; this.unitOfWorkFactory = unitOfWorkFactory; SeedData.Initialize(movieSearchDbContext); }
public void Initialize() { var options = new DbContextOptionsBuilder <MovieSearchDbContext>() .ConfigureWarnings(w => w.Ignore(InMemoryEventId.TransactionIgnoredWarning)) .UseInMemoryDatabase("MovieSearchInMemoryDb") .Options; movieSearchDbContext = new MovieSearchDbContext(options); unitOfWork = new UnitOfWork(movieSearchDbContext); movieService = new MockMovieService(); cacheHelper = new MockCacheHelper(); movieBL = new MovieBL(movieService, cacheHelper); }
public void Initialize() { configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); var options = new DbContextOptionsBuilder <MovieSearchDbContext>() .ConfigureWarnings(w => w.Ignore(InMemoryEventId.TransactionIgnoredWarning)) .UseInMemoryDatabase("MovieSearchInMemoryDb") .Options; movieSearchDbContext = new MovieSearchDbContext(options); unitOfWork = new UnitOfWork(movieSearchDbContext); userBL = new UserBL(configuration); movieSearchDbContext.Users.Add(new User() { Email = "*****@*****.**", Password = AuthHelper.HashPassword("test") }); movieSearchDbContext.SaveChanges(); }