Fake PropertyInfo for testing reflection code e.g. binding, Smooth, testability.
상속: System.Reflection.PropertyInfo
 public void Test_Construct_WithPropInfor_ShouldSetPropInfo()
 {
     //---------------Set up test pack-------------------
     PropertyInfo propertyInfo = new Habanero.Testability.Helpers.FakePropertyInfo();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);
     //---------------Test Result -----------------------
     Assert.IsNotNull(propDescriptor);
     Assert.AreSame(propertyInfo, propDescriptor.GetPropertyInfo());
 }
        public void Test_Construct_WithPropInfor_ShouldSetPropInfo()
        {
            //---------------Set up test pack-------------------
            PropertyInfo propertyInfo = new Habanero.Testability.Helpers.FakePropertyInfo();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);

            //---------------Test Result -----------------------
            Assert.IsNotNull(propDescriptor);
            Assert.AreSame(propertyInfo, propDescriptor.GetPropertyInfo());
        }
 public void Test_Construct_WithPropInfo_ShouldSetName()
 {
     //---------------Set up test pack-------------------
     var propName = GetRandomString();
     PropertyInfo propertyInfo = new FakePropertyInfo(propName);
     //---------------Assert Precondition----------------
     Assert.AreEqual(propName, propertyInfo.Name);
     //---------------Execute Test ----------------------
     var propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);
     //---------------Test Result -----------------------
     Assert.AreEqual(propName, propDescriptor.Name);
 }
        public void Test_GetValue_WhenComponentNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            var propertyInfo = new FakePropertyInfo();
            PropertyDescriptorPropInfo propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);
            object x = null;
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            try
            {
                propDescriptor.GetValue(x);
                Assert.Fail("Expected to throw an ArgumentNullException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentNullException ex)
            {
                StringAssert.Contains("component", ex.ParamName);
                StringAssert.Contains("Value cannot be null.", ex.Message);
            }
        }
 public void Test_ComponentType_ShouldReturnGridColumnsClassDefsClassType()
 {
     //---------------Set up test pack-------------------
     var propertyInfo = new FakePropertyInfo();
     var expectedComponentType = typeof (FakeBO);
     propertyInfo.SetReflectedType(expectedComponentType);
     PropertyDescriptorPropInfo propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);
     //---------------Assert Precondition----------------
     Assert.IsNotNull(propertyInfo.ReflectedType);
     //---------------Execute Test ----------------------
     var componentType = propDescriptor.ComponentType;
     //---------------Test Result -----------------------
     Assert.AreSame(expectedComponentType, componentType);
 }
        public void Test_PropertyType_ShouldReturnPropertyTypePropInfo()
        {
            //---------------Set up test pack-------------------
            var expectedPropType = typeof(int);
            var propertyInfo = new FakePropertyInfo(GetRandomString(), expectedPropType);

            PropertyDescriptorPropInfo propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);
            //---------------Assert Precondition----------------
            Assert.AreEqual(expectedPropType, propertyInfo.PropertyType);
            //---------------Execute Test ----------------------
            var propertyType = propDescriptor.PropertyType;
            //---------------Test Result -----------------------
            Assert.AreEqual(expectedPropType, propertyType);
        }
 public void Test_DisplayName_ShouldBePropertyName_CamelCaseDelimited()
 {
     //---------------Set up test pack-------------------
     const string propName = "ThisIsCamelCased";
     var propertyInfo = new FakePropertyInfo(propName);
     PropertyDescriptor propDescriptor = new PropertyDescriptorPropInfoSpy(propertyInfo);
     //---------------Assert Precondition----------------
     Assert.AreEqual(propName, propertyInfo.Name);
     //---------------Execute Test ----------------------
     var actualPropDescriptorDisplayName = propDescriptor.DisplayName;
     //---------------Test Result -----------------------
     Assert.AreEqual("This Is Camel Cased", actualPropDescriptorDisplayName);
 }