public void SetFillForegroundColorBeforeFillBackgroundColorEnum() { IWorkbook wb1 = _testDataProvider.CreateWorkbook(); ICell A1 = wb1.CreateSheet().CreateRow(0).CreateCell(0); Dictionary <String, Object> properties = new Dictionary <String, Object>(); // FIXME: Use FillPattern.BRICKS enum properties.Add(CellUtil.FILL_PATTERN, FillPattern.Bricks); properties.Add(CellUtil.FILL_FOREGROUND_COLOR, IndexedColors.Blue.Index); properties.Add(CellUtil.FILL_BACKGROUND_COLOR, IndexedColors.Red.Index); CellUtil.SetCellStyleProperties(A1, properties); ICellStyle style = A1.CellStyle; // FIXME: Use FillPattern.BRICKS enum Assert.AreEqual(FillPattern.Bricks, style.FillPattern, "fill pattern"); Assert.AreEqual(IndexedColors.Blue, IndexedColors.FromInt(style.FillForegroundColor), "fill foreground color"); Assert.AreEqual(IndexedColors.Red, IndexedColors.FromInt(style.FillBackgroundColor), "fill background color"); }
public void FromInt() { int[] illegalIndices = { -1, 0, 27, 65 }; foreach (int index in illegalIndices) { try { IndexedColors.FromInt(index); Assert.Fail("Expected ArgumentException: " + index); } catch (ArgumentException) { // expected } } Assert.AreEqual(IndexedColors.Black, IndexedColors.FromInt(8)); Assert.AreEqual(IndexedColors.Gold, IndexedColors.FromInt(51)); Assert.AreEqual(IndexedColors.Automatic, IndexedColors.FromInt(64)); }