<commit_before>using System;
using System.IO;
using FubuTestingSupport;
using NUnit.Framework;

namespace TikaOnDotNet.Tests
{
	[TestFixture]
	public class text_extraction
	{
		private TextExtractor _cut;

		[SetUp]
		public virtual void SetUp()
		{
			_cut = new TextExtractor();
		}

		[Test]
		public void non_existing_files_should_fail_with_exception()
		{
			const string fileName = "files/doesnotexist.mp3";

			typeof(TextExtractionException).ShouldBeThrownBy(() => _cut.Extract(fileName))
				.Message.ShouldContain(fileName);
		}

		[Test]
		public void non_existing_uri_should_fail_with_exception()
		{
			const string uri = "http://example.com/does/not/really/exist/mp3/repo/zzzarble.mp3";

			typeof(TextExtractionException).ShouldBeThrownBy(() => _cut.Extract(new Uri(uri)));
		}

		[Test]
		public void should_extract_mp4()
		{
			var textExtractionResult = _cut.Extract("files/badgers.mp4");

			textExtractionResult.ContentType.ShouldEqual("video/mp4");

			var fileInfo = new FileInfo(@"C:\projects\tikaondotnet\src\TikaOnDotNet.Tests\bin\Debug\files\badgers.mp4");
			fileInfo.Delete();
			fileInfo.Exists.ShouldBeFalse();
		}

		[Test]
		public void extract_by_filepath_should_add_filepath_to_metadata()
		{
			const string filePath = "files/apache.jpg";

			var textExtractionResult = _cut.Extract(filePath);

			textExtractionResult.Metadata["FilePath"].ShouldEqual(filePath);<commit_msg>Make Issue #11 test explict<commit_after>using System;
using System.IO;
using FubuTestingSupport;
using NUnit.Framework;

namespace TikaOnDotNet.Tests
{
	[TestFixture]
	public class text_extraction
	{
		private TextExtractor _cut;

		[SetUp]
		public virtual void SetUp()
		{
			_cut = new TextExtractor();
		}

		[Test]
		public void non_existing_files_should_fail_with_exception()
		{
			const string fileName = "files/doesnotexist.mp3";

			typeof(TextExtractionException).ShouldBeThrownBy(() => _cut.Extract(fileName))
				.Message.ShouldContain(fileName);
		}

		[Test]
		public void non_existing_uri_should_fail_with_exception()
		{
			const string uri = "http://example.com/does/not/really/exist/mp3/repo/zzzarble.mp3";

			typeof(TextExtractionException).ShouldBeThrownBy(() => _cut.Extract(new Uri(uri)));
		}

		[Test]
		public void should_extract_mp4()
		{
			var textExtractionResult = _cut.Extract("files/badgers.mp4");

			textExtractionResult.ContentType.ShouldEqual("video/mp4");
		}

		[Test, Explicit("Issue #11")]
		public void should_be_able_to_delete_the_mp4_after_extraction()
		{
			_cut.Extract("files/badgers.mp4");

			var fileInfo = new FileInfo(@"C:\projects\tikaondotnet\src\TikaOnDotNet.Tests\bin\Debug\files\badgers.mp4");
			fileInfo.Delete();
			fileInfo.Exists.ShouldBeFalse();
		}


		[Test]
		public void extract_by_filepath_should_add_filepath_to_metadata()
		{
			const string filePath = "files/apache.jpg";

			var textExtractionResult = _cut.Extract(filePath);

			textExtractionResult.Metadata["FilePath"].ShouldEqual(filePath);
{'fraction_non_alphanumeric': 0.11853593015446609, 'fraction_numerical': 0.006715916722632639, 'mean_word_length': 4.934262948207171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5145778', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1011, 'n_words': 156}