public void ItThrowsNotImplementException() { //Arrange var pressTrustOfIndiaNews = new PressTrustOfIndiaNewsSource(); //Act var result = Record.ExceptionAsync(() => pressTrustOfIndiaNews.GetNews(x => x.CreatedAt >= DateTime.UtcNow.AddDays(-1))); //Arrange Assert.IsAssignableFrom <NotImplementedException> (result.Result.GetBaseException()); Assert.Equal("Delete is not avaliable for TestEntity", result.Result.Message); }
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); }