示例#1
0
        public void GetDescription_ValueNotDefined_ThrowsException()
        {
            //Force a value that isn't defined
            TestEnum value = (TestEnum)0;

            string description = DescriptionResolver.GetDescription(value);
        }
示例#2
0
        public void TryGetDescription_ValueNotDefined()
        {
            //Force a value that isn't defined
            TestEnum value = (TestEnum)0;

            string description = DescriptionResolver.TryGetDescription(value);

            Assert.AreEqual(description, value.ToString());
        }
示例#3
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);
        }
示例#4
0
        public void GetDescription_ValueHasDescription()
        {
            string description = DescriptionResolver.GetDescription(TestEnum.Item2);

            Assert.AreEqual(description, "Second Item");
        }
示例#5
0
        public void GetDescription_ValueDoesNotHaveDescription()
        {
            string description = DescriptionResolver.GetDescription(TestEnum.Item1);

            Assert.AreEqual(description, TestEnum.Item1.ToString());
        }
示例#6
0
 public void GetDescription_ValueNull_ThrowsException()
 {
     string description = DescriptionResolver.GetDescription(null);
 }
示例#7
0
        public void GetDescription_ValueNull()
        {
            string description = DescriptionResolver.TryGetDescription(null);

            Assert.AreEqual(description, string.Empty);
        }