Ejemplo n.º 1
0
        public void GetDescription_ValueNotDefined_ThrowsException()
        {
            //Force a value that isn't defined
            TestEnum value = (TestEnum)0;

            string description = DescriptionResolver.GetDescription(value);
        }
Ejemplo n.º 2
0
        public void GetDescription_TypeIsNotAnEnum_ThrowsException()
        {
            //C# won't allow generic parameters to be constrainted to enums
            //so we have to allow structs.  We don't have to be happy about it
            //though so we'll throw an exception if the supplied type is not
            //an enum.
            TestStruct value = new TestStruct();

            string description = DescriptionResolver.GetDescription(value);
        }
Ejemplo n.º 3
0
        public void GetDescription_ValueHasDescription()
        {
            string description = DescriptionResolver.GetDescription(TestEnum.Item2);

            Assert.AreEqual(description, "Second Item");
        }
Ejemplo n.º 4
0
        public void GetDescription_ValueDoesNotHaveDescription()
        {
            string description = DescriptionResolver.GetDescription(TestEnum.Item1);

            Assert.AreEqual(description, TestEnum.Item1.ToString());
        }
Ejemplo n.º 5
0
 public void GetDescription_ValueNull_ThrowsException()
 {
     string description = DescriptionResolver.GetDescription(null);
 }