public void ItShouldGetEnumerationsList()
        {
            Assert.That(Database, Is.Not.Null);
            ida_enum testEnumeration = Database.Enumerations.First(e => e.Name == "TestEnumeration");

            Assert.That(testEnumeration.Name, Is.Not.Null);
            Assert.That(testEnumeration.IsBitfield, Is.False);
            ida_enum_const constant0 = testEnumeration.Constants.Find(c => c.Name == "TestConstant_0");

            Assert.That(constant0, Is.Not.Null);
            ida_enum_const constant1 = testEnumeration.Constants.Find(c => c.Name == "TestConstant_1");

            Assert.That(constant1, Is.Not.Null);
        }
示例#2
0
        public static void AddConstant(this ida_enum @enum, string name, int value, int?mask = null)
        {
            var @const = new ida_enum_const {
                Name = name, Value = value
            };

            if (mask != null)
            {
                @const.Mask = mask.Value;
            }
            else if (@enum.IsBitfield)
            {
                @const.Mask = value;
            }
            @enum.Constants.Add(@const);
        }