示例#1
0
        public void GetCategoryWiseNews_ShouldReturnListOfNews()
        {
            var mockINewsService = new Mock <INewsService>();

            mockINewsService.Setup(service => service.GetCategory("Technology")).Returns(GetasyncNews());
            var newsController = new NewsController(mockINewsService.Object);

            // Act
            var result = newsController.GetCategory("Technology").Result as List <News>;

            //Assert
            Assert.Equal(4, result.Count);
            Assert.NotNull(result);
        }