/// <summary>
        /// Get English name<br />
        /// 获取英文名称
        /// </summary>
        /// <param name="chineseSolarTerms"></param>
        /// <returns></returns>
        public static string GetEnglishName(this ChineseSolarTerms chineseSolarTerms)
        {
            var fieldName = EnumsNET.Enums.GetName(chineseSolarTerms);
            var typeInfo  = typeof(ChineseSolarTerms).GetTypeInfo();
            var fieldInfo = typeInfo.GetField(fieldName !);

            return(TypeReflections.GetDescriptionOrDisplayName(fieldInfo));
        }
Exemplo n.º 2
0
        public void FieldLevelDescriptionOrDisplayNameGettingTest()
        {
            var desc1 = TypeReflections.GetDescriptionOrDisplayName(FieldOne);
            var desc2 = TypeReflections.GetDescriptionOrDisplayName(FieldTwo);
            var desc3 = TypeReflections.GetDescriptionOrDisplayName(FieldThree);

            desc1.ShouldBe("FieldOne");
            desc2.ShouldBe("FieldDisplayTwo");
            desc3.ShouldBe("FieldThree");
        }
Exemplo n.º 3
0
        public void PropertyLevelDescriptionOrDisplayNameGettingTest()
        {
            var desc1 = TypeReflections.GetDescriptionOrDisplayName(PropertyOne);
            var desc2 = TypeReflections.GetDescriptionOrDisplayName(PropertyTwo);
            var desc3 = TypeReflections.GetDescriptionOrDisplayName(PropertyThree);

            desc1.ShouldBe("PropertyOne");
            desc2.ShouldBe("PropertyDisplayTwo");
            desc3.ShouldBe("PropertyThree");
        }
Exemplo n.º 4
0
        public void ParameterLevelDescriptionOrDisplayNameGettingTest()
        {
            var desc1 = TypeReflections.GetDescriptionOrDisplayName(ParameterOne);
            var desc2 = TypeReflections.GetDescriptionOrDisplayName(ParameterTwo);
            var desc3 = TypeReflections.GetDescriptionOrDisplayName(ParameterThree);

            desc1.ShouldBe("ArgOne");
            desc2.ShouldBe("ParamDesc");
            desc3.ShouldBe("ArgThree");
        }
Exemplo n.º 5
0
        public void ClassLevelDescriptionOrDisplayNameGettingTest()
        {
            var desc1 = TypeReflections.GetDescriptionOrDisplayName(EntryOne);
            var desc2 = TypeReflections.GetDescriptionOrDisplayName(EntryTwo);
            var desc3 = TypeReflections.GetDescriptionOrDisplayName(EntryThree);
            var desc4 = TypeReflections.GetDescriptionOrDisplayName(Wrapper);
            var desc5 = TypeReflections.GetDescriptionOrDisplayName(Wrapper, ReflectionOptions.Inherit);

            desc1.ShouldBe("NormalClassOne");
#if NETFRAMEWORK
            desc2.ShouldBe("NormalClassDisplayNameTwo");
#else
            desc2.ShouldBe("NormalClassDisplayTwo");
#endif
            desc3.ShouldBe("NormalClassThree");
            desc4.ShouldBe(Wrapper.Name);
            desc5.ShouldBe("NormalClassOne");
        }