コード例 #1
0
        public void Setup()
        {
            _data = new List <PostCategory>()
            {
                new PostCategory()
                {
                    Id    = 1,
                    Title = "Title"
                }
            };

            _context = InMemoryDatabaseUtility.GetInMemoryDatabaseContext();

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

            _repository = new EfCorePostCategoryRepository(_context);
        }
コード例 #2
0
ファイル: UnitOfWork.cs プロジェクト: AMZEnterprise/Xant
        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);
        }