Example #1
0
        public async Task getNews_ShouldNotFindNews()
        {
            var testNews   = getTestNews();
            var controller = new api.Controllers.NewsController();
            var response   = await controller.GetNews() as List <entities.News>;

            Assert.AreEqual(testNews.Count, response.Count);
        }
Example #2
0
        public void AddNewsTest()
        {
            // Arrange
            var controller = new api.Controllers.NewsController();

            entities.News noticia = new entities.News
            {
                Id          = Guid.NewGuid(),
                Title       = "noticia 1",
                Subtitle    = "sub title 1",
                Description = "descrip",
                DatePublish = DateTime.Now,
            };

            IHttpActionResult actionResult = controller.PostNews(noticia);
            var createdResult = actionResult as OkNegotiatedContentResult <entities.News>;

            Assert.IsNotNull(createdResult);
            Assert.AreEqual(noticia.Id, createdResult.Content.Id);
        }