コード例 #1
0
        public ArticleApplicationServiceTests()
        {
            fakeUnitOfWork            = new FakeUnitOfWork();
            fakeServiceBus            = new FakeServiceBus();
            domainNotificationHandler = new DomainNotificationHandler();
            categoryRepository        = new FakeArticleCategoryRepository();
            repository       = new FakeArticleRepository();
            fakeDomainBus    = new FakeDomainBus();
            identityResolver = new FakeIdentityResolver();

            applicationService = new ArticleApplicationService(repository, categoryRepository, identityResolver, domainNotificationHandler, fakeUnitOfWork, fakeServiceBus, fakeDomainBus);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var article = new Article();

            article.AddProduct(new Product("002852", "招商财富宝A"));

            var articleApplicationService = new ArticleApplicationService(new DictionaryArticleRepository());

            articleApplicationService.CreateArticle(article);

            var articles = articleApplicationService.GetArticles();

            Console.WriteLine("Articles size is {0}", articles.Count);
            Console.WriteLine("Id is {0} and Status is {1}", articles[0].Id.Id, articles[0].Status);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var articleApplicationService = new ArticleApplicationService(new DictionaryArticleRepository());

            var article = new Article("An article title", "An article content",
                                      new List <Product> {
                new Product("002852", "招商财富宝A")
            });

            articleApplicationService.CreateArticle(article);

            articleApplicationService.Publish(article.Id);

            var articles = articleApplicationService.GetArticles();

            Console.WriteLine("Articles size is {0}", articles.Count);
            Console.WriteLine("Id is {0} and Status is {1}", articles[0].Id.Id, articles[0].Status);
        }