These methods test whether the two arguments are equal. Overloadedmethods are provided for common value types so that languages that don'tautomatically box values can use them directly.
Comparing Numerics of Different Types
The method overloads that compare two objects make special provision so that numeric values of different types compare as expected. This assert succeeds:
Comparing Floating Point Values
Most complete NUnit Unit Testing Framework cheat sheet. All you need to to know- the most basic operations to the most advanced configurations. Beginning with NUnit 2.4.4, the value of GlobalSettings.DefaultFloatingPointTolerance is used if a third argument is not provided. In earlier versions, or if the default has not been set, values are tested for exact equality. Special values are handled so that the following Asserts succeed: Note: The last example above represents a change with.
Values of type float and double are normally compared using an additionalargument that indicates a tolerance within which they will be consideredas equal. Beginning with NUnit 2.4.4, the value ofGlobalSettings.DefaultFloatingPointTolerance is used if a third argumentis not provided. In earlier versions, or if the default has not been set,values are tested for exact equality.
Special values are handled so that the following Asserts succeed:
Note: The last example above represents a change with NUnit 2.2.3. In earlier releases, the test would fail. We have made this change because the new behavior seems to be more useful in tests. To avoid confusion, we suggest using the new Assert.IsNaN method where appropriate.
Comparing Arrays and Collections
Nunit Assembly Setup
Since version 2.2, NUnit has been able to compare two single-dimensioned arrays. Beginning with version 2.4, multi-dimensioned arrays, nested arrays (arrays of arrays) and collections may be compared. Two arrays or collections will be treated as equal by Assert.AreEqual if they have the same dimensions and if each of the corresponding elements is equal.