表示一个特性,该特性指定单元测试应有 SqlException,并且需要时可指定错误号、严重级别和预期错误的状态。
命名空间: Microsoft.Data.Tools.Schema.Sql.UnitTesting
程序集: Microsoft.Data.Tools.Schema.Sql.UnitTesting(Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll 中)
继承层次结构
System.Object
System.Attribute
Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionBaseAttribute
Microsoft.Data.Tools.Schema.Sql.UnitTesting.ExpectedSqlExceptionAttribute
语法
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false,
Inherited = true)]
public class ExpectedSqlExceptionAttribute : ExpectedExceptionBaseAttribute
[AttributeUsageAttribute(AttributeTargets::Method, AllowMultiple = false,
Inherited = true)]
public ref class ExpectedSqlExceptionAttribute : ExpectedExceptionBaseAttribute
[<AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false,
Inherited = true)>]
type ExpectedSqlExceptionAttribute =
class
inherit ExpectedExceptionBaseAttribute
end
<AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple := False,
Inherited := True)>
Public Class ExpectedSqlExceptionAttribute
Inherits ExpectedExceptionBaseAttribute
构造函数
名称 | 说明 | |
---|---|---|
![]() |
ExpectedSqlExceptionAttribute() | 初始化 ExpectedSqlExceptionAttribute 类的新实例。 |
![]() |
ExpectedSqlExceptionAttribute(String) | 初始化 ExpectedSqlExceptionAttribute 类的新实例。 |
属性
名称 | 说明 | |
---|---|---|
![]() |
MatchFirstError | 获取一个值,指示预期的严重级别、状态和错误号是否要与 SqlError 中的第一个 SqlException 匹配。 |
![]() |
MessageNumber | 获取或设置预期的错误号。 |
![]() |
NoExceptionMessage | (从 ExpectedExceptionBaseAttribute 继承。) |
![]() |
Severity | 获取或设置错误的预期严重级别值。 |
![]() |
State | 获取或设置错误的预期错误状态。 |
![]() |
TestContext | (从 ExpectedExceptionBaseAttribute 继承。) |
![]() |
TypeId | (从 Attribute 继承。) |
方法
名称 | 说明 | |
---|---|---|
![]() |
Equals(Object) | (从 Attribute 继承。) |
![]() |
Finalize() | (从 Object 继承。) |
![]() |
GetHashCode() | (从 Attribute 继承。) |
![]() |
GetType() | (从 Object 继承。) |
![]() |
IsDefaultAttribute() | (从 Attribute 继承。) |
![]() |
Match(Object) | (从 Attribute 继承。) |
![]() |
MemberwiseClone() | (从 Object 继承。) |
![]() |
RethrowIfAssertException(Exception) | (从 ExpectedExceptionBaseAttribute 继承。) |
![]() |
ToString() | (从 Object 继承。) |
![]() |
Verify(Exception) |
显式接口实现
线程安全
此类型的任何公共静态(Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。
请参阅
ExpectedExceptionAttribute
Microsoft.Data.Tools.Schema.Sql.UnitTesting 命名空间
返回页首