public void NoMatchConstructor()
        {
            IObjectFactory objectFactory = new ObjectFactory(true);

            IFactory factory = objectFactory.CreateFactory(typeof(ItemBis), Type.EmptyTypes);

            object obj = factory.CreateInstance(null);
        }
		public void AbstractConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			IFactory factory = objectFactory.CreateFactory(typeof (Document), Type.EmptyTypes );

            object obj = factory.CreateInstance(null);
		}
		public void PrivateConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			IFactory factory = objectFactory.CreateFactory(typeof (Order), Type.EmptyTypes );

			object obj = factory.CreateInstance(null);
		}
		public void DevivedClassConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			IFactory factory = objectFactory.CreateFactory(typeof (Book), Type.EmptyTypes );

			Assert.IsNotNull(factory);
		}
        public void AbstractConstructor()
        {
            IObjectFactory objectFactory = new ObjectFactory(true);

            IFactory factory = objectFactory.CreateFactory(typeof (Document), Type.EmptyTypes );

            Assert.Throws<ProbeException>(delegate { object obj = factory.CreateInstance(null); });
        }
		public void ProtectedConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			IFactory factory = objectFactory.CreateFactory(typeof (Item), Type.EmptyTypes );

			object obj = factory.CreateInstance(null);

			Assert.IsTrue(obj is Item);
		}
		public void ClassWithMultipleConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			Type[] types = {typeof(string)};
			IFactory factory0 = objectFactory.CreateFactory(typeof (Account), types );

			object[] parameters = {"gilles"};
			object obj0 = factory0.CreateInstance(parameters);

			Assert.IsTrue(obj0 is Account);
			Account account = (Account)obj0;
			Assert.AreEqual("gilles", account.Test);

			IFactory factory1 = objectFactory.CreateFactory(typeof (Account), Type.EmptyTypes );

			object obj1 = factory1.CreateInstance(parameters);

			Assert.IsTrue(obj1 is Account);
		}
        public void ClassConstructor()
        {
            IObjectFactory objectFactory = new ObjectFactory(true);

            Type[] types = {typeof(Property)};
            IFactory factory = objectFactory.CreateFactory(typeof (Account), types );

            object[] parameters = new object[1];
            Property prop = new Property();
            prop.String = "Gilles";
            parameters[0] = prop;
            object obj = factory.CreateInstance(parameters);

            Assert.IsTrue(obj is Account);
            Account account = (Account)obj;
            Assert.IsNotNull(account.Property);
            Assert.AreEqual( "Gilles", account.Property.String);
        }
        public void ArrayParamConstructor()
        {
            IObjectFactory objectFactory = new ObjectFactory(true);

            Type[] types = { typeof(int[]) };
            IFactory factory = objectFactory.CreateFactory(typeof(Account), types);

            object[] parameters = new object[1];

            int[] ids = new int[2];
            ids[0] = 1;
            ids[1] = 2;

            parameters[0] = ids;
            object obj = factory.CreateInstance(parameters);

            Assert.IsTrue(obj is Account);
            Account account = (Account)obj;

            Assert.AreEqual(2, account.Ids.Length);
            Assert.AreEqual(1, account.Ids[0]);
            Assert.AreEqual(2, account.Ids[1]);
        }
		public void StringConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			Type[] types = {typeof(string)};
			IFactory factory = objectFactory.CreateFactory(typeof (Account), types );

			object[] parameters = {"gilles"};
			object obj = factory.CreateInstance(parameters);

			Assert.IsTrue(obj is Account);
			Account account = (Account)obj;
			Assert.AreEqual("gilles", account.Test);
		}
		public void DynamicFactoryCreatesTypes()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			IFactory factory = objectFactory.CreateFactory(typeof (Account), Type.EmptyTypes);
			object obj = factory.CreateInstance(null);
			Assert.IsTrue(obj is Account);

			factory = objectFactory.CreateFactory(typeof (Account), Type.EmptyTypes);
			obj = factory.CreateInstance(Type.EmptyTypes);
			Assert.IsTrue(obj is Account);

			factory = objectFactory.CreateFactory(typeof (Simple), Type.EmptyTypes);
			obj = factory.CreateInstance(Type.EmptyTypes);
			Assert.IsTrue(obj is Simple);
		}
		public void DateTimeConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			Type[] types = {typeof(DateTime)};
			IFactory factory = objectFactory.CreateFactory(typeof (Account), types );

			object[] parameters = new object[1];
			DateTime date = DateTime.Now;
			parameters[0] = date;
			object obj = factory.CreateInstance(parameters);

			Assert.IsTrue(obj is Account);
			Account account = (Account)obj;
			Assert.AreEqual( date, account.Date);
		}
		public void EnumConstructorEnum()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			Type[] types = {typeof(Days)};
			IFactory factory = objectFactory.CreateFactory(typeof (Account), types );

			object[] parameters = new object[1];
			parameters[0] = Days.Sun;
			object obj = factory.CreateInstance(parameters);

			Assert.IsTrue(obj is Account);
			Account account = (Account)obj;
			Assert.AreEqual( Days.Sun, account.Days);
		}
		public void IntConstructor()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			Type[] types = {typeof(int)};
			IFactory factory = objectFactory.CreateFactory(typeof (Account), types );

			object[] parameters = new object[1];
			parameters[0] = -55;
			object obj = factory.CreateInstance(parameters);

			Assert.IsTrue(obj is Account);
			Account account = (Account)obj;
			Assert.AreEqual( -55, account.Id);
		}
		public void MultipleParamConstructor1()
		{
			IObjectFactory objectFactory = new ObjectFactory(true);

			Type[] types = {typeof(string)};
			IFactory factory = objectFactory.CreateFactory(typeof (Account), types );

			object[] parameters = new object[1];
			parameters[0] = null;
			object obj = factory.CreateInstance(parameters);

			Assert.IsTrue(obj is Account);
			Account account = (Account)obj;
			Assert.AreEqual(null, account.Test);
		}