public void Should_be_able_to_get_null_for_single_row_if_there_is_no_data() { var query = new Mock <IQuery>(); var command = CommandMock(); command.Setup(m => m.ExecuteReader()).Returns(DataTableReader(0)); var gateway = new DatabaseGateway(); using (GetDatabaseContext(command)) { Assert.IsNull(gateway.GetSingleRowUsing(query.Object)); } }
public void Should_be_able_to_get_single_row() { var query = new Mock <IQuery>(); var command = CommandMock(); command.Setup(m => m.ExecuteReader()).Returns(DataTableReader(2)); var gateway = new DatabaseGateway(); using (GetDatabaseContext(command)) { var row = gateway.GetSingleRowUsing(query.Object); Assert.IsNotNull(row); Assert.AreEqual("row-1", row[0]); } }