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

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

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

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

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