Class UnitySerializedFieldAssertionsTests
EditMode tests for the one comparison in UnitySerializedFieldAssertions that cannot be
reference equality: a restored reference to a SAVED asset. A UnityEngine.Object is a managed
wrapper over a native object and Unity guarantees no single wrapper per object — its own ==
compares instance ids for that reason — so a reference re-marshalled by
Serenity.Global.Infrastructure.Editor.SerenityExistingAssetRestore.Restore's JSON overwrite, or an asset re-imported by the
AssetDatabase.Refresh() a rollback ends with, can arrive as a second wrapper over an asset that
never moved. Assert.AreSame read that as a broken restore and failed
LocalizationLanguageCreatorTests' field walk in CI on a UnityEngine.Texture2D alternate.
What follows pins the replacement rule from both sides: what the production restore seam actually puts
back matches, and nothing that is a DIFFERENT asset — or a different unsaved instance — is let through
by the loosening. The rule is read through
RestoredReferenceMatches(object, object) rather than by catching the
ladder's assertion failures: NUnit records a failed assertion against the running test even when the
exception is caught, so a suite built on Assert.Throws<AssertionException> would report its
own passing cases as failures. Fixtures follow SerenityExistingAssetRestoreTests: one
private temp folder wiped in TearDown() with the safe-delete processor suppressed, and no
Addressables entries to remove.
Inherited Members
Namespace: Serenity.UnityGlobal.Tests.Editor
Assembly: Tests.Editor.dll
Syntax
public class UnitySerializedFieldAssertionsTests
Constructors
UnitySerializedFieldAssertionsTests()
Declaration
public UnitySerializedFieldAssertionsTests()
Methods
AssertRestored_PersistentAssetPutBackByTheRestoreSeam_Passes()
Declaration
public void AssertRestored_PersistentAssetPutBackByTheRestoreSeam_Passes()
OneTimeSetUp()
Declaration
public static void OneTimeSetUp()
OneTimeTearDown()
Declaration
public static void OneTimeTearDown()
RestoredReferenceMatches_DifferentPersistentAssetsCarryingTheSameName_IsFalse()
Declaration
public void RestoredReferenceMatches_DifferentPersistentAssetsCarryingTheSameName_IsFalse()
RestoredReferenceMatches_DistinctUnsavedInstances_IsFalse()
Declaration
public void RestoredReferenceMatches_DistinctUnsavedInstances_IsFalse()
RestoredReferenceMatches_PersistentAssetAgainstAnUnsavedInstance_IsFalse()
Declaration
public void RestoredReferenceMatches_PersistentAssetAgainstAnUnsavedInstance_IsFalse()
RestoredReferenceMatches_SubAssetStandingInForTheMainAssetOfItsFile_IsFalse()
Declaration
public void RestoredReferenceMatches_SubAssetStandingInForTheMainAssetOfItsFile_IsFalse()
RestoredReferenceMatches_ThePersistentAssetItself_IsTrue()
Declaration
public void RestoredReferenceMatches_ThePersistentAssetItself_IsTrue()
SetUp()
Declaration
public void SetUp()
TearDown()
Declaration
public void TearDown()