public void SetUp() { _wikiArticle = Substitute.For <IWikiArticle>(); _banlistDataQueue = Substitute.For <IBanlistDataQueue>(); _sut = new BanlistProcessor(_wikiArticle, _banlistDataQueue, Substitute.For <ILogger <BanlistProcessor> >()); }
public void SetUp() { _wikiArticle = Substitute.For <IWikiArticle>(); _yugiohBanlistService = Substitute.For <IYugiohBanlistService>(); _sut = new BanlistItemProcessor(_wikiArticle, _yugiohBanlistService); }
public async Task <Wikitext> GetArticleMwRootAsync(IWikiArticle wikiArticle) { #region Log article var articleDataString = wikiArticle.ArticleData.Substring(0, Math.Min(wikiArticle.ArticleData.Length, 50)); _logger.LogInformation($"{nameof(GetArticleMwRootAsync)} parsing content:{Environment.NewLine}{articleDataString}"); #endregion if (wikiArticle.ContentModel != ContentModel.WikiText) { var errorMessage = $"This implementation of {nameof(MwParserApi)} can only load an instance of {nameof(IWikiArticle)} with {ContentModel.WikiText} {nameof(ContentModel)}"; _logger.LogError(errorMessage); throw new NotSupportedException(errorMessage); } // Build article AST _logger.LogDebug("Building article AST..."); var astRoot = await Task.Run( () => _parser.Parse(wikiArticle.ArticleData)); _logger.LogDebug("Done."); if (astRoot == null) { var errorMessage = $"{nameof(WikitextParser)} returned null AST root."; _logger.LogError(errorMessage); throw new ApplicationException(errorMessage); } return(astRoot); }
public void SetUp() { _archetypeWebPage = Substitute.For <IArchetypeWebPage>(); _queue = Substitute.For <IQueue <Archetype> >(); _wikiArticle = Substitute.For <IWikiArticle>(); _sut = new ArchetypeProcessor(_archetypeWebPage, _queue, _wikiArticle); }
public void SetUp() { _wikiArticle = Substitute.For <IWikiArticle>(); _tipRelatedWebPage = Substitute.For <ITipRelatedWebPage>(); _queues = Substitute.For <IEnumerable <IQueue> >(); _sut = new CardTipItemProcessor(_wikiArticle, _tipRelatedWebPage, _queues); }
public CardTipItemProcessor ( IWikiArticle wikiArticle, ITipRelatedWebPage tipRelatedWebPage, IEnumerable <IQueue> queues ) { _wikiArticle = wikiArticle; _tipRelatedWebPage = tipRelatedWebPage; _queues = queues; }
public CardRulingItemProcessor ( IWikiArticle wikiArticle, ICardService cardService, ICardRulingService cardRulingService ) { _wikiArticle = wikiArticle; _cardService = cardService; _cardRulingService = cardRulingService; }
public CardTriviaItemProcessor ( IWikiArticle wikiArticle, ICardService cardService, ICardTriviaService cardTriviaService ) { _wikiArticle = wikiArticle; _cardService = cardService; _cardTriviaService = cardTriviaService; }
public CardTipItemProcessor ( IWikiArticle wikiArticle, ICardService cardService, ICardTipService cardTipService, ITipRelatedWebPage tipRelatedWebPage ) { _wikiArticle = wikiArticle; _cardService = cardService; _cardTipService = cardTipService; _tipRelatedWebPage = tipRelatedWebPage; }
public async Task <IWikiContainer <IWikiArticle> > GetContainerAsync(IWikiArticle wikiArticle, Wikitext astRoot) { var wikiData = _wikiContentFactory.CreateWikiData(astRoot.ToPlainText(), ContentModel.WikiText); // Create the root of WikiComponent tree. var articleContainer = _wikiComponentFactory.CreateArticleContainer(wikiData, wikiArticle, astRoot, astRoot); var firstChild = astRoot.Lines.FirstNode; // Compose WikiComponent tree. var rootChildren = await _astTranslator.TranslateNodesAsync(firstChild); if (rootChildren.Any()) { articleContainer.AddChildren(rootChildren); } else { _logger.LogWarning("AST translator returned empty list of article descendants."); } return(articleContainer); }
public BanlistProcessor(IWikiArticle wikiArticle, IBanlistDataQueue banlistDataQueue, ILogger <BanlistProcessor> logger) { _wikiArticle = wikiArticle; _banlistDataQueue = banlistDataQueue; _logger = logger; }
public BanlistItemProcessor(IWikiArticle wikiArticle, IYugiohBanlistService banlistService) { _wikiArticle = wikiArticle; _banlistService = banlistService; }
public ArchetypeProcessor(IArchetypeWebPage archetypeWebPage, IQueue <Archetype> queue, IWikiArticle wikiArticle) { _archetypeWebPage = archetypeWebPage; _queue = queue; _wikiArticle = wikiArticle; }
public ArticleCategoryDataSource(IWikiArticle wikiArticle) { _wikiArticle = wikiArticle; }
public void SetUp() { var wikiaHttpClient = Substitute.For <IWikiaHttpClient>(); _wikiArticle = new WikiArticle("http://naruto.wikia.com", WikiaSettings.RelativeApiUrl, wikiaHttpClient); }
public void Setup() { _wikiArticle = Substitute.For <IWikiArticle>(); _sut = new ArticleCategoryDataSource(_wikiArticle); }
public void SetUp() { _wikiArticle = Substitute.For <IWikiArticle>(); _sut = new CardSectionProcessor(_wikiArticle); }
public async Task<IWikiContainer<IWikiArticle>> GetContainerAsync(IWikiArticle wikiArticle) { return await _mwParserApi.GetContainerAsync(wikiArticle); }
public ArchetypeThumbnail(IWikiArticle wikiArticle, IHtmlWebPage htmlWebPage, IConfig config) { _wikiArticle = wikiArticle; _htmlWebPage = htmlWebPage; _config = config; }
public void SetUp() { _sut = new WikiArticle(_domainUrl); }
public CardSectionProcessor(IWikiArticle wikiArticle) { _wikiArticle = wikiArticle; }
public void SetUp() { _wikiArticle = Substitute.For <IWikiArticle>(); _sut = new ArchetypeThumbnail(_wikiArticle, Substitute.For <IHtmlWebPage>(), Substitute.For <IOptions <AppSettings> >()); }
public ArchetypeThumbnail(IWikiArticle wikiArticle, IHtmlWebPage htmlWebPage, IOptions <AppSettings> appsettings) { _wikiArticle = wikiArticle; _htmlWebPage = htmlWebPage; _appsettings = appsettings; }
public ArticleContainer CreateArticleContainer(IWikiData rawData, IWikiArticle article, Node startNode, Node endNode) { return(new ArticleContainer(rawData, article, startNode, endNode)); }
public async Task <IWikiContainer <IWikiArticle> > GetContainerAsync(IWikiArticle wikiArticle) { var articleRoot = await GetArticleMwRootAsync(wikiArticle); return(await GetContainerAsync(wikiArticle, articleRoot)); }