private static IEnumerable <Dictionary <string, object> > GetIterator(HydraRingDatabaseReader reader) { Dictionary <string, object> nextLine = reader.ReadLine(); while (nextLine != null) { yield return(nextLine); nextLine = reader.ReadLine(); } }
/// <summary> /// Tries to read a result from the reader and throws an exception if no row could be read. /// </summary> /// <param name="exceptionMessage">The message to use in the exception when reading fails.</param> /// <param name="reader">The reader to read a row from.</param> /// <returns>A single row from the reader.</returns> /// <exception cref="HydraRingFileParserException">Thrown when no row could be read from the /// <paramref name="reader"/>.</exception> private static Dictionary <string, object> ReadLineFromReader(string exceptionMessage, HydraRingDatabaseReader reader) { Dictionary <string, object> result = reader.ReadLine(); if (result != null) { return(result); } throw new HydraRingFileParserException(exceptionMessage); }
public void ReadLine_EmptyDatabase_ReturnsNull() { // Setup string directory = Path.Combine(testDirectory, emptyDatabase); using (var reader = new HydraRingDatabaseReader(directory, query, 1)) { // Call Dictionary <string, object> result = reader.ReadLine(); // Assert Assert.IsNull(result); } }