标签:
MS Test Assert | NUnit Assert | 用途 |
AreEqual |
|
验证值相等 |
AreNotEqual |
|
验证值不相等 |
AreSame |
|
验证引用相等 |
AreNotSame |
|
验证引用不相等 |
Inconclusive |
|
暗示条件还未被验证 |
IsTrue |
|
验证条件为真 |
IsFalse |
|
验证条件为假 |
IsInstanceOfType |
Assert.IsInstanceOf<> |
验证实例匹配类型 |
IsNotInstanceOfType |
Assert.IsNotInstanceOf<> |
验证实例不匹配类型 |
IsNotNull |
|
验证条件为NULL |
IsNull |
|
验证条件不为NULL |
Fail |
|
验证失败 |
NUnit 2.2
|
MSTest
|
xUnit.net
|
备注
|
AreEqual
|
AreEqual
|
Equal
|
相等比较
|
AreNotEqual
|
AreNotEqual
|
NotEqual
|
不相等比较
|
AreNotSame
|
AreNotSame
|
NotSame
|
不相同比较
|
AreSame
|
AreSame
|
Same
|
相同比较
|
Contains
|
Contains (on CollectionAssert)
|
Contains
|
|
DoAssert
|
n/a
|
n/a
|
|
n/a
|
DoesNotContain (on CollectionAssert)
|
DoesNotContain
|
|
n/a
|
n/a
|
DoesNotThrow
|
|
Fail
|
Fail
|
n/a
|
可用Assert.True(false, "message")替代
|
Greater
|
n/a
|
n/a
|
可用Assert.True(x > y)替代
|
Ignore
|
Inconclusive
|
n/a
|
|
n/a
|
n/a
|
InRange
|
|
IsAssignableFrom
|
n/a
|
IsAssignableFrom
|
|
IsEmpty
|
n/a
|
Empty
|
|
IsFalse
|
IsFalse
|
False
|
|
IsInstanceOfType
|
IsInstanceOfType
|
IsType
|
|
IsNaN
|
n/a
|
n/a
|
可用Assert.True(double.IsNaN(x))替代
|
IsNotAssignableFrom
|
n/a
|
n/a
|
可用Assert.False(obj is Type)替代
|
IsNotEmpty
|
n/a
|
NotEmpty
|
|
IsNotInstanceOfType
|
IsNotInstanceOfType
|
IsNotType
|
|
IsNotNull
|
IsNotNull
|
NotNull
|
|
IsNull
|
IsNull
|
Null
|
|
IsTrue
|
IsTrue
|
True
|
|
Less
|
n/a
|
n/a
|
可用Assert.True(x < y)替代
|
n/a
|
n/a
|
NotInRange
|
确保数据在某个范围内
|
n/a
|
n/a
|
Throws
|
确保会抛出异常
|
写单元测试的知识结构(2)——单元测试工具的选用(找个顺手的)
标签:
原文地址:http://www.cnblogs.com/JonathanEvents/p/4839240.html