public HomeControllerTests() { // Database setup var services = new ServiceCollection(); services.AddEntityFramework() .AddSqlServer() .AddInMemoryDatabase() .AddDbContext<DataDbContext>(options => options.UseInMemoryDatabase() ); // Dependencies initializations _pageConfiguration = new FakePageConfiguration(); var optionsBuilder = new DbContextOptionsBuilder<DataDbContext>(); optionsBuilder.UseInMemoryDatabase(); _dataDbContext = new DataDbContext(optionsBuilder.Options); _contentRepository = new ContentRepository(_dataDbContext); _humanReadableContentService = new HumanReadableContentService(_pageConfiguration, _contentRepository); _languageManipulationService = new LanguageManipulationService(); // Controller initialization _homeController = new PersonalWebsite.Controllers.HomeController( _pageConfiguration, _humanReadableContentService, _languageManipulationService ); }
public ContentEditorRepository(DataDbContext dataDbContext) { if(dataDbContext == null) { throw new ArgumentNullException(nameof(dataDbContext)); } _dataDbContext = dataDbContext; }
public InternalContentRepository(DataDbContext context) { _context = context; }