Esempio n. 1
0
        private SkyWalkerDbContext GetDbContext()
        {
            var options = new DbContextOptionsBuilder <SkyWalkerDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;
            var dbContext = new SkyWalkerDbContext(options);

            dbContext.AppUsers.Add(new AppUser()
            {
                Id           = 1,
                UserId       = "yemobai",
                UserName     = "******",
                UserPassWord = "******"
            });
            dbContext.Add(new AppUser()
            {
                Id           = 2,
                UserId       = "123",
                UserName     = "******",
                UserPassWord = "******"
            });
            dbContext.SaveChanges();
            return(dbContext);
        }
Esempio n. 2
0
 public UserController(SkyWalkerDbContext _dbContext, IRepository <AppUser> _repository)
 {
     dbContext      = _dbContext;
     userRepository = _repository;
 }
Esempio n. 3
0
 public UserControllerTest()
 {
     dbContext = this.GetDbContext();
 }
Esempio n. 4
0
 public ValuesController(SkyWalkerDbContext _dbContext)
 {
     dbContext = _dbContext;
 }