Пример #1
0
 public void When()
 {
     var repositoryFactory = new DomainRepositoryStubFactory();
     _blogRepository = repositoryFactory.GetDomainRepository<Blog>();
     _blogCommandHandlers = new BlogCommandHandlers(repositoryFactory);
     _createBlogCommand = new CreateBlogCommand("Title", "SubTitle", Guid.Empty, Guid.Empty);
     _blogCommandHandlers.Handle(_createBlogCommand);
 }
Пример #2
0
        public CommandRouter(IDomainRepositoryFactory domainRepositoryFactory)
        {
            _domainRepositoryFactory = domainRepositoryFactory;
            _postCommandHandlers = new PostCommandHandlers(_domainRepositoryFactory);
            _blogCommandHandlers = new BlogCommandHandlers(_domainRepositoryFactory);
            _userCommandHandlers = new UserCommandHandlers(_domainRepositoryFactory);

            Register<CreateUserCommand>(_userCommandHandlers.Handle);

            Register<CreateBlogCommand>(_blogCommandHandlers.Handle);
            Register<EnableGoogleAnalyticsCommand>(_blogCommandHandlers.Handle);
            Register<AddRedirectUrlCommand>(_blogCommandHandlers.Handle);
            Register<EnableDisqusCommand>(_blogCommandHandlers.Handle);

            Register<CreatePostCommand>(_postCommandHandlers.Handle);
            Register<PublishPostCommand>(_postCommandHandlers.Handle);
            Register<UpdatePostCommand>(_postCommandHandlers.Handle);
            Register<DeletePostCommand>(_postCommandHandlers.Handle);
            Register<SetPublishDateOnPostCommand>(_postCommandHandlers.Handle);
        }