Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Assert.AreNotEqual Method (Object, Object, String, Object[])

Verifies that two specified objects are not equal. The assertion fails if the objects are equal. Displays a message if the assertion fails, and applies the specified formatting to it.

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

public static void AreNotEqual (
	Object notExpected,
	Object actual,
	string message,
	params Object[] parameters
)
public static void AreNotEqual (
	Object notExpected, 
	Object actual, 
	String message, 
	Object[] parameters
)
public static function AreNotEqual (
	notExpected : Object, 
	actual : Object, 
	message : String, 
	... parameters : Object[]
)

Parameters

notExpected

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

actual

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

message

A message to display if the assertion fails. This message can be seen in the unit test results.

parameters

An array of parameters to use when formatting message.

Exception typeCondition

AssertFailedException

notExpected is 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.

Community Additions

ADD
Show:
© 2015 Microsoft