/// <summary> /// A Constructor /// </summary> /// <param name="drt">An instance of the DrtBase</param> /// <param name="instance">An instance of the tested object like InkCanvas</param> /// <param name="propertyName">The name of the tested property like EditingMode</param> /// <param name="callback">An instance of the IEventsForwading interface. If not null, the Changed/Changing Events will be forward to the test unit's handler.</param> protected PropertyTestUnit(DrtBase drt, object instance, string propertyName, IEventsForwading callback) : base(drt) { _callback = callback; _instance = instance; _propertyInfo = _instance.GetType().GetProperty(propertyName); _propertyName = propertyName; Drt.Assert(_propertyInfo != null, string.Format("The {0} type doesn't have the property - {1}.", _instance.GetType(), propertyName)); }
public BooleanTypePropertyTest(DrtBase drt, object instance, string propertyName) : base(drt) { _tests = new ArrayList(); TestUnit test; test = new AccessPropertyTest(drt, instance, propertyName, true); _tests.AddRange(test.Tests); test = new AccessPropertyTest(drt, instance, propertyName, false); _tests.AddRange(test.Tests); }
public EnumTypePropertyTest(DrtBase drt, object instance, string propertyName, Type type) : base(drt) { _tests = new ArrayList(); TestUnit test; foreach (int val in Enum.GetValues(type)) { object newValue = Enum.Parse(type, Enum.GetName(type, val)); test = new AccessPropertyTest(drt, instance, propertyName, newValue); _tests.AddRange(test.Tests); } }
public PropertyDefaultValueTest(DrtBase drt, object instance, string propertyName, ValueCheckingCallback callback) : base(drt, instance, propertyName, null) { _callback = callback; }
public PropertyDefaultValueTest(DrtBase drt, object instance, string propertyName, object defaultValue) : base(drt, instance, propertyName, null) { _defaultValue = defaultValue; }
protected TestUnit(DrtBase drt) { _drt = drt; }
/// <summary> /// Constructor /// </summary> /// <param name="drt">An instance of the DrtBase</param> /// <param name="instance">An instance of the tested object</param> /// <param name="propertyName">The property name of the tested property</param> /// <param name="newValue">An invalid value which is set to the property.</param> /// <param name="expectedExceptionType">The exception which the test unit expects</param> public AccessPropertyTest(DrtBase drt, object instance, string propertyName, object newValue, Type expectedExceptionType) : this(drt, instance, propertyName, newValue, null, false) { _expectException = expectedExceptionType; _isInvalidValue = true; }
/// <summary> /// Constructor /// </summary> /// <param name="drt">An instance of the DrtBase</param> /// <param name="instance">An instance of the tested object</param> /// <param name="propertyName">The property name of the tested property</param> /// <param name="newValue">The value which is set to the property.</param> public AccessPropertyTest(DrtBase drt, object instance, string propertyName, object value) : this(drt, instance, propertyName, value, null, false) { }
/// <summary> /// Constructor /// </summary> /// <param name="drt">An instance of the DrtBase</param> /// <param name="instance">An instance of the tested object</param> /// <param name="propertyName">The property name of the tested property</param> /// <param name="newValue">The value which is set to the property.</param> /// <param name="callback">The interface which is used for forwarding events</param> /// <param name="changingCancelling">A flag which indicates whether cancels the changing event.</param> public AccessPropertyTest(DrtBase drt, object instance, string propertyName, object newValue, IEventsForwading callback, bool changingCancelling) : base(drt, instance, propertyName, callback) { _newValue = newValue; _changingCancelling = changingCancelling; }
/// <summary> /// A Constructor /// </summary> /// <param name="drt">An instance of the DrtBase</param> /// <param name="instance">An instance of the tested object like InkCanvas</param> /// <param name="propertyName">The name of the tested property like EditingMode</param> protected PropertyTestUnit(DrtBase drt, object instance, string propertyName) : this(drt, instance, propertyName, null) { }
//------------------------------------------------------------------ // Constructors //------------------------------------------------------------------ /// <summary> /// Constructs a new TraceListner which will publish the events /// to the DrtBase provided. /// </summary> /// <param name="drtBase">The DrtBase to send events to.</param> public TraceAdapter(DrtBase drtBase) { _drtBase = drtBase; }