Assert.AreEqual Assert.AreEqual Assert.AreEqual Method

Definition

Overloads

AreEqual(Object, Object) AreEqual(Object, Object) AreEqual(Object, Object)

Tests whether the specified objects are equal and throws an exception if the two objects are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[])

Tests whether the specified strings are equal and throws an exception if they are not equal.

AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[])

Tests whether the specified strings are equal and throws an exception if they are not equal. The invariant culture is used for the comparison.

AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[])

Tests whether the specified floats are equal and throws an exception if they are not equal.

AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[])

Tests whether the specified doubles are equal and throws an exception if they are not equal.

AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String)

Tests whether the specified strings are equal and throws an exception if they are not equal. The invariant culture is used for the comparison.

AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo)

Tests whether the specified strings are equal and throws an exception if they are not equal.

AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String)

Tests whether the specified strings are equal and throws an exception if they are not equal.

AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[])

Tests whether the specified objects are equal and throws an exception if the two objects are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String)

Tests whether the specified doubles are equal and throws an exception if they are not equal.

AreEqual(String, String, Boolean) AreEqual(String, String, Boolean) AreEqual(String, String, Boolean)

Tests whether the specified strings are equal and throws an exception if they are not equal. The invariant culture is used for the comparison.

AreEqual(Single, Single, Single) AreEqual(Single, Single, Single) AreEqual(Single, Single, Single)

Tests whether the specified floats are equal and throws an exception if they are not equal.

AreEqual(Object, Object, String) AreEqual(Object, Object, String) AreEqual(Object, Object, String)

Tests whether the specified objects are equal and throws an exception if the two objects are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

AreEqual(Double, Double, Double) AreEqual(Double, Double, Double) AreEqual(Double, Double, Double)

Tests whether the specified doubles are equal and throws an exception if they are not equal.

AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String)

Tests whether the specified floats are equal and throws an exception if they are not equal.

AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[])

Tests whether the specified values are equal and throws an exception if the two values are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

AreEqual<T>(T, T, String) AreEqual<T>(T, T, String) AreEqual<T>(T, T, String)

Tests whether the specified values are equal and throws an exception if the two values are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

AreEqual<T>(T, T) AreEqual<T>(T, T) AreEqual<T>(T, T)

Tests whether the specified values are equal and throws an exception if the two values are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

AreEqual(Object, Object) AreEqual(Object, Object) AreEqual(Object, Object)

Tests whether the specified objects are equal and throws an exception if the two objects are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

public static void AreEqual (object expected, object actual);
static member AreEqual : obj * obj -> unit
Public Shared Sub AreEqual (expected As Object, actual As Object)

Parameters

expected
Object Object Object

The first object to compare. This is the object the tests expects.

actual
Object Object Object

The second object to compare. This is the object produced by the code under test.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[])

Tests whether the specified strings are equal and throws an exception if they are not equal.

public static void AreEqual (string expected, string actual, bool ignoreCase, System.Globalization.CultureInfo culture, string message, params object[] parameters);
static member AreEqual : string * string * bool * System.Globalization.CultureInfo * string * obj[] -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean, culture As CultureInfo, message As String, ParamArray parameters As Object())

Parameters

expected
String String String

The first string to compare. This is the string the tests expects.

actual
String String String

The second string to compare. This is the string produced by the code under test.

ignoreCase
Boolean Boolean Boolean

A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison.)

culture
CultureInfo CultureInfo CultureInfo

A CultureInfo object that supplies culture-specific comparison information.

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[])

Tests whether the specified strings are equal and throws an exception if they are not equal. The invariant culture is used for the comparison.

public static void AreEqual (string expected, string actual, bool ignoreCase, string message, params object[] parameters);
static member AreEqual : string * string * bool * string * obj[] -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean, message As String, ParamArray parameters As Object())

Parameters

expected
String String String

The first string to compare. This is the string the tests expects.

actual
String String String

The second string to compare. This is the string produced by the code under test.

ignoreCase
Boolean Boolean Boolean

A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison.)

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[])

Tests whether the specified floats are equal and throws an exception if they are not equal.

public static void AreEqual (float expected, float actual, float delta, string message, params object[] parameters);
static member AreEqual : single * single * single * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Single, actual As Single, delta As Single, message As String, ParamArray parameters As Object())

Parameters

expected
Single Single Single

The first float to compare. This is the float the tests expects.

actual
Single Single Single

The second float to compare. This is the float produced by the code under test.

delta
Single Single Single

The required accuracy. An exception will be thrown only if actual is different than expected by more than delta.

message
String String String

The message to include in the exception when actual is different than expected by more than delta. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[])

Tests whether the specified doubles are equal and throws an exception if they are not equal.

public static void AreEqual (double expected, double actual, double delta, string message, params object[] parameters);
static member AreEqual : double * double * double * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Double, actual As Double, delta As Double, message As String, ParamArray parameters As Object())

Parameters

expected
Double Double Double

The first double to compare. This is the double the tests expects.

actual
Double Double Double

The second double to compare. This is the double produced by the code under test.

delta
Double Double Double

The required accuracy. An exception will be thrown only if actual is different than expected by more than delta.

message
String String String

The message to include in the exception when actual is different than expected by more than delta. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String)

Tests whether the specified strings are equal and throws an exception if they are not equal. The invariant culture is used for the comparison.

public static void AreEqual (string expected, string actual, bool ignoreCase, string message);
static member AreEqual : string * string * bool * string -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean, message As String)

Parameters

expected
String String String

The first string to compare. This is the string the tests expects.

actual
String String String

The second string to compare. This is the string produced by the code under test.

ignoreCase
Boolean Boolean Boolean

A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison.)

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo)

Tests whether the specified strings are equal and throws an exception if they are not equal.

public static void AreEqual (string expected, string actual, bool ignoreCase, System.Globalization.CultureInfo culture);
static member AreEqual : string * string * bool * System.Globalization.CultureInfo -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean, culture As CultureInfo)

Parameters

expected
String String String

The first string to compare. This is the string the tests expects.

actual
String String String

The second string to compare. This is the string produced by the code under test.

ignoreCase
Boolean Boolean Boolean

A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison.)

culture
CultureInfo CultureInfo CultureInfo

A CultureInfo object that supplies culture-specific comparison information.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String)

Tests whether the specified strings are equal and throws an exception if they are not equal.

public static void AreEqual (string expected, string actual, bool ignoreCase, System.Globalization.CultureInfo culture, string message);
static member AreEqual : string * string * bool * System.Globalization.CultureInfo * string -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean, culture As CultureInfo, message As String)

Parameters

expected
String String String

The first string to compare. This is the string the tests expects.

actual
String String String

The second string to compare. This is the string produced by the code under test.

ignoreCase
Boolean Boolean Boolean

A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison.)

culture
CultureInfo CultureInfo CultureInfo

A CultureInfo object that supplies culture-specific comparison information.

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[])

Tests whether the specified objects are equal and throws an exception if the two objects are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

public static void AreEqual (object expected, object actual, string message, params object[] parameters);
static member AreEqual : obj * obj * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Object, actual As Object, message As String, ParamArray parameters As Object())

Parameters

expected
Object Object Object

The first object to compare. This is the object the tests expects.

actual
Object Object Object

The second object to compare. This is the object produced by the code under test.

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String)

Tests whether the specified doubles are equal and throws an exception if they are not equal.

public static void AreEqual (double expected, double actual, double delta, string message);
static member AreEqual : double * double * double * string -> unit
Public Shared Sub AreEqual (expected As Double, actual As Double, delta As Double, message As String)

Parameters

expected
Double Double Double

The first double to compare. This is the double the tests expects.

actual
Double Double Double

The second double to compare. This is the double produced by the code under test.

delta
Double Double Double

The required accuracy. An exception will be thrown only if actual is different than expected by more than delta.

message
String String String

The message to include in the exception when actual is different than expected by more than delta. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(String, String, Boolean) AreEqual(String, String, Boolean) AreEqual(String, String, Boolean)

Tests whether the specified strings are equal and throws an exception if they are not equal. The invariant culture is used for the comparison.

public static void AreEqual (string expected, string actual, bool ignoreCase);
static member AreEqual : string * string * bool -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean)

Parameters

expected
String String String

The first string to compare. This is the string the tests expects.

actual
String String String

The second string to compare. This is the string produced by the code under test.

ignoreCase
Boolean Boolean Boolean

A Boolean indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison.)

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Single, Single, Single) AreEqual(Single, Single, Single) AreEqual(Single, Single, Single)

Tests whether the specified floats are equal and throws an exception if they are not equal.

public static void AreEqual (float expected, float actual, float delta);
static member AreEqual : single * single * single -> unit
Public Shared Sub AreEqual (expected As Single, actual As Single, delta As Single)

Parameters

expected
Single Single Single

The first float to compare. This is the float the tests expects.

actual
Single Single Single

The second float to compare. This is the float produced by the code under test.

delta
Single Single Single

The required accuracy. An exception will be thrown only if actual is different than expected by more than delta.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Object, Object, String) AreEqual(Object, Object, String) AreEqual(Object, Object, String)

Tests whether the specified objects are equal and throws an exception if the two objects are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

public static void AreEqual (object expected, object actual, string message);
static member AreEqual : obj * obj * string -> unit
Public Shared Sub AreEqual (expected As Object, actual As Object, message As String)

Parameters

expected
Object Object Object

The first object to compare. This is the object the tests expects.

actual
Object Object Object

The second object to compare. This is the object produced by the code under test.

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Double, Double, Double) AreEqual(Double, Double, Double) AreEqual(Double, Double, Double)

Tests whether the specified doubles are equal and throws an exception if they are not equal.

public static void AreEqual (double expected, double actual, double delta);
static member AreEqual : double * double * double -> unit
Public Shared Sub AreEqual (expected As Double, actual As Double, delta As Double)

Parameters

expected
Double Double Double

The first double to compare. This is the double the tests expects.

actual
Double Double Double

The second double to compare. This is the double produced by the code under test.

delta
Double Double Double

The required accuracy. An exception will be thrown only if actual is different than expected by more than delta.

Exceptions

Thrown if expected is not equal to actual.

AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String)

Tests whether the specified floats are equal and throws an exception if they are not equal.

public static void AreEqual (float expected, float actual, float delta, string message);
static member AreEqual : single * single * single * string -> unit
Public Shared Sub AreEqual (expected As Single, actual As Single, delta As Single, message As String)

Parameters

expected
Single Single Single

The first float to compare. This is the float the tests expects.

actual
Single Single Single

The second float to compare. This is the float produced by the code under test.

delta
Single Single Single

The required accuracy. An exception will be thrown only if actual is different than expected by more than delta.

message
String String String

The message to include in the exception when actual is different than expected by more than delta. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[])

Tests whether the specified values are equal and throws an exception if the two values are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

public static void AreEqual<T> (T expected, T actual, string message, params object[] parameters);
static member AreEqual : 'T * 'T * string * obj[] -> unit
Public Shared Sub AreEqual(Of T) (expected As T, actual As T, message As String, ParamArray parameters As Object())

Type Parameters

T

The type of values to compare.

Parameters

expected
T T T

The first value to compare. This is the value the tests expects.

actual
T T T

The second value to compare. This is the value produced by the code under test.

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected is not equal to actual.

AreEqual<T>(T, T, String) AreEqual<T>(T, T, String) AreEqual<T>(T, T, String)

Tests whether the specified values are equal and throws an exception if the two values are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

public static void AreEqual<T> (T expected, T actual, string message);
static member AreEqual : 'T * 'T * string -> unit
Public Shared Sub AreEqual(Of T) (expected As T, actual As T, message As String)

Type Parameters

T

The type of values to compare.

Parameters

expected
T T T

The first value to compare. This is the value the tests expects.

actual
T T T

The second value to compare. This is the value produced by the code under test.

message
String String String

The message to include in the exception when actual is not equal to expected. The message is shown in test results.

Exceptions

Thrown if expected is not equal to actual.

AreEqual<T>(T, T) AreEqual<T>(T, T) AreEqual<T>(T, T)

Tests whether the specified values are equal and throws an exception if the two values are not equal. Different numeric types are treated as unequal even if the logical values are equal. 42L is not equal to 42.

public static void AreEqual<T> (T expected, T actual);
static member AreEqual : 'T * 'T -> unit
Public Shared Sub AreEqual(Of T) (expected As T, actual As T)

Type Parameters

T

The type of values to compare.

Parameters

expected
T T T

The first value to compare. This is the value the tests expects.

actual
T T T

The second value to compare. This is the value produced by the code under test.

Exceptions

Thrown if expected is not equal to actual.

Applies to