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

            string description = DescriptionResolver.GetDescription(value);
        }
Beispiel #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());
        }
Beispiel #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);
        }
Beispiel #4
0
        public void GetDescription_ValueHasDescription()
        {
            string description = DescriptionResolver.GetDescription(TestEnum.Item2);

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

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

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