public static object Enum(Type t) { var count = GetEnum.Count(t); var index = Int32(0, count); return(GetEnum.Value(t, index)); }
public void ValueTest() { Assert.AreEqual(IsoGender.NotKnown, GetEnum.Value <IsoGender>(0)); Assert.AreEqual(IsoGender.Male, GetEnum.Value <IsoGender>(1)); Assert.AreEqual(IsoGender.Female, GetEnum.Value <IsoGender>(2)); Assert.AreEqual(IsoGender.NotApplicable, GetEnum.Value <IsoGender>(3)); }
public void ValueByTypeTest() { Assert.AreEqual(IsoGender.NotKnown, GetEnum.Value(typeof(IsoGender), 0)); Assert.AreEqual(IsoGender.Male, GetEnum.Value(typeof(IsoGender), 1)); Assert.AreEqual(IsoGender.Female, GetEnum.Value(typeof(IsoGender), 2)); Assert.AreEqual(IsoGender.NotApplicable, GetEnum.Value(typeof(IsoGender), 3)); }
public void TestEnumProperty <T>(Func <T> get, Action <T> set) { Assert.IsTrue(typeof(T).IsEnum); var i = GetEnum.Value <T>(0); Assert.AreEqual(i, get()); var s = GetRandom.Enum <T>(); set(s); Assert.AreEqual(s, get()); }
public void ValueTest() { Assert.AreEqual(EventType.Concert, GetEnum.Value <EventType>(0)); Assert.AreEqual(EventType.Party, GetEnum.Value <EventType>(1)); Assert.AreEqual(EventType.Sport, GetEnum.Value <EventType>(2)); Assert.AreEqual(EventType.Music, GetEnum.Value <EventType>(3)); Assert.AreEqual(EventType.Theatre, GetEnum.Value <EventType>(4)); Assert.AreEqual(EventType.Festival, GetEnum.Value <EventType>(5)); Assert.AreEqual(EventType.Folk, GetEnum.Value <EventType>(6)); Assert.AreEqual(EventType.Family, GetEnum.Value <EventType>(7)); Assert.AreEqual(EventType.Exhibition, GetEnum.Value <EventType>(8)); Assert.AreEqual(EventType.Other, GetEnum.Value <EventType>(9)); }
public void ValueByTypeTest() { Assert.AreEqual(EventType.Concert, GetEnum.Value(typeof(EventType), 0)); Assert.AreEqual(EventType.Party, GetEnum.Value(typeof(EventType), 1)); Assert.AreEqual(EventType.Sport, GetEnum.Value(typeof(EventType), 2)); Assert.AreEqual(EventType.Music, GetEnum.Value(typeof(EventType), 3)); Assert.AreEqual(EventType.Theatre, GetEnum.Value(typeof(EventType), 4)); Assert.AreEqual(EventType.Festival, GetEnum.Value(typeof(EventType), 5)); Assert.AreEqual(EventType.Folk, GetEnum.Value(typeof(EventType), 6)); Assert.AreEqual(EventType.Family, GetEnum.Value(typeof(EventType), 7)); Assert.AreEqual(EventType.Exhibition, GetEnum.Value(typeof(EventType), 8)); Assert.AreEqual(EventType.Other, GetEnum.Value(typeof(EventType), 9)); }