3 out of 8 rated this helpful - Rate this topic

Assert.AreEqual Method (Object, Object)

Verifies that two specified objects are equal. The assertion fails if the objects are not equal.

Namespace: Microsoft.VisualStudio.TestTools.UnitTesting
Assembly: Microsoft.VisualStudio.QualityTools.UnitTestFramework (in microsoft.visualstudio.qualitytools.unittestframework.dll)

public static void AreEqual (
	Object expected,
	Object actual
)
public static void AreEqual (
	Object expected, 
	Object actual
)
public static function AreEqual (
	expected : Object, 
	actual : Object
)

Parameters

expected

The first object to compare. This is the object the unit test expects.

actual

The second object to compare. This is the object the unit test produced.

Exception type Condition

AssertFailedException

expected is not equal to actual.

Different numeric types are treated as unequal even if the logical values are equal. For example, 42L is not equal to 42.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ