예제 #1
0
        public void Setup()
        {
            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            appDbContext = new AppDbContext(options);

            appDbContext.Database.EnsureCreated();

            DbInitializer.Seed(appDbContext);

            userManager                 = new  MockUserManager();
            orderRepository             = new MockOrderRepository();
            shoppingCart                = new ShoppingCart(appDbContext);
            creditTransactionRepository = new MockCreditTransactionRepository();

            controller = new OrderController(orderRepository, shoppingCart, userManager, creditTransactionRepository);
        }
        public void Setup()
        {
            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            appDbContext = new AppDbContext(options);
            appDbContext.Database.EnsureCreated();

            userManager   = new  MockUserManager();
            signInManager = new MockSignInManager();

            controller          = new AccountController(signInManager, userManager);
            validLoginViewModel = new LoginViewModel()
            {
                UserName = "******",
                Email    = "*****@*****.**"
            };
            invalidLoginViewModel = null;
        }
        public void Setup()
        {
            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: "testDb")
                          .Options;

            appDbContext = new AppDbContext(options);
            appDbContext.Database.EnsureCreated();

            userManager      = new  MockUserManager();
            roleManager      = new MockRoleManager();
            sellerRepository = new MockSellerRepository();

            controller          = new AdminController(userManager, roleManager, sellerRepository);
            validLoginViewModel = new LoginViewModel()
            {
                UserName = "******",
                Email    = "*****@*****.**"
            };
            invalidLoginViewModel = null;
        }