public void TC1_GetNews_Datewise() { InternalNewsSource GoogleNews = new InternalNewsSource(); var result = GoogleNews.GetNews(x => x.CreatedAt >= DateTime.UtcNow.AddDays(-1)); Assert.NotNull(result); }
public void TC3_Get_PoliticalNews() { InternalNewsSource GoogleNews = new InternalNewsSource(); var result = GoogleNews.GetNews(x => x.Category.Name == "Political"); Assert.NotNull(result); }
public void TC2_Get_SportNews() { InternalNewsSource GoogleNews = new InternalNewsSource(); var result = GoogleNews.GetNews(x => x.Category.Name == "Sports"); Assert.NotNull(result); }
public void TC1_GetPublishData() { var googleSource = new GoogleNewsSource(); var internalSource = new InternalNewsSource(); var ptiSource = new PressTrustOfIndiaNewsSource(); var newsList = new List <News>() { new News { Title = "New 1", Content = "Content 1", CreatedAt = DateTime.UtcNow, IsBreaking = false, Priority = 0, PublishedAt = DateTime.UtcNow, Category = new NewsCategory { Id = 1, Name = "Sports", IsAdvertisement = true } }, new News { Title = "New 2", Content = "Content 2", CreatedAt = DateTime.UtcNow, IsBreaking = false, Priority = 0, PublishedAt = DateTime.UtcNow, Category = new NewsCategory { Id = 1, Name = "Sports", IsAdvertisement = true } } }; var pageNumber = 1; var publisher = new NewspaperPublisher(_mockNewsSourceRegistery.Object, _mockAppConfig.Object); _mockNewsSourceRegistery.Setup(x => x.Register(googleSource)).Returns(Task.CompletedTask); _mockNewsSourceRegistery.Setup(x => x.Register(internalSource)).Returns(Task.CompletedTask); _mockNewsSourceRegistery.Setup(x => x.Register(ptiSource)).Returns(Task.CompletedTask); _mockNewsSourceRegistery.Setup(x => x.GetAllRegisteredNews()).Returns(Task.FromResult <IEnumerable <News> >(newsList)); var result = publisher.Publish(pageNumber); Assert.NotNull(result); }
public async void TC4_GetAllRegisteredNews() { //Arrange INewsSource source = new InternalNewsSource(); await newsSourceRegistery.Register(source); source = new GoogleNewsSource(); await newsSourceRegistery.Register(source); source = new PressTrustOfIndiaNewsSource(); await newsSourceRegistery.Register(source); //Act var result = newsSourceRegistery.GetAllRegisteredNews(); //Assert Assert.NotNull(result); }