예제 #1
0
        public void TestToDescriptionDictionaryNominal()
        {
            var descriptionDictionary = ExtensionsEnum.GetDescriptionDictionary <TestEnum>();

            Assert.NotEmpty(descriptionDictionary);
            Assert.Equal(3, descriptionDictionary.Count);
            Assert.Equal(string.Empty, descriptionDictionary["Valeur1"]);
            Assert.Null(descriptionDictionary["Valeur2"]);
            Assert.Equal("Troisième valeur", descriptionDictionary["Valeur3"]);
        }
예제 #2
0
        private void showEntries(IEnumerable <IEntry <string, object> > _map)
        {
            Console.WriteLine(_map.GetType());
            foreach (IEntry <string, object> e in _map)
            {
                Console.WriteLine(e.getKey() + " " + e.getValue());
                Console.WriteLine(e.getKey().GetType() + " " + e.getValue().GetType());
                foreach (Type t in e.GetType().GetGenericArguments())
                {
                    Console.WriteLine(t);
                }
            }
            object o   = Hobbies.AIKIDO;
            bool   is_ = o is Enum;
            Enum   h_  = o as Enum;

            Console.WriteLine(h_.getFullName() + " " + is_);
            Console.WriteLine(ExtensionsEnum.getFullName(h_) + " " + is_);
            //_map.getKeys();
            Console.WriteLine(_map is IEnumerable <IEntry <object, object> >);
        }
예제 #3
0
 public static string CreateId(string userId, NanokaEntity entity, string entityId)
 => $"{userId}_{ExtensionsEnum<NanokaEntity>.GetName(entity)}_{entityId}";