예제 #1
0
        public void PopulatesPropertiesForFlagsAttributedEnumTest()
        {
            // Act
            var enumValue = EnumValue.For(TestEnum.Value1 | TestEnum.Value2);

            // Assert
            Assert.AreEqual(TestEnum.Value1 | TestEnum.Value2, enumValue.Value);
            Assert.AreEqual(Enum.Parse(typeof(TestEnum), "Value1,Value2"), enumValue.Enum);
            Assert.AreEqual(3, enumValue.Id);
            Assert.AreEqual("Value1, Value2", enumValue.Name);
            Assert.AreEqual("Value1 Desc, Value2 Desc", enumValue.Description);
            Assert.IsTrue(enumValue.Obsolete);
        }
예제 #2
0
        public void PopulatesPropertiesForEnumWithNoAttributesTest()
        {
            // Act
            var enumValue = EnumValue.For(TestEnum.Value4);

            // Assert
            Assert.AreEqual(TestEnum.Value4, enumValue.Value);
            Assert.AreEqual(Enum.Parse(typeof(TestEnum), "Value4"), enumValue.Enum);
            Assert.AreEqual(4, enumValue.Id);
            Assert.AreEqual("Value4", enumValue.Name);
            Assert.AreEqual(null, enumValue.Description);
            Assert.IsFalse(enumValue.Obsolete);
        }