Condividi tramite


Classe ExpectedSqlExceptionAttribute

 

Rappresenta un attributo che specifica che uno unit test prevede un oggetto SqlException, and optionally specify the error number, severity, and state of the expected error.

Spazio dei nomi:   Microsoft.Data.Tools.Schema.Sql.UnitTesting
Assembly:  Microsoft.Data.Tools.Schema.Sql.UnitTesting (in Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll)

Gerarchia di ereditarietà

System.Object
  System.Attribute
    Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionBaseAttribute
      Microsoft.Data.Tools.Schema.Sql.UnitTesting.ExpectedSqlExceptionAttribute

Sintassi

[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

Costruttori

Nome Descrizione
System_CAPS_pubmethod ExpectedSqlExceptionAttribute()

Inizializza una nuova istanza della classe ExpectedSqlExceptionAttribute.

System_CAPS_pubmethod ExpectedSqlExceptionAttribute(String)

Inizializza una nuova istanza della classe ExpectedSqlExceptionAttribute.

Proprietà

Nome Descrizione
System_CAPS_pubproperty MatchFirstError

Ottiene un valore che indica se la gravità, lo stato e il numero dell'errore previsti devono corrispondere al primo oggetto SqlError in SqlException.

System_CAPS_pubproperty MessageNumber

Ottiene o imposta il numero dell'errore previsto.

System_CAPS_protproperty NoExceptionMessage

(Ereditato da ExpectedExceptionBaseAttribute.)

System_CAPS_pubproperty Severity

Ottiene o imposta il valore di gravità dell'errore previsto.

System_CAPS_pubproperty State

Ottiene o imposta lo stato dell'errore previsto.

System_CAPS_protproperty TestContext

(Ereditato da ExpectedExceptionBaseAttribute.)

System_CAPS_pubproperty TypeId

(Ereditato da Attribute.)

Metodi

Nome Descrizione
System_CAPS_pubmethod Equals(Object)

(Ereditato da Attribute.)

System_CAPS_protmethod Finalize()

(Ereditato da Object.)

System_CAPS_pubmethod GetHashCode()

(Ereditato da Attribute.)

System_CAPS_pubmethod GetType()

(Ereditato da Object.)

System_CAPS_pubmethod IsDefaultAttribute()

(Ereditato da Attribute.)

System_CAPS_pubmethod Match(Object)

(Ereditato da Attribute.)

System_CAPS_protmethod MemberwiseClone()

(Ereditato da Object.)

System_CAPS_protmethod RethrowIfAssertException(Exception)

(Ereditato da ExpectedExceptionBaseAttribute.)

System_CAPS_pubmethod ToString()

(Ereditato da Object.)

System_CAPS_protmethod Verify(Exception)

(Esegue l’override di ExpectedExceptionBaseAttribute.Verify(Exception)).

Implementazioni esplicite dell'interfaccia

Nome Descrizione
System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

(Ereditato da Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

(Ereditato da Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfoCount(UInt32)

(Ereditato da Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

(Ereditato da Attribute.)

Codice thread safe

Eventuali membri pubblici statici (Shared in Visual Basic) di questo tipo sono thread-safe. I membri di istanza non sono garantiti come thread-safe.

Vedere anche

ExpectedExceptionAttribute
Spazio dei nomi Microsoft.Data.Tools.Schema.Sql.UnitTesting

Torna all'inizio