public static IEnumerable <ICell> Range(this IRow row, string from, string to) { if (row == null) { throw new ArgumentNullException(nameof(row)); } if (from == null) { throw new ArgumentNullException(nameof(from)); } if (to == null) { throw new ArgumentNullException(nameof(to)); } var start = ExcelNumber.ToNumerical(from); var end = ExcelNumber.ToNumerical(to); if (end < start) { throw new InvalidOperationException($"'{nameof(from)}' should be less or equal to '{nameof(to)}'"); } return(Enumerable.Range(start, end - start + 1).Select(i => row[i])); }
public ICell this[string columnName] { get { if (columnName == null) { throw new ArgumentNullException(nameof(columnName)); } var index = ExcelNumber.ToNumerical(columnName); return(this[index]); } }
public void ParseNullNumber() { Assert.That(() => ExcelNumber.ToNumerical(null), Throws.Exception.TypeOf <ArgumentNullException>()); }
public void ParseInvalidNumber(string alphabetical) { Assert.That(() => ExcelNumber.ToNumerical(alphabetical), Throws.Exception.TypeOf <FormatException>()); }
public void ParseValidNumber(string alphabetical, int expected) { var numerical = ExcelNumber.ToNumerical(alphabetical); Assert.That(numerical, Is.EqualTo(expected)); }