Exemplo n.º 1
0
        public void EIFRecord_GetSpellProperty_ThrowsArgumentOutOfRangeException()
        {
            const PubRecordProperty invalidProperty = PubRecordProperty.SpellAccuracy;

            var record = new EIFRecord();

            Assert.Throws <ArgumentOutOfRangeException>(() => record.Get <object>(invalidProperty));
        }
Exemplo n.º 2
0
        public void ENFRecord_GetClassProperty_ThrowsArgumentOutOfRangeException()
        {
            const PubRecordProperty invalidProperty = PubRecordProperty.ClassAgi;

            var record = new ENFRecord();

            Assert.Throws <ArgumentOutOfRangeException>(() => record.Get <object>(invalidProperty));
        }
Exemplo n.º 3
0
        public void ESFRecord_GetItemProperty_ThrowsArgumentOutOfRangeException()
        {
            const PubRecordProperty invalidProperty = PubRecordProperty.ItemSubType;

            var record = new ESFRecord();

            Assert.Throws <ArgumentOutOfRangeException>(() => record.Get <object>(invalidProperty));
        }
Exemplo n.º 4
0
        public TValue Get <TValue>(PubRecordProperty type)
        {
            var name = Enum.GetName(type.GetType(), type) ?? "";

            if (!name.StartsWith("Global") && !name.StartsWith("Spell"))
            {
                throw new ArgumentOutOfRangeException(nameof(type), "Unsupported property requested for ESFRecord");
            }

            if (name.StartsWith("Global"))
            {
                name = name.Substring(6);
            }
            else if (name.StartsWith("Spell"))
            {
                name = name.Substring(5);
            }

            var propertyInfo = GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
            var boxedValue   = propertyInfo.GetValue(this);

            return((TValue)boxedValue);
        }
Exemplo n.º 5
0
 public TValue Get <TValue>(PubRecordProperty type)
 {
     return(default(TValue));
 }