public ModulesController(ThesisProjectDBContext context,
                          IConfiguration configuration)
 {
     _context       = context;
     _configuration = configuration;
     //TODO interface
     _moduleRepository = new ModuleRepository(_context);
     _fileRepository   = new FileRepository(_context, _configuration);
 }
Exemple #2
0
 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);
        }
Exemple #5
0
 public FileSeeder(ThesisProjectDBContext context)
 {
     _context = context;
 }
Exemple #6
0
 public ModuleRepository(ThesisProjectDBContext context)
 {
     _context = context;
 }
 public FileRepository(ThesisProjectDBContext context,
                       IConfiguration configuration)
 {
     _context       = context;
     _configuration = configuration;
 }
Exemple #8
0
 public void SetUp()
 {
     _context    = new ThesisProjectDBContext();
     _controller = new ModulesController(_context, null);
 }