Esempio n. 1
0
        /// <summary>
        /// Populates an object's properties with random values.
        /// </summary>
        /// <typeparam name="T"><see cref="Type"/> of <see cref="object"/> to populate.</typeparam>
        /// <param name="obj"><see cref="object"/> to populate with random values.</param>
        public static void PopulateObjectWithRandomValues<T>(T obj)
        {
            if (typeof(IList).IsAssignableFrom(obj.GetType()))
            {
                PopulateListWithRandomValues((IList)obj);
            }
            else
            {
                // Populates all of the readwrite properties including values, classes and lists with values.
                PopulatePropertiesWithRandomValues(obj, PropertyUtilities.GetListOfReadWriteProperties(obj));

                // populates all of the readonly classes and lists with values.
                PopulatePropertiesWithRandomValues(obj, PropertyUtilities.GetListOfProperties(obj.GetType(), false, true, true, false, true, true));
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Tests that all properties within an object raise the <see cref="PropertyChangedEventHandler"/>.
 /// </summary>
 /// <typeparam name="T">Type that implements <see cref="INotifyPropertyChanged"/>.</typeparam>
 /// <param name="obj">Object to test.</param>
 public static void NotifiesPropertiesChanged <T>(T obj) where T : INotifyPropertyChanged
 {
     NotifiesPropertiesChanged(obj, PropertyUtilities.GetListOfReadWriteProperties(obj));
 }
Esempio n. 3
0
 /// <summary>
 /// Test that an object's property values can be changed.
 /// </summary>
 /// <typeparam name="T">Type to test properties.</typeparam>
 /// <param name="obj">Object with properties to test properties.</param>
 public static void ChangesValues <T>(T obj)
 {
     ChangesValues(obj, PropertyUtilities.GetListOfReadWriteProperties(obj));
 }