public void OnAPropertyThatIsNotAForeignKeyThrows() { var otherProperty = typeof(TestDBCRecord).GetProperties() .First(p => p.Name == nameof(TestDBCRecord.TestSimpleField)); Assert.Throws <ArgumentException>(() => DBCInspector.GetForeignKeyInfo(otherProperty)); }
public void OnAPropertyWithoutTheForeignKeyInfoAttributeThrows() { var invalidForeignKeyProperty = typeof(TestDBCRecordInvalidForeignKeyField).GetProperties() .First(p => p.Name == nameof(TestDBCRecordInvalidForeignKeyField.TestForeignKeyFieldMissingInfo)); Assert.Throws <InvalidDataException>(() => DBCInspector.GetForeignKeyInfo(invalidForeignKeyProperty)); }
public void OnAValidForeignKeyPropertyReturnsValidData() { var foreignKeyProperty = typeof(TestDBCRecord).GetProperties() .First(p => p.Name == nameof(TestDBCRecord.TestForeignKeyField)); var foreignKeyInfo = DBCInspector.GetForeignKeyInfo(foreignKeyProperty); Assert.AreEqual(DatabaseName.AnimationData, foreignKeyInfo.Database); Assert.AreEqual(nameof(AnimationDataRecord.ID), foreignKeyInfo.Field); }