public void TestInitialize()
        {
            //I needed to use in-memory DbContext instead of connecting to SQL Server
            var options = new DbContextOptionsBuilder <CRUDDBContext>()
                          .UseInMemoryDatabase("SomeRandomString")
                          .Options;
            var _context = new CRUDDBContext(options);


            //create mock data and add to in-memory db
            Employees mockEmpName = new Employees {
                EmployeeId = 3,
                EmpName    = "A fake Name"
            };

            employees.Add(new Employees
            {
                EmployeeId = 1,
                Position   = "Anything",
                DeptId     = "HumanResource",
                EmpName    = mockEmpName
            });

            employees.Add(new Employees
            {
                EmployeeId = 12,
                Position   = "Manager",
                DeptId     = "HumanResource",
                EmpName    = mockEmpName
            });

            foreach (var e in employees)
            {
                _context.Employees.Add(e);
            }
            _context.SaveChanges();

            employeesController = new EmployeesController(_context);
        }
Ejemplo n.º 2
0
 public RegisterModel(CRUDDBContext registercontext)
 {
     _cruddbcontext = registercontext;
 }
Ejemplo n.º 3
0
 public ProductsController(CRUDDBContext context)
 {
     _context = context;
 }
Ejemplo n.º 4
0
 public PostRepository(CRUDDBContext _db)
 {
     db = _db;
 }
Ejemplo n.º 5
0
 public DepartmentsController(CRUDDBContext context)
 {
     _context = context;
 }
 public EmployeesController(CRUDDBContext context)
 {
     _context = context;
 }
Ejemplo n.º 7
0
 public UserRepository(CRUDDBContext _db)
 {
     db = _db;
 }
Ejemplo n.º 8
0
 public EditModel(CRUDDBContext cruddbcontext)
 {
     _cruddbcontext = cruddbcontext;
 }
Ejemplo n.º 9
0
 public CRUDBunisnessLogicRep()
 {
     _db = new CRUDDBContext();
 }