Class SerenityAssetDeleteProbe
A test seam for asserting what was true AT THE MOMENT one particular asset was deleted — the only place
from which SerenityAssetCreationTransaction.Rollback's internal ordering is observable, since
everything it does is undone or persisted again by the time the call returns. Records whether
Serenity.Global.Infrastructure.Editor.Validation.References.SerenitySafeDeleteAssetProcessor was suppressed and the value of a caller-supplied probe,
then always answers UnityEditor.AssetDeleteResult.DidNotDelete so the delete itself proceeds untouched.
Unity keeps every UnityEditor.AssetModificationProcessor in the editor's callback list for the whole session, this one included, so it stays inert unless a test called Watch(string, Func<object>) for an exact path — and every test that calls it calls StopWatching() in its teardown.
Namespace: Serenity.UnityGlobal.Tests.Editor
Assembly: Tests.Editor.dll
Syntax
public sealed class SerenityAssetDeleteProbe : AssetModificationProcessor
Constructors
SerenityAssetDeleteProbe()
Declaration
public SerenityAssetDeleteProbe()
Properties
Observed
Whether the watched path was deleted while the watch was active.
Declaration
public static bool Observed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ProbedValue
Whatever the probe handed to Watch(string, Func<object>) returned at that moment.
Declaration
public static object ProbedValue { get; }
Property Value
| Type | Description |
|---|---|
| object |
SuppressedAtDelete
Whether the safe-delete processor was suppressed when the watched path was deleted.
Declaration
public static bool SuppressedAtDelete { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
StopWatching()
Stops watching, drops the probe and clears everything the watch recorded, so nothing this fixture built — including a stale observation a later test could read as its own — outlives the test. Read the recorded values BEFORE calling this.
Declaration
public static void StopWatching()
Watch(string, Func<object>)
Starts watching one exact asset path, clearing anything a previous watch recorded.
Declaration
public static void Watch(string assetPath, Func<object> valueProbe = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | |
| Func<object> | valueProbe |