ExpectedSqlExceptionAttribute 类
表示一个特性,该特性指定单元测试应有 SqlException,并且需要时可指定错误号、严重级别和预期错误的状态。
继承层次结构
System.Object
System.Attribute
Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionBaseAttribute
Microsoft.Data.Schema.UnitTesting.ExpectedSqlExceptionAttribute
命名空间: Microsoft.Data.Schema.UnitTesting
程序集: Microsoft.Data.Schema.UnitTesting(在 Microsoft.Data.Schema.UnitTesting.dll 中)
语法
声明
Public NotInheritable Class ExpectedSqlExceptionAttribute _
Inherits ExpectedExceptionBaseAttribute
public sealed class ExpectedSqlExceptionAttribute : ExpectedExceptionBaseAttribute
public ref class ExpectedSqlExceptionAttribute sealed : public ExpectedExceptionBaseAttribute
[<Sealed>]
type ExpectedSqlExceptionAttribute =
class
inherit ExpectedExceptionBaseAttribute
end
public final class ExpectedSqlExceptionAttribute extends ExpectedExceptionBaseAttribute
ExpectedSqlExceptionAttribute 类型公开以下成员。
构造函数
名称 | 说明 | |
---|---|---|
ExpectedSqlExceptionAttribute() | 初始化 ExpectedSqlExceptionAttribute 类的新实例。 | |
ExpectedSqlExceptionAttribute(String) | 初始化 ExpectedSqlExceptionAttribute 类的新实例。 |
页首
属性
名称 | 说明 | |
---|---|---|
MatchFirstError | 获取一个值,指示预期的严重级别、状态和错误号要与 SqlException 中的第一个 SqlError 匹配。 | |
MessageNumber | 获取或设置预期的错误号。 | |
NoExceptionMessage | (继承自 ExpectedExceptionBaseAttribute。) | |
Severity | 获取或设置错误的预期严重级别值。 | |
State | 获取或设置错误的预期错误状态。 | |
TestContext | (继承自 ExpectedExceptionBaseAttribute。) | |
TypeId | 当在派生类中实现时,获取该 Attribute 的唯一标识符。 (继承自 Attribute。) |
页首
方法
名称 | 说明 | |
---|---|---|
Equals | 基础结构。返回一个值,该值指示此实例是否与指定的对象相等。 (继承自 Attribute。) | |
Finalize | 允许对象在“垃圾回收”回收之前尝试释放资源并执行其他清理操作。 (继承自 Object。) | |
GetHashCode | 返回此实例的哈希代码。 (继承自 Attribute。) | |
GetType | 获取当前实例的 Type。 (继承自 Object。) | |
IsDefaultAttribute | 当在派生类中重写时,指示此实例的值是否是派生类的默认值。 (继承自 Attribute。) | |
Match | 当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 (继承自 Attribute。) | |
MemberwiseClone | 创建当前 Object 的浅表副本。 (继承自 Object。) | |
RethrowIfAssertException | (继承自 ExpectedExceptionBaseAttribute。) | |
ToString | 返回表示当前对象的字符串。 (继承自 Object。) | |
Verify | (继承自 ExpectedExceptionBaseAttribute。) |
页首
显式接口实现
名称 | 说明 | |
---|---|---|
_Attribute.GetIDsOfNames | 将一组名称映射为对应的一组调度标识符。 (继承自 Attribute。) | |
_Attribute.GetTypeInfo | 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 (继承自 Attribute。) | |
_Attribute.GetTypeInfoCount | 检索对象提供的类型信息接口的数量(0 或 1)。 (继承自 Attribute。) | |
_Attribute.Invoke | 提供对某一对象公开的属性和方法的访问。 (继承自 Attribute。) |
页首
备注
有关如何使用特性的更多信息,请参见利用特性扩展元数据。
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
请参见
参考
Microsoft.Data.Schema.UnitTesting 命名空间