c# - How to Assert DataTable in NUnit? -


i've written unit test based on nunit framework , i'd know how should assert datatable returned methods.

currently, i've done below:

[test] public void gettablecolumns_whencalled_shouldreturntablecolumnlist() {     // act     datatable datatable = _sut.gettablecolumns(statics.systemuserstablename);      // assert     assert.isnotnull(datatable, "datatable empty");  } 

is best practice assert datatable data's assert.isnotnull method?

[test] public void gettablecolumns_whencalled_shouldreturntablecolumnlist() {     // act     var dt= _sut.gettablecolumns(statics.systemuserstablename);      // assert     assert.that(!dt.hasrow());  }  public static bool hasrow(this datatable dt) {  return dt != null && dt.rows.count > 0; } 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -