i have following extension methods:
public static t toobject<t>(this datarow row) t : new() { if (row == null) throw new argumentnullexception("row"); // } public static ienumerable<t> toobject<t>(this datatable table) t : new() { if (table == null) throw new argumentnullexception("table"); // } and respective tests:
[testmethod] [expectedexception(typeof(argumentnullexception))] public void nulldatarow() { // arrange datarow row = null; // act row.toobject<somedata>(); } [testmethod] [expectedexception(typeof(argumentnullexception))] public void nulldatatable() { // arrange datatable table = null; // act table.toobject<somedata>(); } the datarow test passes (it throws argumentnullexception normally) while datatable one doesn't (doesn't hit method nor throw anything).
i have absolutely no idea why datatable test isn't working (and datarow 1 normal!).
(at first thought bug in visual studio, the ci service use accused same)
i'll assume ienumerable<t> isn't fun, , extension method iterator.
such iterator, doesn't execute point of throwing exception until start iterating it.
Comments
Post a Comment