public void CanCountColumnsOnFirstRow() { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var reader = new ExcelFileReader(path + "\\BrickRepoTests_BrickList01.xlsx"); reader.SetActiveSheet("ElementData"); reader.ReadRow(); Assert.That(reader.GetColumnCount(), Is.EqualTo(5)); }
public void WillReturnFalseIfColumnDoesntExist() { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var reader = new ExcelFileReader(path + "\\BrickRepoTests_BrickList01.xlsx"); reader.SetActiveSheet("ElementData"); reader.ReadRow(); Assert.That(reader.GetColumnCount(), Is.EqualTo(5)); string result = ""; Assert.That(reader.ReadColumnAsText(8, out result), Is.False); Assert.That(result, Is.EqualTo("")); }
public void CanReadSeveralRows() { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var reader = new ExcelFileReader(path + "\\BrickRepoTests_BrickList01.xlsx"); reader.SetActiveSheet("ElementData"); reader.ReadRow(); Assert.That(reader.GetColumnCount(), Is.EqualTo(5)); string result = ""; Assert.That(reader.ReadColumnAsText(0, out result), Is.True); Assert.That(result, Is.EqualTo("MaterialID")); reader.ReadRow(); Assert.That(reader.ReadColumnAsText(0, out result), Is.True); Assert.That(result, Is.EqualTo("28")); reader.ReadRow(); Assert.That(reader.ReadColumnAsText(0, out result), Is.True); Assert.That(result, Is.EqualTo("37")); }