Reputation: 41625
When I write the following code in a C# unit test:
using Microsoft.VisualStudio.TestTools.UnitTesting;
CollectionAssert.AreEqual(new List<int> { 1, 2, 3 }, new List<int> { 1, 2 });
The unit test fails with the following details:
Fehler bei "CollectionAssert.AreEqual". (Unterschiedliche Anzahl von Elementen.)
Error at "CollectionAssert.AreEqual". (Differing number of elements.)
Now I wonder why the exception message is so unhelpful. It would have been easy to write:
Error at "CollectionAssert.AreEqual". (Expected 3 elements, got 2.)
Surely it must have bugged the developers of the CollectionAssert
or their colleagues who had to use that class. What could be the reason for not providing details, especially during unit tests?
Upvotes: 3
Views: 106