示例#1
0
        public void Extract_From_Stream_And_ContentType_NoException()
        {
            var fileStream = File.OpenRead($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}/assets/example.{_fileExtension}");

            using (var extractor = Extractor.Open(fileStream, ContentTypeExtractor.Extract(fileStream.Name)))
            {
                var text = extractor.Extract();
                Assert.False(string.IsNullOrEmpty(text));
            }
        }
示例#2
0
        public async Task Extract_From_Stream_And_ContentType_Async_Missing_Exception()
        {
            var ex = await Record.ExceptionAsync(() =>
            {
                var fileStream = File.OpenRead($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}/assets/missing.{_fileExtension}");

                using (var extractor = Extractor.Open(fileStream, ContentTypeExtractor.Extract(fileStream.Name)))
                {
                    return(extractor.ExtractAsync());
                }
            });

            Assert.NotNull(ex);
        }