public async Task Trivial_Test() { var scraper = new TrivialScraper(); var scrapeJob = new GameScrapeContext(new[] { scraper }, new ICuller[] { }); Assert.True(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); Assert.NotEmpty(scrapeJob.Context.GetAllOfType("Test")); Assert.False(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); }
public async Task Group_Test() { var scraper = new GroupScraper(); var scrapeJob = new GameScrapeContext(new IScraper[] { scraper }, new ICuller[] { }); Assert.True(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); Assert.False(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); Assert.NotEmpty(scrapeJob.Context.GetAllOfType("MyGroup")); Assert.NotEmpty(scrapeJob.Context.GetAllOfType("Test")); Assert.NotEmpty(scrapeJob.Context.GetAllOfType("TestTwo")); Assert.Equal(scrapeJob.Context.GetAllOfType("MyGroup").First().Content.Value, scrapeJob.Context.GetAllOfType("Test").First().Content.Value); Assert.NotEmpty(scrapeJob.Context.GetChildren(scrapeJob.Context.GetAllOfType("MyGroup").First())); }
public async Task Dependent_Test() { var scraper = new TrivialScraper(); var dependent = new DependentScraper(); // we make dependent before scraper to allow scrapeJob to resolve // all items after 3 iterations. var scrapeJob = new GameScrapeContext(new IScraper[] { dependent, scraper }, new ICuller[] { }); Assert.True(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); Assert.NotEmpty(scrapeJob.Context.GetAllOfType("Test")); Assert.True(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); Assert.NotEmpty(scrapeJob.Context.GetAllOfType("TestDependent")); Assert.False(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); }
public async Task Exclude_Test() { var scraper = new TrivialScraper(); var exclude = new ExcludeScraper(); var scrapeJob = new GameScrapeContext(new SeedContent[] {}, new IScraper[] { scraper, exclude }, new ICuller[] { }); Assert.True(await scrapeJob.Proceed(Enumerable.Empty <SeedContent>())); Assert.False(await scrapeJob.Proceed(new SeedContent[] { ("ExcludeTest", "Test") }));