Example #1
0
        public void AddingAValidAbbreviation()
        {
            EnumExtensions.ClearAbbreviations <TestEnum>();

            string abbreviation = "Fst";

            TestEnum.TheFirst.AddAbbreviation(abbreviation);

            Assert.AreEqual(TestEnum.TheFirst.GetAbbreviation(), abbreviation);
        }
Example #2
0
        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);
        }