public void AssetReference_SetEditorAsset_ReturnsNullIfObjectTypeIsIncorrect() { AssetReferenceT <Sprite> incorrectlyTypedAssetReference = new AssetReferenceT <Sprite>("badguid"); incorrectlyTypedAssetReference.SetEditorAsset(subSO); Assert.IsNull(incorrectlyTypedAssetReference.editorAsset, "Attempting to set an editor asset of an incorrect type should return null."); }
public void AssetReference_SetEditorAsset_SucceedsOnMatchedTypeAssetReference() { AssetReference typeCorrectReference = new AssetReferenceT <TestSubObject>("badguid"); typeCorrectReference.SetEditorAsset(subSO); Assert.NotNull(typeCorrectReference.editorAsset, "Attempting to set editor asset on an AssetReferenceT should return the first matching object at the guid"); Assert.AreEqual(subSO, typeCorrectReference.editorAsset, "Attempting to set editor asset on an AssetReferenceT should return the first matching object at the guid"); }
public void AssetReference_SetEditorAsset_NullsOnAttemptWithWrongTypeFromDerivedType() { var guid = AssetDatabase.AssetPathToGUID(m_ScriptableObjectPath); AssetReference typeConflictReference = new AssetReferenceT <Animation>("badguid"); typeConflictReference.SetEditorAsset(mainSO); Assert.IsNull(typeConflictReference.editorAsset, "Attempting to set editor asset on an AssetReferenceT should return null if the types do not match."); }
public void AssetReference_SetEditorAsset_ReturnsCorrectObjectIfMultipleOfSameTypeExist() { AssetReferenceT <TestSubObject> typedAssetReference = new AssetReferenceT <TestSubObject>("badguid"); typedAssetReference.SetEditorAsset(subSO2); Assert.AreEqual(subSO2, typedAssetReference.editorAsset, "When using a typed asset reference, the editor asset should be set to the requested object even if its a subobject."); Assert.AreNotEqual(subSO, typedAssetReference.editorAsset, "When using a typed asset reference, the editor asset should be set to specifically the requested object, not just an object with the same type and guid."); }
public void AssetReference_SetEditorAsset_CorrectlySetsSubAssetWhenUsingTypedReference() { AssetReferenceT <TestSubObject> typedAssetReference = new AssetReferenceT <TestSubObject>("badguid"); typedAssetReference.SetEditorAsset(subSO); Assert.AreEqual(subSO, typedAssetReference.editorAsset, "When using a typed asset reference, the editor asset should be set to the requested object even if its a subobject."); AssetReference typedAssetReference2 = new AssetReferenceT <TestSubObject>("badguid"); typedAssetReference2.SetEditorAsset(subSO); Assert.AreEqual(subSO, typedAssetReference2.editorAsset, "When using a typed asset reference, the editor asset should be set to the requested object even if its a subobject."); }