/// <summary> /// Decorates a test class instance with the unit test framework's /// specific test context capability, if supported. /// </summary> /// <param name="instance">Instance to decorate.</param> public void DecorateInstance(object instance) { if (instance == null) { return; } Type t = instance.GetType(); PropertyInfo pi = t.GetProperty(ContextPropertyName, BindingFlags.Public | BindingFlags.Instance); if (pi != null && pi.CanWrite) { var statLightTestContext = new StatLightTestContext(this); pi.SetValue(instance, statLightTestContext, null); } }
/// <summary> /// Decorates a test class instance with the unit test framework's /// specific test context capability, if supported. /// </summary> /// <param name="instance">Instance to decorate.</param> public void DecorateInstance(object instance) { if (instance == null) { return; } Type t = instance.GetType(); PropertyInfo pi = t.GetProperty(ContextPropertyName, BindingFlags.Public | BindingFlags.Instance); if (pi != null && pi.CanWrite) { var statLightTestContext = new StatLightTestContext(this); pi.SetValue(instance, statLightTestContext, null); } }