public void ESFRecord_InvalidPropertyReturnType_ThrowsInvalidCastException() { var rec = new ESFRecord { Name = "" }; Assert.Throws <InvalidCastException>(() => rec.Get <int>(PubRecordProperty.GlobalName)); }
public void ESFRecord_GetClassProperty_ThrowsArgumentOutOfRangeException() { const PubRecordProperty invalidProperty = PubRecordProperty.ClassAgi; var record = new ESFRecord(); Assert.Throws <ArgumentOutOfRangeException>(() => record.Get <object>(invalidProperty)); }
public void ESFRecord_GetGlobalPropertyName_GetsRecordName() { const string expected = "some name"; var rec = new ESFRecord { Name = expected }; var actual = rec.Get <string>(PubRecordProperty.GlobalName); Assert.AreEqual(expected, actual); }
public void ESFRecord_GetGlobalPropertyID_GetsRecordID() { const int expected = 44; var rec = new ESFRecord { ID = expected }; var actual = rec.Get <int>(PubRecordProperty.GlobalID); Assert.AreEqual(expected, actual); }
public void ESFRecord_GetSpellPropertiesComprehensive_NoException() { var spellProperties = Enum.GetNames(typeof(PubRecordProperty)) .Where(x => x.StartsWith("Spell")) .Select(x => (PubRecordProperty)Enum.Parse(typeof(PubRecordProperty), x)) .ToArray(); Assert.AreNotEqual(0, spellProperties.Length); var record = new ESFRecord { Shout = "" }; foreach (var property in spellProperties) { var dummy = record.Get <object>(property); Assert.IsNotNull(dummy); } }