public void AddingAValidAbbreviation() { EnumExtensions.ClearAbbreviations <TestEnum>(); string abbreviation = "Fst"; TestEnum.TheFirst.AddAbbreviation(abbreviation); Assert.AreEqual(TestEnum.TheFirst.GetAbbreviation(), abbreviation); }
public void AddingADuplicateAbbreviation() { EnumExtensions.ClearAbbreviations <TestEnum>(); string abbreviation = "Fst"; TestEnum.TheFirst.AddAbbreviation(abbreviation); string expectedMessage = string.Format("Enum value '{0}' already has an abbreviation registered", TestEnum.TheFirst.ToString()); Assert.AreEqual(ExceptionMessage(() => TestEnum.TheFirst.AddAbbreviation(abbreviation)), expectedMessage); }