public void GetFirstValue_WithNullDataRow() { //Arrange DataRow dataRow = null; string columnName = "Column1"; // Action var actual = DataRowExtensions.GetFirstValue(dataRow, columnName); // Assert Assert.IsNull(actual); }
public void GetFirstValue_WithNullColumnNames() { //Arrange var dataTable = new DataTable(); string[] columnNames = null; var dataColumn = new DataColumn(Guid.NewGuid().ToString()); dataTable.Columns.Add(dataColumn); var dataRow = dataTable.NewRow(); // Action DataRowExtensions.GetFirstValue(dataRow, columnNames); }
public void GetFirstValue_WithValidValue() { //Arrange var dataTable = new DataTable(); string columnName = "Column1"; var dataColumn = new DataColumn(columnName); dataTable.Columns.Add(dataColumn); var dataRow = dataTable.NewRow(); var expected = Guid.NewGuid().ToString(); dataRow[dataColumn] = expected; // Action var actual = DataRowExtensions.GetFirstValue(dataRow, columnName); // Assert Assert.AreEqual(expected, actual); }