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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -