Compartir a través de


PexAssume.AreEqual Method

Definition

Overloads

AreEqual(Boolean, Boolean)

Assumes that two bool values are equal.

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

The test case fails if two strings are not equal, with a specified message in the exception object.

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

The test fails if a culture-specific comparison of two strings is false, with a specified message in the exception object.

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

The test case fails if two float values are not equal within a specified precision, with a specified message in the exception object.

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

The test case fails if two double values are not equal within a specified precision, with a specified message in the exception object.

AreEqual(String, String, Boolean, String)

The test case fails if two strings are not equal, with a specified message in the exception object.

AreEqual(String, String, Boolean, CultureInfo)

The test fails if a culture-specific comparison of two strings is false.

AreEqual(Single, Single, Single, String)

The test case fails if two float values are not equal within a specified precision, with a specified message in the exception object.

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

The test fails if a culture-specific comparison of two strings is false, with a specified message in the exception object.

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

The test fails if two object instances are not equal, with a specified message in the exception object.

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

Assumes that two bool values are equal.

AreEqual(String, String, Boolean)

The test case fails if two strings are not equal.

AreEqual(Single, Single, Single)

The test case fails if two float values are not equal within a specified precision.

AreEqual(Object, Object, String)

The test fails if two object instances are not equal, with a specified message in the exception object.

AreEqual(Double, Double, Double)

The test case fails if two double values are not equal within a specified precision.

AreEqual(Boolean, Boolean, String)

Assumes that two bool values are equal.

AreEqual(Object, Object)

The test fails if two object instances are not equal.

AreEqual(Double, Double, Double, String)

The test case fails if two double values are not equal within a specified precision, with a specified message in the exception object.

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

The test fails if two object instances of a specified type are not equal, with a specified message in the exception object.

AreEqual<T>(T, T, String)

The test fails if two object instances of a specified type are not equal, with a specified message in the exception object.

AreEqual<T>(T, T)

The test fails if two object instances of a specified type are not equal.

AreEqual(Boolean, Boolean)

Assumes that two bool values are equal.

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

Parameters

expected
Boolean

The expected value.

actual
Boolean

The value to be tested.

Exceptions

If the expected and actual values are not equal.

Remarks

This method ensures MC/DC coverage of the conjuncts.

Applies to

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

The test case fails if two strings are not equal, with a specified message in the exception object.

public:
 static void AreEqual(System::String ^ expected, System::String ^ actual, bool ignoreCase, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual (string expected, string actual, bool ignoreCase, string format, params object[] args);
static member AreEqual : string * string * bool * string * obj[] -> unit
Public Shared Sub AreEqual (expected As String, actual As String, ignoreCase As Boolean, format As String, ParamArray args As Object())

Parameters

expected
String

The expected string.

actual
String

The string to be tested.

ignoreCase
Boolean

Set this value to true for case-sensitive comparison and false otherwise.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables, whose values are to be inserted in format.

Exceptions

If the strings are not equal.

Applies to

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

The test fails if a culture-specific comparison of two strings is false, with a specified message in the exception object.

public:
 static void AreEqual(System::String ^ expected, System::String ^ actual, bool ignoreCase, System::Globalization::CultureInfo ^ culture, System::String ^ message);
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

The expected string.

actual
String

The actual string.

ignoreCase
Boolean

Set this value to true for case-sensitive comparison and false otherwise.

culture
CultureInfo

A System.Globalization.CultureInfo object that contains the culture-specific comparison information.

message
String

A message string.

Exceptions

If the strings are not equal.

Remarks

For more information, see System.String.Compare.

Applies to

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

The test case fails if two float values are not equal within a specified precision, with a specified message in the exception object.

public:
 static void AreEqual(float expected, float actual, float delta, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual (float expected, float actual, float delta, string format, params object[] args);
static member AreEqual : single * single * single * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Single, actual As Single, delta As Single, format As String, ParamArray args As Object())

Parameters

expected
Single

The expected value.

actual
Single

The value to be tested.

delta
Single

The test's precision. This value must be positive.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables, whose values are to be inserted in format.

Exceptions

If the values are not equal.

If delta is negative.

Remarks

The test fails if the absolute value of the difference between the expected and actual values is greater than delta.

Applies to

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

The test case fails if two double values are not equal within a specified precision, with a specified message in the exception object.

public:
 static void AreEqual(double expected, double actual, double delta, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual (double expected, double actual, double delta, string format, params object[] args);
static member AreEqual : double * double * double * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Double, actual As Double, delta As Double, format As String, ParamArray args As Object())

Parameters

expected
Double

The expected value.

actual
Double

The value to be tested.

delta
Double

The test's precision. This value must be positive.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables, whose values are to be inserted in format.

Exceptions

If the values are not equal.

If delta is negative.

Remarks

The test fails if the absolute value of the difference between the expected and actual values is greater than delta.

Applies to

AreEqual(String, String, Boolean, String)

The test case fails if two strings are not equal, with a specified message in the exception object.

public:
 static void AreEqual(System::String ^ expected, System::String ^ actual, bool ignoreCase, System::String ^ message);
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

The expected string.

actual
String

The string to be tested.

ignoreCase
Boolean

Set this value to true for case-sensitive comparison and false otherwise.

message
String

A message string.

Exceptions

If the strings are not equal.

Applies to

AreEqual(String, String, Boolean, CultureInfo)

The test fails if a culture-specific comparison of two strings is false.

public:
 static void AreEqual(System::String ^ expected, System::String ^ actual, bool ignoreCase, System::Globalization::CultureInfo ^ culture);
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

The expected string.

actual
String

The actual string.

ignoreCase
Boolean

Set this value to true for case-sensitive comparison and false otherwise.

culture
CultureInfo

A System.Globalization.CultureInfo object that contains the culture-specific comparison information.

Exceptions

If the strings are not equal.

Remarks

For more information, see System.String.Compare.

Applies to

AreEqual(Single, Single, Single, String)

The test case fails if two float values are not equal within a specified precision, with a specified message in the exception object.

public:
 static void AreEqual(float expected, float actual, float delta, System::String ^ message);
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

The expected value.

actual
Single

The value to be tested.

delta
Single

The test's precision. This value must be positive.

message
String

A message string.

Exceptions

If the values are not equal.

If delta is negative.

Remarks

The test fails if the absolute value of the difference between the expected and actual values is greater than delta.

Applies to

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

The test fails if a culture-specific comparison of two strings is false, with a specified message in the exception object.

public:
 static void AreEqual(System::String ^ expected, System::String ^ actual, bool ignoreCase, System::Globalization::CultureInfo ^ culture, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual (string expected, string actual, bool ignoreCase, System.Globalization.CultureInfo culture, string format, params object[] args);
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, format As String, ParamArray args As Object())

Parameters

expected
String

The expected string.

actual
String

The actual string.

ignoreCase
Boolean

Set this value to true for case-sensitive comparison and false otherwise.

culture
CultureInfo

A System.Globalization.CultureInfo object that contains the culture-specific comparison information.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables, whose values are to be inserted in format.

Exceptions

If the strings are not equal.

Remarks

For more information, see System.String.Compare.

Applies to

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

The test fails if two object instances are not equal, with a specified message in the exception object.

public:
 static void AreEqual(System::Object ^ expected, System::Object ^ actual, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual (object expected, object actual, string format, params object[] args);
static member AreEqual : obj * obj * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Object, actual As Object, format As String, ParamArray args As Object())

Parameters

expected
Object

The expected object.

actual
Object

The actual object.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables, whose values are to be inserted in format.

Exceptions

If the objects are not equal.

Applies to

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

Assumes that two bool values are equal.

public:
 static void AreEqual(bool expected, bool actual, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual (bool expected, bool actual, string format, params object[] args);
static member AreEqual : bool * bool * string * obj[] -> unit
Public Shared Sub AreEqual (expected As Boolean, actual As Boolean, format As String, ParamArray args As Object())

Parameters

expected
Boolean

The expected value.

actual
Boolean

The value to be tested.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables. whose values are to be inserted in format.

Exceptions

If the expected and actual values are not equal.

Remarks

This method ensures MC/DC coverage of the conjuncts.

Applies to

AreEqual(String, String, Boolean)

The test case fails if two strings are not equal.

public:
 static void AreEqual(System::String ^ expected, System::String ^ actual, bool ignoreCase);
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

The expected string.

actual
String

The string to be tested.

ignoreCase
Boolean

Set this value to true for case-sensitive comparison and false otherwise.

Exceptions

If the strings are not equal.

Applies to

AreEqual(Single, Single, Single)

The test case fails if two float values are not equal within a specified precision.

public:
 static void AreEqual(float expected, float actual, float delta);
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

The expected value.

actual
Single

The value to be tested.

delta
Single

The test's precision. This value must be positive.

Exceptions

If the values are not equal.

If delta is negative.

Remarks

The test fails if the absolute value of the difference between the expected and actual values is greater than delta.

Applies to

AreEqual(Object, Object, String)

The test fails if two object instances are not equal, with a specified message in the exception object.

public:
 static void AreEqual(System::Object ^ expected, System::Object ^ actual, System::String ^ message);
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

The expected object.

actual
Object

The actual object.

message
String

A message string.

Exceptions

If the objects are not equal.

Applies to

AreEqual(Double, Double, Double)

The test case fails if two double values are not equal within a specified precision.

public:
 static void AreEqual(double expected, double actual, double delta);
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

The expected value.

actual
Double

The value to be tested.

delta
Double

The test's precision. This value must be positive.

Exceptions

If the values are not equal.

If delta is negative.

Remarks

The test fails if the absolute value of the difference between the expected and actual values is greater than delta.

Applies to

AreEqual(Boolean, Boolean, String)

Assumes that two bool values are equal.

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

Parameters

expected
Boolean

The expected value.

actual
Boolean

The value to be tested.

message
String

The message to be inserted in case of failure

Exceptions

If the expected and actual values are not equal.

Remarks

This method ensures MC/DC coverage of the conjuncts.

Applies to

AreEqual(Object, Object)

The test fails if two object instances are not equal.

public:
 static void AreEqual(System::Object ^ expected, System::Object ^ actual);
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

The expected object.

actual
Object

The actual object.

Exceptions

If the objects are not equal.

Applies to

AreEqual(Double, Double, Double, String)

The test case fails if two double values are not equal within a specified precision, with a specified message in the exception object.

public:
 static void AreEqual(double expected, double actual, double delta, System::String ^ message);
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

The expected value.

actual
Double

The value to be tested.

delta
Double

The test's precision. This value must be positive.

message
String

A message string.

Exceptions

If the values are not equal.

If delta is negative.

Remarks

The test fails if the absolute value of the difference between the expected and actual values is greater than delta.

Applies to

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

The test fails if two object instances of a specified type are not equal, with a specified message in the exception object.

public:
generic <typename T>
 static void AreEqual(T expected, T actual, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public static void AreEqual<T> (T expected, T actual, string format, params object[] args);
static member AreEqual : 'T * 'T * string * obj[] -> unit
Public Shared Sub AreEqual(Of T) (expected As T, actual As T, format As String, ParamArray args As Object())

Type Parameters

T

The object types.

Parameters

expected
T

The expected object.

actual
T

The actual object.

format
String

A message format string. The syntax for this string is identical to the format string used by Console.Writeline. In particular, insert "{0}", "{1}" and so on at appropriate locations in the string to represent the values of the variables in the args array.

args
Object[]

One or more variables, whose values are to be inserted in format.

Exceptions

If the objects are not equal.

Applies to

AreEqual<T>(T, T, String)

The test fails if two object instances of a specified type are not equal, with a specified message in the exception object.

public:
generic <typename T>
 static void AreEqual(T expected, T actual, System::String ^ message);
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 object types.

Parameters

expected
T

The expected object.

actual
T

The actual object.

message
String

A message string.

Exceptions

If the objects are not equal.

Applies to

AreEqual<T>(T, T)

The test fails if two object instances of a specified type are not equal.

public:
generic <typename T>
 static void AreEqual(T expected, T actual);
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 object types.

Parameters

expected
T

The expected object.

actual
T

The actual object.

Exceptions

If the objects are not equal.

Applies to