public async Task It_ShouldGetCorrectResult() { var crawler = new ZojSubmissionCrawler(_loggerMock); var messages = new BufferBlock <CrawlerMessage>(new DataflowBlockOptions { EnsureOrdered = true, }); #pragma warning disable 4014 crawler.WorkAsync(null, messages, new CancellationToken()); #pragma warning restore 4014 const int bufferLength = 110; var list = new Submission?[bufferLength]; for (var i = 0; i < bufferLength; i++) { var message = await messages.ReceiveAsync(TimeSpan.FromSeconds(30)); message.CrawlerError.Should().BeNull(); message.Checkpoint.Should().BeTrue(); list[i] = message.Submission; } Snapshot.Match(list); }
public async Task It_ShouldGetCorrectResult() { var crawler = new ZojSubmissionCrawler(_loggerMock); var submissionBuffer = new BufferBlock <Submission>(new DataflowBlockOptions { EnsureOrdered = true, }); #pragma warning disable 4014 crawler.WorkAsync(null, submissionBuffer, Mock.Of <ITargetBlock <CrawlerError> >(), new CancellationToken()); #pragma warning restore 4014 const int bufferLength = 110; var list = new Submission[bufferLength]; for (var i = 0; i < bufferLength; i++) { list[i] = await submissionBuffer.ReceiveAsync(); } Snapshot.Match(list); }