public ArticleOverviewPresenter(IArticlesView view, Domain.Module module, IArticleService articleService)
        {
            this.view           = view;
            this.articleService = articleService;
            this.module         = module;

            this.parameter = ParameterBuilder.Deserialize <ArticlesOverviewParameter>(module.Parameter);
        }
Beispiel #2
0
        public void LoadArticles()
        {
            var mockService = new Mock <IArticleService>();

            var testArticles = new List <Article>()
            {
                new Article()
                {
                    Id          = 1,
                    Text        = "Bla",
                    Heading     = "Heading",
                    CreatedAt   = DateTime.Now,
                    CreatedById = 1
                }
            };

            mockService.Setup(x => x.GetAll()).Returns(testArticles);

            var testParameter = new ArticlesOverviewParameter()
            {
                BackgroundColorHex = "#cccccc"
            };

            var testModule = new Domain.Module()
            {
                Parameter = ParameterBuilder.Serialize(testParameter)
            };


            var fakeView  = new FakeArticlesView();
            var presenter = new ArticleOverviewPresenter(fakeView, testModule, mockService.Object);

            presenter.LoadArticles();

            Assert.AreEqual(fakeView.Articles.Count, testArticles.Count);
            Assert.AreEqual(fakeView.BackgroundColorHex, testParameter.BackgroundColorHex);
        }