//
// ActivatorTest.cs - NUnit Test Cases for System.Activator
//
// Authors:
//	Nick Drochak <ndrochak@gol.com>
//	Gert Driesen <drieseng@users.sourceforge.net>
//	Sebastien Pouliot  <sebastien@ximian.com>
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit not supported for TARGET_JVM
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Security;
using System.Security.Permissions;
using NUnit.Framework;
// The class in this namespace is used by the main test class
namespace MonoTests.System.ActivatorTestInternal {
	// We need a COM class to test the Activator class
	[ComVisible (true)]
	public class COMTest : MarshalByRefObject {
		private int id;
		public bool constructorFlag = false;
		public COMTest ()
		{
			id = 0;
		}
		public COMTest (int id)
		{
			this.id = id;
		}
		// This property is visible
		[ComVisible (true)]
		public int Id {
			get { return id; }
			set { id = value; }
		}
	}
	[ComVisible (false)]
	public class NonCOMTest : COMTest {
	}
}
namespace MonoTests.System {
	using MonoTests.System.ActivatorTestInternal;
	class CustomUserType : Type
	{
		public override Assembly Assembly
		{
			get { throw new NotImplementedException (); }
		}
		public override string AssemblyQualifiedName
		{
			get { throw new NotImplementedException (); }
		}
		public override Type BaseType
		{
			get { throw new NotImplementedException (); }
		}
		public override string FullName
		{
			get { throw new NotImplementedException (); }
		}
		public override Guid GUID
		{
			get { throw new NotImplementedException (); }
		}
		protected override TypeAttributes GetAttributeFlagsImpl ()
		{
			throw new NotImplementedException ();
		}
		protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
		{
			throw new NotImplementedException ();
		}
		public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override Type GetElementType ()
		{
			throw new NotImplementedException ();
		}
		public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override EventInfo[] GetEvents (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override FieldInfo GetField (string name, BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override FieldInfo[] GetFields (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override Type GetInterface (string name, bool ignoreCase)
		{
			throw new NotImplementedException ();
		}
		public override Type[] GetInterfaces ()
		{
			throw new NotImplementedException ();
		}
		public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
		{
			throw new NotImplementedException ();
		}
		public override MethodInfo[] GetMethods (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override Type GetNestedType (string name, BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override Type[] GetNestedTypes (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		public override PropertyInfo[] GetProperties (BindingFlags bindingAttr)
		{
			throw new NotImplementedException ();
		}
		protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
		{
			throw new NotImplementedException ();
		}
		protected override bool HasElementTypeImpl ()
		{
			throw new NotImplementedException ();
		}
		public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
		{
			throw new NotImplementedException ();
		}
		protected override bool IsArrayImpl ()
		{
			throw new NotImplementedException ();
		}
		protected override bool IsByRefImpl ()
		{
			throw new NotImplementedException ();
		}
		protected override bool IsCOMObjectImpl ()
		{
			throw new NotImplementedException ();
		}
		protected override bool IsPointerImpl ()
		{
			throw new NotImplementedException ();
		}
		protected override bool IsPrimitiveImpl ()
		{
			throw new NotImplementedException ();
		}
		public override Module Module
		{
			get { throw new NotImplementedException (); }
		}
		public override string Namespace
		{
			get { throw new NotImplementedException (); }
		}
		public override Type UnderlyingSystemType
		{
			get {
				return this;
			}
		}
		public override object[] GetCustomAttributes (Type attributeType, bool inherit)
		{
			throw new NotImplementedException ();
		}
		public override object[] GetCustomAttributes (bool inherit)
		{
			throw new NotImplementedException ();
		}
		public override bool IsDefined (Type attributeType, bool inherit)
		{
			throw new NotImplementedException ();
		}
		public override string Name
		{
			get { throw new NotImplementedException (); }
		}
	}
	[TestFixture]
	public class ActivatorTest {
		private string testLocation = typeof (ActivatorTest).Assembly.Location;
		[Test]
		public void CreateInstance_Type()
		{
			COMTest objCOMTest = (COMTest) Activator.CreateInstance (typeof (COMTest));
			Assert.AreEqual ("MonoTests.System.ActivatorTestInternal.COMTest", (objCOMTest.GetType ()).ToString (), "#A02");
		}
		[Test]
		[ExpectedException (typeof (ArgumentNullException))]
		public void CreateInstance_TypeNull ()
		{
			Activator.CreateInstance ((Type)null);
		}
		[Test]
		[ExpectedException (typeof (ArgumentException))]
		public void CreateInstance_CustomType ()
		{
			Activator.CreateInstance (new CustomUserType ());
		}
		[Test]
		public void CreateInstance_StringString ()
		{
			ObjectHandle objHandle = Activator.CreateInstance (null, "MonoTests.System.ActivatorTestInternal.COMTest");
			COMTest objCOMTest = (COMTest)objHandle.Unwrap ();
			objCOMTest.Id = 2;
			Assert.AreEqual (2, objCOMTest.Id, "#A03");
		}
		[Test]


Answer: 		[ExpectedException (typeof (ArgumentNullException))]