Namespace Serenity.Tests.Shared.Fakes
Classes
FakeAtomicFileWriterService
No-op IAtomicFileWriterService implementation for testing.
FakeBlobStore
No-op IBlobStore implementation for testing.
FakeEventDispatcherService
No-op IEventDispatcherService implementation for testing.
FakeFileSystemService
No-op IFileSystemService implementation for testing.
FakeLogService
No-op ILogService implementation for testing.
FakeLogSettings
No-op ILogSettings implementation for testing.
GatedKeyValueStore
In-memory IKeyValueStore whose FIRST GetAsync call captures the current value and then suspends until the test calls ReleaseFirstReadGate() — returning the value it captured BEFORE suspending. This lets a test hold one read-modify-write cycle open on its stale snapshot while issuing a second concurrent operation, proving (or disproving) lost-update protection in the store under test.
InMemoryBlobStore
In-memory IBlobStore implementation for testing.
InMemoryKeyValueStore
In-memory IKeyValueStore implementation for testing.
InMemoryStructuredStore
In-memory IStructuredStore used for tests. Delegates every filter/sort/distinct/ trim computation to StructuredQueryEngine — the same engine every real backend delegates to — so this fake exercises the exact same semantics as production stores.
RecordingEventDispatcherService
IEventDispatcherService implementation that both records every dispatched
signal for assertions and delivers it to subscribers, so a test can assert on what a service
broadcast and drive an EventDispatcherAction through the same instance.
RecordingLogService
ILogService implementation that records every message it is given, for assertions.
RecordingScoreService
IScoreService implementation backed by an in-memory dictionary, recording how often each mutation was called so a test can assert both the resulting value and the fact that the service was (or was not) touched at all.
RecordingViewBase
Plain IViewBase that records show/hide calls, for router/browser tests.
RecordingViewBrowserService
Real-shaped IViewBrowserService over a plain list, so tests can push, pop and inspect the navigation history without a MonoBehaviour.
ScratchAssetFixture
One scratch-asset fixture for EditMode tests that create real assets under a throwaway folder and must
leave nothing behind: a folder to create assets in, a GUID ledger for the Addressables entries those
assets may pick up, and a delete pass that removes both. Replaces the ~60-line "scratch settings asset"
fixture ten test suites used to hand-roll on their own — UnitySingletonSettingsLoaderTests,
UnityCollectionSettingsLoaderTests, WiredOrDiscoveredSettingsTests,
SystemAdoptionRunnerTests, ProjectWiringPinResolutionTests,
AdoptedReferenceRemapperTests, AdoptedReferenceEndToEndTests,
SerenityAdoptedReferenceValidatorTests, FoundationReferenceIndexTests and
SerenityPackageContentRelocatorTests.
A test owns one instance per [SetUp]/[TearDown] pair, constructed with every scratch
folder the test will use (so a crashed previous run's leftovers are still reachable before this test
creates anything), and disposes it in [TearDown]:
private ScratchAssetFixture _fixture;
[SetUp]
public void SetUp()
{
_fixture = new ScratchAssetFixture(PackageScratchFolder, ProjectScratchFolder);
_fixture.DeleteScratchFolders();
}
[TearDown]
public void TearDown() => _fixture.Dispose();
UnityAddressablesLabeler.RetagAssets is internal to the Global editor assembly and only
Tests.Editor carries an InternalsVisibleTo grant for it, not this fixture's own
Tests assembly — so retagging a created asset as Addressable stays one call at the test's own
call site, right after CreateSettingsAsset<TSettings>(string, string, string, string) or SaveAsset(Object, string, string, string) returns
its path.
ScratchAssetFixtureTestSettings
A throwaway IFoundationSettings asset type for ScratchAssetFixture's own
tests. Lives in its own same-named file so Unity can bind its script when a test creates it as an
asset (mirrors UnitySingletonSettingsLoaderTestSettings).
SystemAdoptionTestIdentityComponent
Identity-carrying IFoundationSettings UnityEngine.MonoBehaviour fixture —
stands in for UnitySerenityInstaller/UnityFeedbackService/etc. so a system-adoption test
can build a prefab the closure must exclude instead of cloning. Carries one object reference field so
a test can assert the closure walk never follows an excluded prefab's own dependencies. Lives in the
runtime Tests assembly, not an editor-only one: Unity refuses AddComponent for a type
defined in an editor script assembly ("Can't add script behaviour ... because it is an editor script.").
ThrowingBlobStore
IBlobStore implementation whose every operation throws, for failure-path testing.
ThrowingKeyValueStore
IKeyValueStore implementation whose every operation throws, for failure-path testing.