/// <summary> /// Initializes a new instance of the <see cref="TableLib.TableReader"/> class. /// </summary> /// <param name="type">Indicates whether values are being inserted or dumped.</param> public TableReader (TableReaderType type) { LongestHex = 1; LongestText = new int[1024]; LongestText['<'] = 6; ReaderType = type; TableErrors = new List<TableError>(); LinkedEntries = new SortedList <string, LinkedEntry>(); EndTokens = new List<string>(); LookupValue = new SortedList<string, string>(); if (ReaderType == TableReaderType.ReadTypeInsert) { InitHexTable(); } }
/// <summary> /// Initializes a new instance of the <see cref="TableLib.TableReader"/> class. /// </summary> /// <param name="type">Indicates whether values are being inserted or dumped.</param> public TableReader(TableReaderType type) { LongestHex = 1; LongestText = new int[1024]; LongestText['<'] = 6; ReaderType = type; TableErrors = new List <TableError>(); LinkedEntries = new SortedList <string, LinkedEntry>(); EndTokens = new List <string>(); LookupValue = new SortedList <string, string>(); if (ReaderType == TableReaderType.ReadTypeInsert) { InitHexTable(); } }
public void EntriesReadCorrectly(string entry, string key, string expectedResult, bool expectedOutcome, TableReaderType mode) { TableReader tableReader = new TableReader(mode); bool result = readTableFile(entry, tableReader); Assert.Equal(expectedOutcome, result); if (expectedOutcome) { Assert.Equal(expectedResult, tableReader.LookupValue[key]); } else { Assert.NotEmpty(tableReader.TableErrors); } }
public void LinkEntriesReadCorrectly(string entry, string key, string expectedEntry, int expectedNumber, bool expectedOutcome, TableReaderType mode) { TableReader tableReader = new TableReader(mode); bool result = readTableFile(entry, tableReader); Assert.Equal(expectedOutcome, result); if (expectedOutcome) { Assert.Equal(expectedEntry, tableReader.LinkedEntries[key].Text); Assert.Equal(expectedNumber, tableReader.LinkedEntries[key].Number); } else { Assert.NotEmpty(tableReader.TableErrors); } }