Пример #1
0
        public DeleteArticleCommandHandlerTests()
        {
            _articleManagementService    = Mock.Of <IArticleManagementService>();
            _deleteArticleCommandHandler = new DeleteArticleCommandHandler(_articleManagementService);

            _deleteArticleCommand = new DeleteArticleCommand(SomeSlug);
        }
        public EditArticleCommandHandlerTests()
        {
            _articleManagementService = Mock.Of <IArticleManagementService>();
            _articleCommandHandler    = new EditArticleCommandHandler(_articleManagementService);

            _editArticleCommand = new EditArticleCommand
            {
                AuthorId   = Guid.NewGuid(),
                AuthorName = "Author Name",
                Content    = "Some content",
                Id         = 123,
                Topic      = "Some topic"
            };
        }
        public CreateNewArticleCommandHandlerTests()
        {
            _mapper  = Mock.Of <IMapper>();
            _article = new Article()
            {
                Id = 1
            };

            var mockService = new Mock <IArticleManagementService>();

            mockService.Setup(s => s.CreateArticleAndHistory(It.IsAny <Article>())).Returns(Task.FromResult(_article)).Verifiable();
            _articleManagementService = mockService.Object;

            _createNewArticleCommandHandler = new CreateNewArticleCommandHandler(_articleManagementService, _mapper);

            _createNewArticleCommand = new CreateNewArticleCommand();

            Mock.Get(_mapper).Setup(m => m.Map <Article>(_createNewArticleCommand)).Returns(_article);
        }
Пример #4
0
 public DeleteArticleCommandHandler(IArticleManagementService articleManagementService)
 {
     _articleManagementService = articleManagementService;
 }
Пример #5
0
 public GetArticleHandler(IArticleManagementService service)
 {
     _service = service;
 }
 public CreateNewArticleCommandHandler(IArticleManagementService articleManagementService, IMapper mapper)
 {
     _articleManagementService = articleManagementService;
     _mapper = mapper;
 }