public void TypeDictionaryEntryAttributeTests() { //make sure the value is string.Empty TypeDictionaryEntryAttribute val = new TypeDictionaryEntryAttribute(); Assert.AreEqual(val.Name, string.Empty); Assert.AreEqual(val.Value, string.Empty); //get a member info to ourself Type t = typeof(EncodeHelperTests); System.Reflection.MemberInfo mi = t.GetMember("EnumSerilizedNameTests")[0]; Assert.AreEqual(string.Empty, TypeDictionaryEntryAttribute.GetValue(mi, "Test")); Assert.AreEqual(string.Empty, ShippingTypeHelper.GetSerializedName(ShippingType.Unknown)); Assert.AreEqual(string.Empty, ShippingTypeHelper.GetShippingCompany(ShippingType.Unknown)); }
/// <summary> /// Get the Shipping Comany Name for an Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetShippingCompany(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return(TypeDictionaryEntryAttribute.GetValue(fi, "shipping-company")); }