示例#1
0
        public async Task RunAsync_throws_if_document_deletion_fails()
        {
            var expectedException = new Exception();

            _httpDocument.DeleteAsync().Throws(expectedException);
            var source = Observable.Return(new TestDocument(Generate.Bytes()));

            var pipeline = _sut
                           .WithDocumentsFrom(source);
            var actualException = await Assert.ThrowsAsync <Exception>(() => pipeline.RunAsync());

            Assert.Same(expectedException, actualException);
        }
示例#2
0
        public PipelineFacts()
        {
            _httpDocument = Substitute.For <IHttpDocument>();
            _httpDocument.ClassifyAsync(Arg.Any <string>()).Returns(new ClassificationResult());
            _httpDocument.ExtractAsync(Arg.Any <string>()).Returns(new ExtractionResults());
            _httpDocument.DeleteAsync();

            _documentFactory
            .CreateDocumentAsync(Arg.Any <Document>())
            .Returns(_httpDocument);

            _sut = new Pipeline(_documentFactory, 10);
        }