public void SetCollectionTypeFactoryClassByName()
		{
			string nullName = null;
			var bcp = new BytecodeProviderImpl();

			Assert.Throws<ArgumentNullException>(() => bcp.SetCollectionTypeFactoryClass(nullName));
			Assert.Throws<ArgumentNullException>(() => bcp.SetCollectionTypeFactoryClass(string.Empty));
			Assert.Throws<TypeLoadException>(() => bcp.SetCollectionTypeFactoryClass("whatever"));
		}
		public void DoesNotImplementProxyFactoryFactory()
		{
			try
			{
				var bcp = new BytecodeProviderImpl();
				bcp.SetProxyFactoryFactory(GetType().AssemblyQualifiedName);
				Assert.Fail();
			}
			catch (HibernateByteCodeException e)
			{
				Assert.That(e.Message,
										Is.EqualTo(GetType().FullName + " does not implement " + typeof(IProxyFactoryFactory).FullName));
			}
		}
		public void CantCreateProxyFactoryFactory()
		{
			try
			{
				var bcp = new BytecodeProviderImpl();
				bcp.SetProxyFactoryFactory(typeof(WrongProxyFactoryFactory).AssemblyQualifiedName);
				IProxyFactoryFactory p = bcp.ProxyFactoryFactory;
				Assert.Fail();
			}
			catch (HibernateByteCodeException e)
			{
				Assert.That(e.Message,Is.StringStarting("Failed to create an instance of"));
			}
		}
		public void NotConfiguredProxyFactoryFactory()
		{
			try
			{
				var bcp = new BytecodeProviderImpl();
				IProxyFactoryFactory p = bcp.ProxyFactoryFactory;
				Assert.Fail();
			}
			catch (HibernateByteCodeException e)
			{
				Assert.That(e.Message, Text.StartsWith("The ProxyFactoryFactory was not configured"));
				Assert.That(e.Message, Text.Contains("Example"));
			}			
		}
		public void UnableToLoadProxyFactoryFactory()
		{
			try
			{
				var bcp = new BytecodeProviderImpl();
				bcp.SetProxyFactoryFactory("whatever");
				Assert.Fail();
			}
			catch (HibernateByteCodeException e)
			{
				Assert.That(e.Message, Is.StringStarting("Unable to load type"));
				Assert.That(e.Message, Is.StringContaining("Possible causes"));
				Assert.That(e.Message, Is.StringContaining("Confirm that your deployment folder contains"));
			}
		}
		public void SetCollectionTypeFactoryClassByType()
		{
			System.Type nullType = null;
			var bcp = new BytecodeProviderImpl();
			Assert.Throws<ArgumentNullException>(() => bcp.SetCollectionTypeFactoryClass(nullType));
			Assert.Throws<HibernateByteCodeException>(() => bcp.SetCollectionTypeFactoryClass(GetType()), "should allow only ICollectionTypeFactory type");
		}
		public void NotConfiguredCollectionTypeFactory()
		{
			// our BytecodeProvider should ever have a CollectionTypeFactory
			var bcp = new BytecodeProviderImpl();
			Assert.That(bcp.CollectionTypeFactory, Is.Not.Null);
		}
		public void ShouldNotThrownAnExceptionWithTheSameTypeOfCollectionTypeFactory()
		{
			ICollectionTypeFactory ctf;
			var bcp = new BytecodeProviderImpl();
			ctf = bcp.CollectionTypeFactory; // initialize the instance
			Assert.DoesNotThrow(() => bcp.SetCollectionTypeFactoryClass(typeof (Type.DefaultCollectionTypeFactory)));
		}
		public void NotConfiguredProxyFactoryFactory()
		{
			var bcp = new BytecodeProviderImpl();
			IProxyFactoryFactory p = bcp.ProxyFactoryFactory;
			p.Should().Be.InstanceOf<DefaultProxyFactoryFactory>();
		}
		public void CollectionTypeFactoryCantChangeAfterUsage()
		{
			ICollectionTypeFactory ctf;
			var bcp = new BytecodeProviderImpl();
			ctf = bcp.CollectionTypeFactory; // initialize the instance
			// try to set it
			Assert.Throws<InvalidOperationException>(() => bcp.SetCollectionTypeFactoryClass(typeof(CustomCollectionTypeFactory)));
		}
		public void InvalidCollectionTypeFactoryCtor()
		{
			ICollectionTypeFactory ctf;
			var bcp = new BytecodeProviderImpl();
			bcp.SetCollectionTypeFactoryClass(typeof (NoDefaultCtor));
			Assert.Throws<HibernateByteCodeException>(() => ctf = bcp.CollectionTypeFactory);
		}
		public void NotConfiguredProxyFactoryFactory()
		{
			var bcp = new BytecodeProviderImpl();
			IProxyFactoryFactory p = bcp.ProxyFactoryFactory;
			Assert.That(p, Is.InstanceOf<DefaultProxyFactoryFactory>());
		}