public ArticleCommandHandlerTest()
        {
            _queryRepository = new Mock<IQueryRepository>();
            _queryRepository.Setup(qr => qr.GetHeaders()).Returns(new List<ArticleHeaderState>());
            _queryRepository.Setup(qr => qr.GetArticle(It.IsAny<Guid>())).Returns(new ArticleState());

            _commandRepository = new Mock<ICommandRepository>();
            _commandRepository.Setup(cr => cr.CreateArticle(It.IsAny<ArticleState>()));
            _commandRepository.Setup(cr => cr.DeleteArticle(It.IsAny<string>()));

            _queueService = new Mock<IQueueService>();
            _queueService.Setup(qs => qs.PushMessage(It.IsAny<object>()));

            var standardTinyMappingService = new StandardTinyMappingService();
            standardTinyMappingService.Bind<ArticleDto, ArticleState>();
            standardTinyMappingService.Bind<CommentState, CommentDto>();
            standardTinyMappingService.Bind<Article, ArticleDto>();
            var commentFactory = new CommentFactory(new CommentValidator(), standardTinyMappingService);
            var articleFactory = new ArticleFactory(_queryRepository.Object, new ArticleValidator(),
                new CommentValidator(),
                standardTinyMappingService);
            _articleCommandHandler = new ArticleCommandHandler(_queueService.Object,
                articleFactory, commentFactory);
        }
Beispiel #2
0
 public void GivenIGotWorkingArticleService()
 {
     _articleCommandHandler = NinjectServiceLocator.Kernel.Get<ArticleCommandHandler>();
 }