private String tryColor(String desc, String cname, CellValue Getter, Object value, String expectedText, Color expectedColor) { if (cname != null) desc = "[" + cname + "]" + desc; Color origColor = label.ForeColor; CellFormatPart format = new CellFormatPart(desc); if (!format.Apply(label, value).Applies) { // If this doesn't Apply, no color change is expected expectedColor = origColor; } String actualText = label.Text; Color actualColor = label.ForeColor; Getter.Equivalent(expectedText, actualText, format); Assert.AreEqual( expectedColor, actualColor,cname == null ? "no color" : "color " + cname); return actualText; }