示例#1
0
        public void ArticleServiceGetArticles()
        {
            // vezérlő példányosítása
            Service.Models.NewsService service = new Service.Models.NewsService(_entityMock.Object);

            // ellenőrzés januárra
            IEnumerable <Article> articles = service.Articles;

            Assert.AreEqual(1, articles.ToArray().Length);
        }
示例#2
0
        public void ArticleServiceGetWrongImage()
        {
            // vezérlő példányosítása
            Service.Models.NewsService service = new Service.Models.NewsService(_entityMock.Object);

            // ellenőrzés januárra
            Image image = service.GetImage(2);

            Assert.AreEqual(null, image);
        }
示例#3
0
        public void ArticleServiceGetArticle()
        {
            // vezérlő példányosítása
            Service.Models.NewsService service = new Service.Models.NewsService(_entityMock.Object);

            // ellenőrzés januárra
            Article article = service.GetArticle(1);

            Assert.AreEqual(1, article.Id);
        }
示例#4
0
        public void ArticleServiceDeleteArticle()
        {
            Service.Models.NewsService service = new Service.Models.NewsService(_entityMock.Object);

            Article article = _articleData[0];

            Boolean result = service.DeleteArticle(article);

            Assert.AreEqual(true, result);
            Assert.AreEqual(0, _articleData.ToArray().Length);
        }
示例#5
0
        public void ArticleServiceAddArticle()
        {
            Service.Models.NewsService service = new Service.Models.NewsService(_entityMock.Object);

            Article article = new Article
            {
                Id          = 2,
                Title       = "TEST",
                Summary     = "TEST",
                Content     = "TEST",
                Author      = "testadmin",
                PublishedAt = new DateTime(2017, 08, 06),
                isLead      = false
            };

            Boolean result = service.AddArticle(article);

            Assert.AreEqual(true, result);
            Assert.AreEqual(2, _articleData.ToArray().Length);
        }