public void ChangesAreAppliedToAsset_KeyName() { var so = new SerializedObject(m_TestFixture); var property = so.FindProperty("tableEntryReference"); var serializedTableEntryReference = new SerializedTableEntryReference(property); serializedTableEntryReference.Reference = "Key name"; so.ApplyModifiedProperties(); Assert.AreEqual(serializedTableEntryReference.Reference, m_TestFixture.tableEntryReference, "Expected Key Name to be applied to asset when changed through SerializedTableEntryReference."); }
void CheckSerializedTableEntryReferenceMatchesOriginalData() { var so = new SerializedObject(m_TestFixture); var property = so.FindProperty("tableEntryReference"); SerializedTableEntryReference serializedTableEntryReference = new SerializedTableEntryReference(property); Assert.AreEqual(m_TestFixture.tableEntryReference.KeyId, serializedTableEntryReference.Reference.KeyId, "Expected the key id to match but it did not. The SerializedTableEntryReference should be able to recreate the TableEntryReference struct via the SerializedProperties."); Assert.AreEqual(m_TestFixture.tableEntryReference.Key, serializedTableEntryReference.Reference.Key, "Expected the key to match but it did not. The SerializedTableEntryReference should be able to recreate the TableEntryReference struct via the SerializedProperties."); Assert.AreEqual(m_TestFixture.tableEntryReference, serializedTableEntryReference.Reference, "Expected references to be equal but they were not. The SerializedTableEntryReference should be able to recreate the TableEntryReference struct via the SerializedProperties."); }
public void ChangesAreAppliedToAsset_EmptyId() { m_TestFixture.tableEntryReference = 123; // Make it a Key Id by default var so = new SerializedObject(m_TestFixture); var property = so.FindProperty("tableEntryReference"); var serializedTableEntryReference = new SerializedTableEntryReference(property); // Now clear serializedTableEntryReference.Reference = SharedTableData.EmptyId; so.ApplyModifiedProperties(); Assert.AreEqual(serializedTableEntryReference.Reference, m_TestFixture.tableEntryReference, "Expected reference to be Empty when changed through SerializedTableEntryReference."); }