public void TestInsertColorsWrongLookup() { Color[] lookup = { Color.red, Color.green, Color.blue }; string formatted = string.Format("{0} {1} {2}", CStringUtils.C("red", (CColorCode)0), CStringUtils.C("green", (CColorCode)1), CStringUtils.C("blue", (CColorCode)2), CStringUtils.C("yellow", (CColorCode)3) ); string expected = string.Format("{0} {1} {2}", CStringUtils.C("red", lookup[0]), CStringUtils.C("green", lookup[1]), CStringUtils.C("blue", lookup[2]), CStringUtils.C("yellow", (CColorCode)3) ); string actual = CStringUtils.SetColors(formatted, lookup); Assert.AreEqual(expected, actual); }
public static string SetColors(string line) { return(line != null?CStringUtils.SetColors(line, colors.m_lookup) : null); }