public void Setup()
        {
            _data    = new List <Post>();
            _context = InMemoryDatabaseUtility.GetInMemoryDatabaseContext();

            _context.Posts.AddRange(_data);
            _context.SaveChanges();

            _repository = new EfCorePostRepository(_context);
        }
예제 #2
0
        public UnitOfWork(
            ApplicationDbContext context,
            UserManager <User> userManager,
            SignInManager <User> signInManager,
            IPasswordHasher <User> passwordHasher
            )
        {
            _context        = context;
            _userManager    = userManager;
            _signInManager  = signInManager;
            _passwordHasher = passwordHasher;

            ContactRepository      = new EfCoreContactRepository(_context);
            PostCategoryRepository = new EfCorePostCategoryRepository(_context);
            PostCommentRepository  = new EfCorePostCommentRepository(_context);
            PostRepository         = new EfCorePostRepository(_context);
            SettingRepository      = new EfCoreSettingRepository(_context);
            UserRepository         = new EfCoreUserRepository(_userManager, _signInManager, _passwordHasher);
        }