<commit_before>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;

namespace ErrorHandling
{
	public class CommonExceptions: IDisposable
	{
		[Test]
		[ExpectedException(typeof (InvalidOperationException))]
		public void InvalidOperation()
		{
			var list = new List<object> {"a"};
			foreach (var item in list)
			{
				list.Add(item);
			}
		}

		[Test]
		[ExpectedException(typeof(ArgumentOutOfRangeException))]
		public void ArgumentOutOfRange()
		{
			var list = new List<object>();
			list.FindIndex(1, o => true);
		}

		[Test]
		[ExpectedException(typeof(ArgumentNullException))]
		public void ArgumentNull()
		{
			new Hashtable {{null, "a"}};
		}

		[Test]
		[ExpectedException(typeof(NullReferenceException))]
		public void NullReference()
		{
			object obj = null;
			obj.ToString();
		}

		[Test]
		[ExpectedException(typeof(IndexOutOfRangeException))]
		public void IndexOutOfRange()
		{
			var list = new object[0];
			var _ = list[0];
		}

		[Test, Ignore("crashes test runner")]
		[ExpectedException(typeof (StackOverflowException))]
		public void StackOverflow()
		{
			StackOverflow();
		}

		[Test]
		[ExpectedException(typeof (OutOfMemoryException))]
		public void OutOfMemory()
		{
			var _ = new decimal[int.MaxValue];
		}

		[Test]
		[ExpectedException(typeof (DivideByZeroException))]
		public void DivideByZero()
		{
			var dividend = 1;
			var divisor = 0;
			var _ = dividend/divisor;
		}

		[Test]
		[ExpectedException(typeof (FileNotFoundException))]
		public void FileNotFound()
		{
			File.Open(Guid.NewGuid().ToString(), FileMode.Open);
		}

		[Test]
		[ExpectedException(typeof (FormatException))]
		public void Format()
		{
			DateTime.Parse("never");
		}

		[Test]
		[ExpectedException(typeof (KeyNotFoundException))]
		public void KeyNotFound()
		{
			var dict = new Dictionary<object, object>();
			var _ = dict[0];
		}

		[Test]
		[ExpectedException(typeof (NotImplementedException))]
		public void NotImplemented()
		{
			Dispose();
		}

		public void Dispose()
		{
			throw new NotImplementedException();
		}

		[Test]
		[ExpectedException(typeof(NotSupportedException))]
		public void NotSupported()
		{
			using (var stream = File.OpenWrite("writeonly"))
			{
				stream.ReadByte();
			}
		}

		[Test]
		[ExpectedException(typeof(ObjectDisposedException))]
		public void ObjectDisposed()
		{
			var stream = File.OpenWrite("writeonly");
			stream.Dispose();
			stream.Flush();
		}

		[Test]
		[ExpectedException(typeof(OverflowException))]
		public void Overflow()
		{
			checked
			{
				var maxValue = int.MaxValue;
				var _ = maxValue * maxValue;
			}
		}

	}
}<commit_msg>nunit tries to hookup to idisposable. prevent said behaviour<commit_after>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;

namespace ErrorHandling
{
	[TestFixture]
	public class CommonExceptions: IEnumerable
	{
		[Test]
		[ExpectedException(typeof (InvalidOperationException))]
		public void InvalidOperation()
		{
			var list = new List<object> {"a"};
			foreach (var item in list)
			{
				list.Add(item);
			}
		}

		[Test]
		[ExpectedException(typeof(ArgumentOutOfRangeException))]
		public void ArgumentOutOfRange()
		{
			var list = new List<object>();
			list.FindIndex(1, o => true);
		}

		[Test]
		[ExpectedException(typeof(ArgumentNullException))]
		public void ArgumentNull()
		{
			new Hashtable {{null, "a"}};
		}

		[Test]
		[ExpectedException(typeof(NullReferenceException))]
		public void NullReference()
		{
			object obj = null;
			obj.ToString();
		}

		[Test]
		[ExpectedException(typeof(IndexOutOfRangeException))]
		public void IndexOutOfRange()
		{
			var list = new object[0];
			var _ = list[0];
		}

		[Test, Ignore("crashes test runner")]
		[ExpectedException(typeof (StackOverflowException))]
		public void StackOverflow()
		{
			StackOverflow();
		}

		[Test]
		[ExpectedException(typeof (OutOfMemoryException))]
		public void OutOfMemory()
		{
			var _ = new decimal[int.MaxValue];
		}

		[Test]
		[ExpectedException(typeof (DivideByZeroException))]
		public void DivideByZero()
		{
			var dividend = 1;
			var divisor = 0;
			var _ = dividend/divisor;
		}

		[Test]
		[ExpectedException(typeof (FileNotFoundException))]
		public void FileNotFound()
		{
			File.Open(Guid.NewGuid().ToString(), FileMode.Open);
		}

		[Test]
		[ExpectedException(typeof (FormatException))]
		public void Format()
		{
			DateTime.Parse("never");
		}

		[Test]
		[ExpectedException(typeof (KeyNotFoundException))]
		public void KeyNotFound()
		{
			var dict = new Dictionary<object, object>();
			var _ = dict[0];
		}

		[Test]
		[ExpectedException(typeof (NotImplementedException))]
		public void NotImplemented()
		{
			GetEnumerator();
		}

		[Test]
		[ExpectedException(typeof(NotSupportedException))]
		public void NotSupported()
		{
			using (var stream = File.OpenWrite("writeonly"))
			{
				stream.ReadByte();
			}
		}

		[Test]
		[ExpectedException(typeof(ObjectDisposedException))]
		public void ObjectDisposed()
		{
			var stream = File.OpenWrite("writeonly");
			stream.Dispose();
			stream.Flush();
		}

		[Test]
		[ExpectedException(typeof(OverflowException))]
		public void Overflow()
		{
			checked
			{
				var maxValue = int.MaxValue;
				var _ = maxValue * maxValue;
			}
		}

		public IEnumerator GetEnumerator()
		{
			throw new NotImplementedException();
		}
	}
}
{'fraction_non_alphanumeric': 0.12133379888268156, 'fraction_numerical': 0.002094972067039106, 'mean_word_length': 3.12455003599712, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6180134', 'n_tokens_mistral': 2144, 'n_tokens_neox': 1759, 'n_words': 369}