rspec/rules/S3415/csharp/rule.adoc
2023-10-19 15:48:44 +02:00

41 lines
904 B
Plaintext

== Why is this an issue?
The standard assertions library methods such as `AreEqual` and `AreSame` in *MSTest* and *NUnit*, or `Equal` and `Same` in *XUnit*,
expect the first argument to be the expected value and the second argument to be the actual value.
include::../impact.adoc[]
include::../howtofix.adoc[]
=== Code examples
==== Noncompliant code example
[source,csharp,diff-id=1,diff-type=noncompliant]
----
Assert.AreEqual(runner.ExitCode, 0, "Unexpected exit code"); // Noncompliant; Yields error message like: Expected:<-1>. Actual:<0>.
----
==== Compliant solution
[source,csharp,diff-id=1,diff-type=compliant]
----
Assert.AreEqual(0, runner.ExitCode, "Unexpected exit code");
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
endif::env-github,rspecator-view[]