public void AutoSizeColumn_untrackColumnsForAutoSizing() { workbook = new SXSSFWorkbook(); sheet = workbook.CreateSheet() as SXSSFSheet; sheet.TrackColumnForAutoSizing(15); sheet.TrackColumnsForAutoSizing(columns); sheet.UntrackColumnsForAutoSizing(columns); Assume.That(sheet.TrackedColumnsForAutoSizing.Contains(15)); sheet.AutoSizeColumn(15, useMergedCells); try { Assume.That(!sheet.TrackedColumnsForAutoSizing.Contains(columns.First())); sheet.AutoSizeColumn(columns.First(), useMergedCells); Assert.Fail("Should not be able to auto-size an untracked column"); } catch (InvalidOperationException) { // expected } }
public void AutoSizeColumn_trackColumnForAutoSizing() { workbook = new SXSSFWorkbook(); sheet = workbook.CreateSheet() as SXSSFSheet; sheet.TrackColumnForAutoSizing(0); SortedSet <int> expected = new SortedSet <int>(); expected.Add(0); Assert.AreEqual(expected, sheet.TrackedColumnsForAutoSizing); sheet.AutoSizeColumn(0, useMergedCells); try { sheet.AutoSizeColumn(1, useMergedCells); Assert.Fail("Should not be able to auto-size an untracked column"); } catch (InvalidOperationException) { // expected } }