Assert.AreNotEquivalent 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| AreNotEquivalent<T>(T, T, Boolean, String, String, String) |
测试两个对象图在结构上是否不相等,并引发异常(如果存在)。 |
| AreNotEquivalent<T>(Span<T>, Span<T>, Boolean, String, String, String) |
测试两个跨度在结构上是否不相等。 |
| AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean, String, String, String) |
测试两个跨度在结构上是否不相等。 |
| AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, Boolean, String, String, String) |
测试两个内存区域在结构上是否不相等。 |
| AreNotEquivalent<T>(Memory<T>, Memory<T>, Boolean, String, String, String) |
测试两个内存区域在结构上是否不相等。 |
| AreNotEquivalent<T>(T, T, String, String, String) |
测试两个对象图在结构上是否不相等,并引发异常(如果存在)。 |
| AreNotEquivalent<T>(Span<T>, Span<T>, String, String, String) |
测试两个跨度在结构上是否不相等。 |
| AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String) |
测试两个跨度在结构上是否不相等。 |
| AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String) |
测试两个内存区域在结构上是否不相等。 |
| AreNotEquivalent<T>(Memory<T>, Memory<T>, String, String, String) |
测试两个内存区域在结构上是否不相等。 |
AreNotEquivalent<T>(T, T, Boolean, String, String, String)
- Source:
- Assert.AreEquivalent.cs
测试两个对象图在结构上是否不相等,并引发异常(如果存在)。
public static void AreNotEquivalent<T>(T? notExpected, T? actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : 'T * 'T * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As T, actual As T, strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
要比较的值的类型。
参数
- notExpected
- T
要比较的第一个值。 这是测试预期不匹配 actual的值。
- actual
- T
要比较的第二个值。 这是受测代码生成的值。
- strict
- Boolean
当 true,用于确定断言是否以严格模式执行断言的等效性检查(额外的成员或字典键 actual 被视为差异),因此断言会在其存在时成功。
- message
- String
当与actual异常等效时notExpected要包含在异常中的消息。 消息显示在测试结果中。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
例外
在 notExpected 结构上是 actual 等效的,还是无法完成结构比较时引发的。
适用于
AreNotEquivalent<T>(Span<T>, Span<T>, Boolean, String, String, String)
测试两个跨度在结构上是否不相等。
public static void AreNotEquivalent<T>(Span<T> notExpected, Span<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Span<'T> * Span<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Span(Of T), actual As Span(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
范围的元素类型。
参数
- notExpected
- Span<T>
测试期望的跨度不匹配 actual。
- actual
- Span<T>
由所测试的代码生成的范围。
- strict
- Boolean
在 true严格模式下执行比较时。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean, String, String, String)
测试两个跨度在结构上是否不相等。
public static void AreNotEquivalent<T>(ReadOnlySpan<T> notExpected, ReadOnlySpan<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlySpan<'T> * ReadOnlySpan<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlySpan(Of T), actual As ReadOnlySpan(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
范围的元素类型。
参数
- notExpected
- ReadOnlySpan<T>
测试期望的跨度不匹配 actual。
- actual
- ReadOnlySpan<T>
由所测试的代码生成的范围。
- strict
- Boolean
在 true严格模式下执行比较时。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, Boolean, String, String, String)
测试两个内存区域在结构上是否不相等。
public static void AreNotEquivalent<T>(ReadOnlyMemory<T> notExpected, ReadOnlyMemory<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlyMemory<'T> * ReadOnlyMemory<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlyMemory(Of T), actual As ReadOnlyMemory(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
内存区域的元素类型。
参数
- notExpected
- ReadOnlyMemory<T>
测试期望的内存不匹配 actual。
- actual
- ReadOnlyMemory<T>
受测代码生成的内存。
- strict
- Boolean
在 true严格模式下执行比较时。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(Memory<T>, Memory<T>, Boolean, String, String, String)
测试两个内存区域在结构上是否不相等。
public static void AreNotEquivalent<T>(Memory<T> notExpected, Memory<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Memory<'T> * Memory<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Memory(Of T), actual As Memory(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
内存区域的元素类型。
参数
- notExpected
- Memory<T>
测试期望的内存不匹配 actual。
- actual
- Memory<T>
受测代码生成的内存。
- strict
- Boolean
在 true严格模式下执行比较时。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(T, T, String, String, String)
- Source:
- Assert.AreEquivalent.cs
测试两个对象图在结构上是否不相等,并引发异常(如果存在)。
public static void AreNotEquivalent<T>(T? notExpected, T? actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : 'T * 'T * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As T, actual As T, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
要比较的值的类型。
参数
- notExpected
- T
要比较的第一个值。 这是测试预期不匹配 actual的值。
- actual
- T
要比较的第二个值。 这是受测代码生成的值。
- message
- String
当与actual异常等效时notExpected要包含在异常中的消息。 消息显示在测试结果中。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
例外
在 notExpected 结构上是 actual 等效的,还是无法完成结构比较时引发的。
注解
请参阅 AreEquivalent<T>(T, T, String, String, String) 并 AreEquivalent<T>(T, T, Boolean, String, String, String) 了解完整的比较规则集。
适用于
AreNotEquivalent<T>(Span<T>, Span<T>, String, String, String)
测试两个跨度在结构上是否不相等。
public static void AreNotEquivalent<T>(Span<T> notExpected, Span<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Span<'T> * Span<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Span(Of T), actual As Span(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
范围的元素类型。
参数
- notExpected
- Span<T>
测试期望的跨度不匹配 actual。
- actual
- Span<T>
由所测试的代码生成的范围。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String)
测试两个跨度在结构上是否不相等。
public static void AreNotEquivalent<T>(ReadOnlySpan<T> notExpected, ReadOnlySpan<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlySpan<'T> * ReadOnlySpan<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlySpan(Of T), actual As ReadOnlySpan(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
范围的元素类型。
参数
- notExpected
- ReadOnlySpan<T>
测试期望的跨度不匹配 actual。
- actual
- ReadOnlySpan<T>
由所测试的代码生成的范围。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String)
测试两个内存区域在结构上是否不相等。
public static void AreNotEquivalent<T>(ReadOnlyMemory<T> notExpected, ReadOnlyMemory<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlyMemory<'T> * ReadOnlyMemory<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlyMemory(Of T), actual As ReadOnlyMemory(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
内存区域的元素类型。
参数
- notExpected
- ReadOnlyMemory<T>
测试期望的内存不匹配 actual。
- actual
- ReadOnlyMemory<T>
受测代码生成的内存。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。
适用于
AreNotEquivalent<T>(Memory<T>, Memory<T>, String, String, String)
测试两个内存区域在结构上是否不相等。
public static void AreNotEquivalent<T>(Memory<T> notExpected, Memory<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Memory<'T> * Memory<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Memory(Of T), actual As Memory(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")
类型参数
- T
内存区域的元素类型。
参数
- notExpected
- Memory<T>
测试期望的内存不匹配 actual。
- actual
- Memory<T>
受测代码生成的内存。
- message
- String
断言失败时要包含在异常中的消息。
- notExpectedExpression
- String
由编译器通过调用方参数表达式给出的 notExpectic 表达式的语法表达式。 用户不应传递此参数的值。
- actualExpression
- String
编译器通过调用方参数表达式给出的实际语法表达式。 用户不应传递此参数的值。