public void GetEventTest_NullObjectNullReferenceException()
        {
            CreateReflector reflector = new CreateReflector();

            object obj = null;
            var    eve = obj.GetEvent <Product>("Event");
        }
        public void AddEventHandlerTest_FunctionCallArgumentException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChanged").AddToEventHandler(obj, func);
        }
        public void CreateTest_Object()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Object>();

            Assert.IsNotNull(obj);
        }
        public void AddEventHandlerTest_NullObjectNullReferenceException()
        {
            CreateReflector reflector = new CreateReflector();

            object obj = null;

            obj.GetEvent <Product>("PriceChanged").AddToEventHandler(obj, action);
        }
        public void CreateTest_MulticastDelegateCallNotSupportedException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <MulticastDelegate>();

            Assert.IsNotNull(obj);
        }
        public void AddEventHandlerTest_BadEventCallNullReferenceException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChhanged").AddToEventHandler(obj, action);
        }
        public void CreateInstTest_IgnoreAttribute()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <IgnoreAttribute>();

            Assert.IsNotNull(obj);
        }
        public void CreateTest_StringCallMissingMethodException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <string>();

            Assert.IsNotNull(obj);
        }
        public void CreateInstTes_ValueType()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <ValueType>();

            Assert.IsNotNull(obj);
        }
        public void GetPropertyTest_BadNameBackNullProperty()
        {
            CreateReflector reflector = new CreateReflector();

            var prop = reflector.Create <Product>().GetProperty <Product>("Priice");

            Assert.IsNull(prop);
        }
        public void CreateTest_Random()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Random>();

            Assert.IsNotNull(obj);
        }
        public void GetEventTest_NullNameArgumentNullException()
        {
            CreateReflector reflector = new CreateReflector();

            string name = null;

            var obj = reflector.Create <Product>();
            var eve = obj.GetEvent <Product>(name);
        }
        public void GetPropertyTest_NullObjectCallNullReferenceException()
        {
            CreateReflector reflector = new CreateReflector();

            object obj  = null;
            var    prop = obj.GetProperty <Product>("Price");

            Assert.IsNotNull(prop);
        }
        public void GetPropertyTest_GoodName()
        {
            CreateReflector reflector = new CreateReflector();

            var obj  = reflector.Create <Product>();
            var prop = obj.GetProperty <Product>("Price");

            Assert.IsNotNull(prop);
        }
        public void GetEventTest_GoodPropertyName()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();
            var eve = obj.GetEvent <Product>("PriceChanged");

            Assert.IsNotNull(eve);
        }
        public void GetEventTest_BadPropertyNameBackNullEvent()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();
            var eve = obj.GetEvent <Product>("PrizeChanged");

            Assert.IsNull(eve);
        }
        public void SetNewValueTest_BadTargetIsTargetException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChanged").AddEventHandler(obj, action);
            obj.GetProperty <Product>("Price").SetNewValue(this, 56);
        }
        public void SetNewValueTest_GoodDecimal()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChanged").AddEventHandler(obj, action);
            obj.GetProperty <Product>("Price").SetNewValue(obj, 56);
        }
        public void GetPropertyTest_EmptyNameGetNullPrpterty()
        {
            CreateReflector reflector = new CreateReflector();

            string name = "";

            var prop = reflector.Create <Product>().GetProperty <Product>(name);

            Assert.IsNull(prop);
        }
        public void GetPropertyTest_BadNameCallArgumentNullException()
        {
            CreateReflector reflector = new CreateReflector();

            string name = null;

            var prop = reflector.Create <Product>().GetProperty <Product>(name);

            Assert.IsNotNull(prop);
        }
        public void AddEventHandlerTest()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChanged").AddEventHandler(obj, action);

            obj.Price = 10000;
        }
        public void GetEventTest_EmptyNameIsNullProperty()
        {
            CreateReflector reflector = new CreateReflector();

            string name = "";

            var obj = reflector.Create <Product>();
            var eve = obj.GetEvent <Product>(name);

            Assert.IsNull(eve);
        }
        public void SetNewValueTest_NullTargetCallTargetException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChanged").AddEventHandler(obj, action);
            PropertyInfo prop = obj.GetProperty <Product>("Price");

            prop.SetNewValue(null, 56);
        }
        public void SetNewValueTest_NullPropertyCallNullReferenceException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            obj.GetEvent <Product>("PriceChanged").AddToEventHandler(obj, action);
            PropertyInfo prop = null; //obj.GetProperty<Product>("Price");

            prop.SetNewValue(obj, 56);
        }
        public void SetNewValueTest_BadObjectTargetCallTargetException()
        {
            CreateReflector reflector = new CreateReflector();

            var obj = reflector.Create <Product>();

            var eve = obj.GetEvent <Product>("PriceChanged");

            eve.AddToEventHandler(obj, action);
            PropertyInfo prop = obj.GetProperty <Product>("Price");

            prop.SetNewValue(new object(), 56);
        }