예제 #1
0
        public void GetFirstValue_WithNullDataRow()
        {
            //Arrange
            DataRow dataRow    = null;
            string  columnName = "Column1";

            // Action
            var actual = DataRowExtensions.GetFirstValue(dataRow, columnName);

            // Assert
            Assert.IsNull(actual);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }