DataCollectorNotifications 类

由自定义测试适配器用于引发诊断数据适配器事件。

继承层次结构

System.Object
  Microsoft.VisualStudio.TestTools.Execution.DataCollectorNotifications

命名空间:  Microsoft.VisualStudio.TestTools.Execution
程序集:  Microsoft.VisualStudio.QualityTools.ExecutionCommon(在 Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll 中)

语法

声明
Public MustInherit Class DataCollectorNotifications
public abstract class DataCollectorNotifications
public ref class DataCollectorNotifications abstract
[<AbstractClass>]
type DataCollectorNotifications =  class end
public abstract class DataCollectorNotifications

DataCollectorNotifications 类型公开以下成员。

构造函数

  名称 说明
受保护的方法 DataCollectorNotifications 初始化 DataCollectorNotifications 类的新实例。

页首

方法

  名称 说明
公共方法 Equals 确定指定的 Object 是否等于当前的 Object。 (继承自 Object。)
受保护的方法 Finalize 允许对象在“垃圾回收”回收之前尝试释放资源并执行其他清理操作。 (继承自 Object。)
公共方法 GetHashCode 用作特定类型的哈希函数。 (继承自 Object。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
受保护的方法 MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
公共方法 RaiseCustomEvent(CustomNotificationEventArgs) 使用提供的事件参数引发自定义事件。
公共方法 RaiseCustomEvent(CustomNotificationEventArgs, NotificationBroadcastLevel) 使用提供的事件参数和广播级别的指示引发自定义事件。
公共方法 RaiseCustomEventAsync(CustomNotificationEventArgs) 使用提供的事件参数异步引发自定义事件。
公共方法 RaiseCustomEventAsync(CustomNotificationEventArgs, NotificationBroadcastLevel) 使用提供的事件参数和广播级别的指示异步引发自定义事件。
公共方法 RaiseCustomEventAsync(CustomNotificationEventArgs, NotificationBroadcastLevel, Object) 使用提供的事件参数、广播级别的指示和用户标记异步引发自定义事件。
公共方法 RaiseTestFailedEvent 引发 TestCaseFailed 事件,以将测试用例已失败的情况通知给诊断数据适配器。
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)

页首

事件

  名称 说明
公共事件 CustomEventCompleted 当诊断数据适配器完成异步事件的处理时由测试框架引发。

页首

示例

若要在自定义测试适配器类中使用 DataCollectorNotifications 对象,首先将 IDataCollectionAwareTestAdapter 添加到派生测试适配器的类声明中。

public class MyTestAdapter : ITestAdapter, IDataCollectionAwareTestAdapter

然后在测试适配器代码中创建 DataCollectors 属性,该属性返回 DataCollectorNotifications 对象。

public DataCollectorNotifications DataCollectors { get; set; }

然后,您可以使用此对象引发诊断数据适配器事件。

DataCollectors.RaiseCustomEvent(
    new MyCustomDataEventArgs(), 
    NotificationBroadCastLevel.All);

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参见

参考

Microsoft.VisualStudio.TestTools.Execution 命名空间

DataCollectors

ITestAdapter

DataCollector

DataCollectorNotifications

其他资源

创建诊断数据适配器以收集自定义数据或影响测试计算机