コード例 #1
0
 public GetArticleDetailQueryHandler(
     IArticleRepo articleRepo,
     IMapper mapper)
 {
     _articleRepo = articleRepo;
     _mapper      = mapper;
 }
コード例 #2
0
 public Handler(
     IArticleRepo articleRepo,
     IMediator mediator)
 {
     _articleRepo = articleRepo;
     _mediator    = mediator;
 }
コード例 #3
0
ファイル: MonitorSvc.cs プロジェクト: Memoyu/blog_service
 public MonitorSvc(IArticleRepo articleRepo, ICategoryRepo categoryRepo, ITagRepo tagRepo, ICommentRepo commentRepo)
 {
     _articleRepo  = articleRepo;
     _categoryRepo = categoryRepo;
     _tagRepo      = tagRepo;
     _commentRepo  = commentRepo;
 }
コード例 #4
0
 public CategorySvc(ILogger <CategorySvc> logger, ICategoryRepo categoryRepo, IArticleRepo articleRepo, IArticleContentRepo articleContentRepo)
 {
     _logger             = logger;
     _categoryRepo       = categoryRepo;
     _articleRepo        = articleRepo;
     _articleContentRepo = articleContentRepo;
 }
コード例 #5
0
 public ArticleService(IUserService uService, IArticleRepo repo, IRepo <ArticleComment> cRepo, IArticleLikeRepo alRepo, ICommentLikeRepo clRepo)
 {
     _uService = uService;
     _repo     = repo;
     _cRepo    = cRepo;
     _alRepo   = alRepo;
     _clRepo   = clRepo;
 }
コード例 #6
0
 /// <summary>
 /// Controller constructor
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="articleRepo"></param>
 /// <param name="userRepo"></param>
 /// <param name="cartRepo"></param>
 /// <param name="transactionRepo"></param>
 public UserController(ILogger <UserController> logger, IArticleRepo articleRepo, IUserRepo userRepo, ICartRepo cartRepo, ITransactionRepo transactionRepo)
 {
     this._userRepo        = userRepo;
     this._articleRepo     = articleRepo;
     this._logger          = logger;
     this._cartRepo        = cartRepo;
     this._transactionRepo = transactionRepo;
 }
コード例 #7
0
 public ArticleApplication(IArticleRepo articleRepo)
 {
     _articleRepo = articleRepo;
 }
コード例 #8
0
 public ArticlesController(IArticleRepo repository)
 {
     Requires.NotNull(repository);
     this._repository = repository;
 }
コード例 #9
0
ファイル: ArticleSvc.cs プロジェクト: Memoyu/blog_service
 public ArticleSvc(IArticleRepo articleRepo, IArticleTagRepo articleTagRepo)
 {
     _articleRepo    = articleRepo;
     _articleTagRepo = articleTagRepo;
 }
コード例 #10
0
 public ArticlesController(IArticleRepo articleRepo, IMapper mapper)
 {
     _articleRepo = articleRepo;
     _mapper      = mapper;
 }
コード例 #11
0
 public ArticleController(IArticleRepo repoAricle, IMapper mapper)
 {
     _repositoryArticle = repoAricle;
     _mapper            = mapper;
 }
コード例 #12
0
 public ArticleService(IArticleRepo repo, IUnitOfWork uow, IEventBus eventBus)
 {
     this.repo     = repo;
     this.uow      = uow;
     this.eventBus = eventBus;
 }
コード例 #13
0
 public DAOFactory(ICategoryRepo categoryRepo, IArticleRepo articleRepo, ITagRepo tagRepo)
 {
     this.tagRepo      = tagRepo;
     this.categoryRepo = categoryRepo;
     this.articleRepo  = articleRepo;
 }
コード例 #14
0
 public ArticlesController(IArticleRepo repository, IMapper mapper, IMemoryCache memoryCache)
 {
     _repository  = repository;
     _mapper      = mapper;
     _memoryCache = memoryCache;
 }
コード例 #15
0
 public ArticleApplication(IArticleRepo articleRepo, IFileUploader fileUploader, IArticleCategoryRepo articleCategoryRepo)
 {
     _articleRepo         = articleRepo;
     _fileUploader        = fileUploader;
     _articleCategoryRepo = articleCategoryRepo;
 }
コード例 #16
0
 public ArticleController(IArticleRepo articleRepo, IArticleCommentRepo articleCommentRepo)
 {
     this._articleRepo        = articleRepo;
     this._articleCommentRepo = articleCommentRepo;
 }
コード例 #17
0
 public ArticleServiceBiz(IArticleRepo Repository_Article_Val)
 {
     Repository_Article_P = Repository_Article_Val ?? new ArticleRepoBiz();
 }
コード例 #18
0
 public ArticlesController(IArticleRepo repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
コード例 #19
0
        /// <summary>
        /// Constructor for the user CRUD unit tests
        /// </summary>
        public ArticleRepoTests()
        {
            var articleMockRepo = new ArticleMockRepo(_articles);

            this._mockRepo = articleMockRepo._articleRepo;
        }
コード例 #20
0
        /// <summary>
        /// Public constructor for the mocked repository
        /// </summary>
        public ArticleMockRepo(List <Article> articles = null)
        {
            if (articles != null)
            {
                _articlesMockList = articles;
            }

            Mock <IArticleRepo> mockRepo = new Mock <IArticleRepo>();

            // Mocks the function Get()
            mockRepo.Setup(articleRepo => articleRepo.Get("")).ReturnsAsync(DBOTODTOList(_articlesMockList));

            // Mocks the function Insert()
            mockRepo.Setup(articleRepo => articleRepo.Insert(It.IsAny <DTOArticle>())).ReturnsAsync((DTOArticle articleModel) =>
            {
                var max = Math.Max(_articlesMockList.Max(c => c.Id) + 1, _articlesMockList.Max(c => c.Id));
                if (articleModel.Id > max)
                {
                    return(null);
                }
                var article = DTOToDBO(articleModel);
                article.Id  = max;
                if (articleModel.Name == null)
                {
                    return(null);
                }
                this._articlesMockList.Add(article);
                return(DBOToDTO(article));
            });

            // Mocks the function Update()
            mockRepo.Setup(articleRepo => articleRepo.Update(It.IsAny <DTOArticle>())).ReturnsAsync((DTOArticle articleModel) =>
            {
                var result = _articlesMockList.Where(c => c.Id == articleModel.Id);
                if (result.Count() != 1)
                {
                    return(null);
                }
                var article = result.First();
                if (article.SellerId != articleModel.SellerId)
                {
                    return(null);
                }
                article.ImageSource = articleModel.ImageSource;
                article.Name        = articleModel.Name;
                article.Price       = articleModel.Price;
                article.Description = articleModel.Description;
                article.Category    = articleModel.Category;
                article.Sex         = articleModel.Sex;
                article.Brand       = articleModel.Brand;
                article.Condition   = articleModel.Condition;
                return(DBOToDTO(article));
            });

            // Mocks the function Delete()
            mockRepo.Setup(articleRepo => articleRepo.Delete(It.IsAny <long>())).ReturnsAsync((long i) =>
            {
                var articles = _articlesMockList.Where(c => c.Id == i);
                if (articles.Count() == 1)
                {
                    _articlesMockList.Remove(articles.First());
                    return(true);
                }

                return(false);
            });

            // Mocks the function GetById()
            mockRepo.Setup(articleRepo => articleRepo.GetById(It.IsAny <long>())).Returns((long i) =>
            {
                var count = _articlesMockList.Count(c => c.Id == i);
                if (count != 1)
                {
                    return(null);
                }

                var article = _articlesMockList.Single(c => c.Id == i);
                return(DBOToDTOAsync(article));
            });

            // Mocks the function Count()
            mockRepo.Setup(articleRepo => articleRepo.Count()).ReturnsAsync(_articlesMockList.Count());

            // Mocks the function GetUserFromId()
            mockRepo.Setup(articleRepo => articleRepo.GetUserFromId(It.IsAny <long>())).Returns((long i) =>
            {
                if (_articlesMockList.Count(c => c.Id == i) == 0)
                {
                    return(null);
                }

                var user      = new DTOUser();
                user.Id       = 1;
                user.Email    = "*****@*****.**";
                user.Address  = "3B Rue de La Poste 69110 FRANCHEVILLE";
                user.Gender   = "man";
                user.Name     = "Louis SANTOS";
                user.Note     = 10;
                user.UserName = "******";

                return(user);
            });

            this._articleRepo = mockRepo.Object;
        }
コード例 #21
0
 /// <summary>
 /// Public constructor for article controller
 /// </summary>
 /// <param name="articleRepo">Article repository for dependancy injection</param>
 /// <param name="userRepo">User repository for dependancy injection</param>
 /// <param name="logger">Logger for dependancy injection</param>
 public ArticleController(IArticleRepo articleRepo, IUserRepo userRepo, ILogger <ArticleController> logger)
 {
     _articleRepo = articleRepo;
     _userRepo    = userRepo;
     _logger      = logger;
 }