public static void KnownValuesReturnsValuesProducedByTheFunctionSpecifiedInConstructor()
 {
     var attribute = new KnownValuesAttribute(typeof(KnownValuesAttributeTest), "TestValueFactory");
     Assert.Equal(2, attribute.KnownValues.Count);
     Assert.Same("Value1", attribute.KnownValues[0].DisplayName);
     Assert.Same("Value2", attribute.KnownValues[1].DisplayName);
 }
        public static void KnownValuesReturnsValuesProducedByTheFunctionSpecifiedInConstructor()
        {
            var attribute = new KnownValuesAttribute(typeof(KnownValuesAttributeTest), "TestValueFactory");

            Assert.Equal(2, attribute.KnownValues.Count);
            Assert.Same("Value1", attribute.KnownValues[0].DisplayName);
            Assert.Same("Value2", attribute.KnownValues[1].DisplayName);
        }
 public static void KnownValueDescriptionReturnsDescriptionSpecifiedInDisplayAttribute()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithDescription));
     Assert.Equal("Display.Description", attribute.KnownValues[0].Description);
 }
 public static void KnownValueDescriptionReturnsEmptyStringWhenEnumValueHasNoDisplayAttribute()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithoutDisplayAttribute));
     Assert.Equal(string.Empty, attribute.KnownValues[0].Description);
 }
 public static void KnownValueDisplayNameReturnsNameOfEnumValueWhenDisplayAttributeDoesNotSpecifyName()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithDescription));
     Assert.Equal("Value", attribute.KnownValues[0].DisplayName);
 }
 public static void KnownValueDisplayNameReturnsValueSpecifiedInDisplayAttribute()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithDisplayName));
     Assert.Equal("Display.Name", attribute.KnownValues[0].DisplayName);
 }
 public static void KnownValueDisplayNameReturnsNameOfEnumValueWithoutDisplayAttribute()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithoutDisplayAttribute));
     Assert.Equal("Value", attribute.KnownValues[0].DisplayName);
 }
 public static void KnownValueCachesResultToImprovePerformance()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithThreeValues));
     Assert.Same(attribute.KnownValues, attribute.KnownValues);
 }
 public static void KnownValuesReturnsListOfValuesDefinedInEnumType()
 {
     var attribute = new KnownValuesAttribute(typeof(EnumWithThreeValues));
     Assert.Equal(3, attribute.KnownValues.Count);
 }
Exemplo n.º 10
0
        public static void KnownValueDescriptionReturnsDescriptionSpecifiedInDisplayAttribute()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithDescription));

            Assert.Equal("Display.Description", attribute.KnownValues[0].Description);
        }
Exemplo n.º 11
0
        public static void KnownValueDescriptionReturnsEmptyStringWhenEnumValueHasNoDisplayAttribute()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithoutDisplayAttribute));

            Assert.Equal(string.Empty, attribute.KnownValues[0].Description);
        }
Exemplo n.º 12
0
        public static void KnownValueDisplayNameReturnsNameOfEnumValueWhenDisplayAttributeDoesNotSpecifyName()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithDescription));

            Assert.Equal("Value", attribute.KnownValues[0].DisplayName);
        }
Exemplo n.º 13
0
        public static void KnownValueDisplayNameReturnsValueSpecifiedInDisplayAttribute()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithDisplayName));

            Assert.Equal("Display.Name", attribute.KnownValues[0].DisplayName);
        }
Exemplo n.º 14
0
        public static void KnownValueDisplayNameReturnsNameOfEnumValueWithoutDisplayAttribute()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithoutDisplayAttribute));

            Assert.Equal("Value", attribute.KnownValues[0].DisplayName);
        }
Exemplo n.º 15
0
        public static void KnownValueCachesResultToImprovePerformance()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithThreeValues));

            Assert.Same(attribute.KnownValues, attribute.KnownValues);
        }
Exemplo n.º 16
0
        public static void KnownValuesReturnsListOfValuesDefinedInEnumType()
        {
            var attribute = new KnownValuesAttribute(typeof(EnumWithThreeValues));

            Assert.Equal(3, attribute.KnownValues.Count);
        }