public ModulesController(ThesisProjectDBContext context, IConfiguration configuration) { _context = context; _configuration = configuration; //TODO interface _moduleRepository = new ModuleRepository(_context); _fileRepository = new FileRepository(_context, _configuration); }
public HomeController(ThesisProjectDBContext context, IStringLocalizer <HomeController> localizer, IConfiguration configuration) { _context = context; //TODO dependendy injecton _moduleRepository = new ModuleRepository(_context); _localizer = localizer; _configuration = configuration; }
public void Test() { var optionBuilder = new DbContextOptionsBuilder <ThesisProjectDBContext>(); optionBuilder.UseInMemoryDatabase(); _context = new ThesisProjectDBContext(optionBuilder.Options); var controller = new ModulesController(_context); }
public void Test1() { var options = new DbContextOptionsBuilder <ThesisProjectDBContext>() .UseInMemoryDatabase() .Options; _context = new ThesisProjectDBContext(options); var controller = new HomeController(_context, null, null); var result = controller.Index(); var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsType <IndexViewModel>(viewResult.ViewData.Model); Assert.Equal("Welcome", model.Heading); }
public FileSeeder(ThesisProjectDBContext context) { _context = context; }
public ModuleRepository(ThesisProjectDBContext context) { _context = context; }
public FileRepository(ThesisProjectDBContext context, IConfiguration configuration) { _context = context; _configuration = configuration; }
public void SetUp() { _context = new ThesisProjectDBContext(); _controller = new ModulesController(_context, null); }