PexAssert.AreEqual Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AreEqual(Boolean, Boolean) |
Asserts that two |
AreEqual(String, String, Boolean, CultureInfo, String, Object[]) |
Asserts that a culture-specific comparison of two strings is true, with a specified message in the exception object. |
AreEqual(String, String, Boolean, String, Object[]) |
Asserts that two strings are equal with a specified message in the exception object. |
AreEqual(String, String, Boolean, CultureInfo, String) |
Asserts that a culture-specific comparison of two strings is true, with a specified message in the exception object. |
AreEqual(Double, Double, Double, String, Object[]) |
Asserts that two |
AreEqual(String, String, Boolean, String) |
Asserts that two strings are equal with a specified message in the exception object. |
AreEqual(String, String, Boolean, CultureInfo) |
Asserts that a culture-specific comparison of two strings is true. |
AreEqual(Single, Single, Single, String) |
Asserts that two |
AreEqual(Object, Object, String, Object[]) |
Asserts that two object instances are equal, with a specified message in the exception object. |
AreEqual(Single, Single, Single, String, Object[]) |
Asserts that two |
AreEqual(Boolean, Boolean, String, Object[]) |
Asserts that two |
AreEqual(String, String, Boolean) |
Asserts that two strings are equal, using the Ordinal comparer. |
AreEqual(Single, Single, Single) |
Asserts that two |
AreEqual(Object, Object, String) |
Asserts that two object instances are equal, with a specified message in the exception object. |
AreEqual(Double, Double, Double) |
Asserts that two |
AreEqual(Boolean, Boolean, String) |
Asserts that two |
AreEqual(Object, Object) |
Asserts that two object instances are equal. |
AreEqual(Double, Double, Double, String) |
Asserts that two |
AreEqual<T>(T, T, String, Object[]) |
Asserts that two object instances with a specified type are equal, with a specified message in the exception object. |
AreEqual<T>(T, T, String) |
Asserts that two object instances with a specified type are equal, with a specified message in the exception object. |
AreEqual<T>(T, T, PexEqualityComparison<T>) |
Asserts that two object instances with a specified type are equal,
based on an |
AreEqual<T>(T, T) |
Asserts that two object instances with a specified type are equal. |
AreEqual(Boolean, Boolean)
Asserts 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, CultureInfo, String, Object[])
Asserts that a culture-specific comparison of two strings is true, 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(String, String, Boolean, String, Object[])
Asserts that two strings are 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 actual string.
- 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)
Asserts that a culture-specific comparison of two strings is true, 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
The message string.
Exceptions
If the strings are not equal.
Remarks
For more information, see System.String.Compare
.
Applies to
AreEqual(Double, Double, Double, String, Object[])
Asserts that two double
values are 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 expected and actual values are not equal.
If delta is negative.
Remarks
The assertion 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)
Asserts that two strings are 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 actual string.
- ignoreCase
- Boolean
Set this value to true
for case-sensitive comparison
and false otherwise.
- message
- String
The message string.
Exceptions
If the strings are not equal.
Applies to
AreEqual(String, String, Boolean, CultureInfo)
Asserts that a culture-specific comparison of two strings is true.
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)
Asserts that two float
values are 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
The message string.
Exceptions
If the expected and actual values are not equal.
If delta is negative.
Remarks
The assertion fails if the absolute value of the difference between the expected and actual values is greater than delta.
Applies to
AreEqual(Object, Object, String, Object[])
Asserts that two object instances are 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.
Remarks
The assertion fails if object.Equals(expected, actual)
returns false
.
Applies to
AreEqual(Single, Single, Single, String, Object[])
Asserts that two float
values are 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 expected and actual values are not equal.
If delta is negative.
Remarks
The assertion fails if the absolute value of the difference between the expected and actual values is greater than delta.
Applies to
AreEqual(Boolean, Boolean, String, Object[])
Asserts 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)
Asserts that two strings are equal, using the Ordinal comparer.
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 actual string.
- 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)
Asserts that two float
values are 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 expected and actual values are not equal.
If delta is negative.
Remarks
The assertion fails if the absolute value of the difference between the expected and actual values is greater than delta.
Applies to
AreEqual(Object, Object, String)
Asserts that two object instances are 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
The message string.
Exceptions
If the objects are not equal.
Remarks
The assertion fails if object.Equals(expected, actual)
returns false
.
Applies to
AreEqual(Double, Double, Double)
Asserts that two double
values are 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 expected and actual values are not equal.
If delta is negative.
Remarks
The assertion fails if the absolute value of the difference between the expected and actual values is greater than delta.
Applies to
AreEqual(Boolean, Boolean, String)
Asserts 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)
Asserts that two object instances are 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.
Remarks
The assertion fails if object.Equals(expected, actual)
returns false
.
Applies to
AreEqual(Double, Double, Double, String)
Asserts that two double
values are 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
The message string.
Exceptions
If the expected and actual values are not equal.
If delta is negative.
Remarks
The assertion 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[])
Asserts that two object instances with a specified type are 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 objects' type.
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.
Remarks
The assertion fails if object.Equals(expected, actual)
returns false
.
Applies to
AreEqual<T>(T, T, String)
Asserts that two object instances with a specified type are 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's type.
Parameters
- expected
- T
The expected object.
- actual
- T
The actual object.
- message
- String
The message string.
Exceptions
If the objects are not equal.
Remarks
The assertion fails if object.Equals(expected, actual)
returns false
.
Applies to
AreEqual<T>(T, T, PexEqualityComparison<T>)
Asserts that two object instances with a specified type are equal,
based on an EqualityComparison
delegate.
public:
generic <typename T>
static void AreEqual(T expected, T actual, Microsoft::Pex::Framework::PexEqualityComparison<T> ^ comparison);
public static void AreEqual<T> (T expected, T actual, Microsoft.Pex.Framework.PexEqualityComparison<T> comparison);
static member AreEqual : 'T * 'T * Microsoft.Pex.Framework.PexEqualityComparison<'T> -> unit
Public Shared Sub AreEqual(Of T) (expected As T, actual As T, comparison As PexEqualityComparison(Of T))
Type Parameters
- T
The objects' type.
Parameters
- expected
- T
The expected object.
- actual
- T
The actual object.
- comparison
- PexEqualityComparison<T>
An EqualityComparison
delegate, which returns true
if the two objects are equal and false
otherwise.
Exceptions
If the objects are not equal.
Applies to
AreEqual<T>(T, T)
Asserts that two object instances with a specified type are 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 objects' type.
Parameters
- expected
- T
The expected object.
- actual
- T
The actual object.
Exceptions
If the objects are not equal.
Remarks
The assertion fails if object.Equals(expected, actual)
returns false
.