You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The standard assertions library methods such as AreEqual and AreSame expect the first argument to be the expected value and the second argument to be the actual value.
Having the expected value and the actual value in the wrong order will not alter the outcome of tests, (succeed/fail when it should) but the error messages will contain misleading information.
This rule raises an issue when the actual argument to an assertions library method is a hard-coded value and the expected argument is not. We assume that a literal, constant or variable/field/property containing expected in its name is the expected value and that any variable containing actual is the actual value.
Category: Assertion
Enabled by default: True
Default severity: Info
@Evangelink you were asking for some inputs, a code fix for this rule would be welcome ! We have 600 of this issue in our code base, it will be good to have a code fix to allow us to quickly fix it instead of manually fixing it !
Summary
The standard assertions library methods such as
AreEqual
andAreSame
expect the first argument to be the expected value and the second argument to be the actual value.Having the expected value and the actual value in the wrong order will not alter the outcome of tests, (succeed/fail when it should) but the error messages will contain misleading information.
This rule raises an issue when the actual argument to an assertions library method is a hard-coded value and the expected argument is not. We assume that a literal, constant or variable/field/property containing
expected
in its name is theexpected
value and that any variable containingactual
is theactual
value.Category: Assertion
Enabled by default: True
Default severity: Info
AB#1992481
The text was updated successfully, but these errors were encountered: