public async Task Given_An_Article_If_Not_Published_To_Queue_IsSuccessful_Should_Be_False() { // Arrange var article = new Article(); _wikiArticle.Details(Arg.Any <int>()).Returns(new ExpandedArticleResultSet { Items = new Dictionary <string, ExpandedArticle> { ["key"] = new ExpandedArticle { Id = 24324, Abstract = "OCG in effect since September 1, 2007." } } }); _wikiArticle.Simple(Arg.Any <long>()).Returns(new ContentResult { Sections = new Section[0] }); _banlistDataQueue.Publish(Arg.Any <ArticleProcessed>()).Returns(new YugiohBanlistCompletion()); // Act var result = await _sut.Process(article); // Assert result.IsSuccessful.Should().BeFalse(); }
public async Task Given_A_banlistType_Should_Invoke_Process_Method_Twice() { // Arrange const int expected = 2; _banlistUrlDataSource .GetBanlists(Arg.Any <BanlistType>(), Arg.Any <string>()) .Returns ( new Dictionary <int, List <int> > { [2017] = new List <int> { 1, 2 } } ); _articleProcessor .Process(Arg.Any <string>(), Arg.Any <UnexpandedArticle>()) .Returns(new ArticleTaskResult { IsSuccessfullyProcessed = true }); // Act await _sut.Process(BanlistType.Tcg); // Assert await _articleProcessor.Received(expected).Process(Arg.Any <string>(), Arg.Any <UnexpandedArticle>()); }