Share via


Assert.AreNotEqual 方法 (Double, Double, Double, String)

验证指定的两个双精度型值是否既不相等又不在对方的指定精度内。 如果它们相等或者在对方的指定精度内,则断言失败。 如果断言失败,将显示一则消息。

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

语法

声明
Public Shared Sub AreNotEqual ( _
    notExpected As Double, _
    actual As Double, _
    delta As Double, _
    message As String _
)
public static void AreNotEqual(
    double notExpected,
    double actual,
    double delta,
    string message
)
public:
static void AreNotEqual(
    double notExpected, 
    double actual, 
    double delta, 
    String^ message
)
static member AreNotEqual : 
        notExpected:float * 
        actual:float * 
        delta:float * 
        message:string -> unit 
public static function AreNotEqual(
    notExpected : double, 
    actual : double, 
    delta : double, 
    message : String
)

参数

  • notExpected
    类型:System.Double
    要比较的第一个双精度型。单元测试要求该双精度型值与 actual 不匹配。
  • actual
    类型:System.Double
    要比较的第二个双精度型。这是单元测试生成的双精度型值。
  • delta
    类型:System.Double
    要求的误差。只有当 notExpected 与 actual 相等或者它们的差小于 delta 时断言才失败。
  • message
    类型:System.String
    断言失败时显示的消息。在单元测试结果中可以看到此消息。

异常

异常 条件
AssertFailedException

notExpected 与 actual 相等或者它们的差小于 delta。

.NET Framework 安全性

请参见

参考

Assert 类

AreNotEqual 重载

Microsoft.VisualStudio.TestTools.UnitTesting 命名空间

其他资源

使用 Assert 类