Esempio n. 1
0
            public void OnAPropertyThatIsNotAForeignKeyThrows()
            {
                var otherProperty = typeof(TestDBCRecord).GetProperties()
                                    .First(p => p.Name == nameof(TestDBCRecord.TestSimpleField));

                Assert.Throws <ArgumentException>(() => DBCInspector.GetForeignKeyInfo(otherProperty));
            }
Esempio n. 2
0
            public void OnAPropertyWithoutTheForeignKeyInfoAttributeThrows()
            {
                var invalidForeignKeyProperty = typeof(TestDBCRecordInvalidForeignKeyField).GetProperties()
                                                .First(p => p.Name == nameof(TestDBCRecordInvalidForeignKeyField.TestForeignKeyFieldMissingInfo));

                Assert.Throws <InvalidDataException>(() => DBCInspector.GetForeignKeyInfo(invalidForeignKeyProperty));
            }
Esempio n. 3
0
            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);
            }