<commit_before>﻿using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;

namespace AppHarbor.Tests
{
	public class TypeNameMatcherTest
	{
		interface IFoo
		{
		}

		class Foo : IFoo { }

		[Fact]
		public void ShouldThrowIfInitializedWithUnnasignableType()
		{
			var exception = Assert.Throws<ArgumentException>(() => new TypeNameMatcher<IFoo>(new List<Type> { typeof(string) }));
		}

		[Theory]
		[InlineData("Foo", typeof(Foo))]
		[InlineData("foo", typeof(Foo))]
		public void ShouldGetTypeStartingWithCommandName(string commandName, Type fooType)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { fooType });
			Assert.Equal(fooType, matcher.GetMatchedType(commandName));
		}

		[Theory]
		[InlineData("Bar", typeof(Foo))]
		public void ShouldThrowWhenNoTypesMatches(string commandName, Type fooType)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { fooType });
			Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName));
		}
	}<commit_msg>Move foo type to static member<commit_after>﻿using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;

namespace AppHarbor.Tests
{
	public class TypeNameMatcherTest
	{
		interface IFoo
		{
		}

		class Foo : IFoo { }

		private static Type FooType = typeof(Foo);

		[Fact]
		public void ShouldThrowIfInitializedWithUnnasignableType()
		{
			var exception = Assert.Throws<ArgumentException>(() => new TypeNameMatcher<IFoo>(new List<Type> { typeof(string) }));
		}

		[Theory]
		[InlineData("Foo")]
		[InlineData("foo")]
		public void ShouldGetTypeStartingWithCommandName(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
			Assert.Equal(FooType, matcher.GetMatchedType(commandName));
		}

		[Theory]
		[InlineData("Bar")]
		public void ShouldThrowWhenNoTypesMatches(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
			Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName));
		}
	}
{'fraction_non_alphanumeric': 0.12364532019704433, 'fraction_numerical': 0.0, 'mean_word_length': 5.230061349693251, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '3301952', 'n_tokens_mistral': 725, 'n_tokens_neox': 647, 'n_words': 133}