The array to interogate.
The amount of values the array should hold.
The error message to display.
The file name where the error occurred. The value is added automatically at the call site.
The line where the error occurred. The value is added automatically at the call site.
DUnitAssertError if the assertation fails.
1 int[string] associativeArray; 2 int[] dynamicArray; 3 string string_; 4 5 associativeArray.assertCount(0); 6 dynamicArray.assertCount(0); 7 string_.assertCount(0); 8 [].assertCount(0); 9 10 "Hello".assertCount(5); 11 [1, 2, 3, 4].assertCount(4); 12 ["foo", "bar", "baz", "qux"].assertCount(4); 13 [["foo", "bar"], ["baz", "qux"]].assertCount(2); 14 ["foo":1, "bar":2, "baz":3, "qux":4].assertCount(4); 15 16 // Assert a DUnitAssertError is thrown if assertCount fails. 17 associativeArray.assertCount(1).assertThrow!(DUnitAssertError)("Failed asserting array count");
Assert that an array contains a particular value count.