NUnit's logic for comparing arrays - use Comparer<T[]> if it is provided.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Fix Released
|
High
|
Charlie Poole | ||
NUnit V2 |
Fix Released
|
High
|
Charlie Poole |
Bug Description
In the following code snippet, NUnit uses passed comparer as elements' comparer, which prevents us from treating array types just like any other data types in unit tests. The workaround is to check for equality in the following way - Assert.AreEqual(0, comparer.
[TestFixture]
public class NUnitFeatures
{
[Test]
public void CustomArrayComp
{
Assert.
}
class IntArrayComparer : IComparer<int[]>
{
public int Compare(int[] x, int[] y) { return 0; } // just a stub
}
}
Google groups discussion:
http://
Changed in nunit-3.0: | |
status: | New → Triaged |
tags: | added: feature framework |
Changed in nunit-3.0: | |
importance: | Undecided → High |
assignee: | nobody → Charlie Poole (charlie.poole) |
milestone: | none → 2.9.6 |
Changed in nunit-3.0: | |
status: | Triaged → Fix Committed |
Changed in nunitv2: | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Charlie Poole (charlie.poole) |
milestone: | none → 2.6.0 |
Changed in nunitv2: | |
status: | Triaged → Fix Committed |
Changed in nunitv2: | |
status: | Fix Committed → Fix Released |
Changed in nunit-3.0: | |
status: | Fix Committed → Fix Released |