Esempio n. 1
0
 public void 登入遮罩帳號()
 {
     using (var dbContext = TestDbContext.CreateDbContext("TestDbContext_MaskId"))
     {
         var customers = dbContext.Customers.AsNoTracking().ToList();
         Assert.AreEqual("xxxx", customers[0].Tel);
     }
 }
Esempio n. 2
0
        public IActionResult Index()
        {
            TestDbContext test = new TestDbContext();

            test.CreateDbContext();

            return(View());
        }
Esempio n. 3
0
        public void 切換遮罩帳號()
        {
            using (var dbContext = TestDbContext.CreateDbContext())
            {
                dbContext.Database.ExecuteSqlCommand("EXECUTE AS USER = '******'");
                var customers = dbContext.Customers.AsNoTracking().ToList();

                dbContext.Database.ExecuteSqlCommand("REVERT");
                Assert.AreEqual("xxxx", customers[0].Tel);
            }
        }