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); }