Ejemplo n.º 1
0
        public WebActionTestBase()
        {
            var options = new DbContextOptionsBuilder <DataContextTest>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;

            _context = new DataContextTest(options);
            _context.Database.EnsureCreated();

            _userManager = new FakeUserManager(_context);

            //mock httpcontext


            _signInManager = new FakeSignInManager(_userManager);

            _courseService    = new CourseService(_context);
            _studentService   = new StudentService(_context);
            _enrollService    = new EnrollService(_context);
            _facultyService   = new FacultyService(_context);
            _wishlistService  = new WishlistService(_context);
            _viewModelService = new ViewModelService(_courseService, _enrollService, _studentService, _facultyService, _wishlistService);
            _courseController = new CourseController(_userManager, null, _courseService, _studentService, _enrollService, _wishlistService, _viewModelService);
            _homeController   = new HomeController(_userManager, null, _courseService, _studentService, _enrollService, _viewModelService);
            _authController   = new AuthController(_signInManager);
        }
Ejemplo n.º 2
0
 public FakeSignInManager(FakeUserManager userManager)
     : base(userManager,
            new Mock <IHttpContextAccessor>().Object,
            new Mock <IUserClaimsPrincipalFactory <StudentUser> >().Object,
            new Mock <IOptions <IdentityOptions> >().Object,
            new Mock <ILogger <SignInManager <StudentUser> > >().Object,
            new Mock <IAuthenticationSchemeProvider>().Object,
            new Mock <IUserConfirmation <StudentUser> >().Object)
 {
 }