diff --git a/DotNet~/ShrinkSDK.Context.AppAdapter.csproj b/DotNet~/ShrinkSDK.Context.AppAdapter.csproj
index 926d4ab..a23d85f 100644
--- a/DotNet~/ShrinkSDK.Context.AppAdapter.csproj
+++ b/DotNet~/ShrinkSDK.Context.AppAdapter.csproj
@@ -5,13 +5,13 @@
ShrinkContext.AppAdapter
ShrinkContext.AppAdapter
ShrinkSDK.Context.AppAdapter
- 0.2.4
+ 0.2.5
Engine-neutral ShrinkContext composition host for ShrinkApp.
false
-
-
+
+
diff --git a/Tests/NativeWiringTests.cs b/Tests/NativeWiringTests.cs
index bc1d919..e864fe2 100644
--- a/Tests/NativeWiringTests.cs
+++ b/Tests/NativeWiringTests.cs
@@ -1,6 +1,8 @@
#nullable enable
using System;
+using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using NUnit.Framework;
using ShrinkApp.Starter.Basic;
using ShrinkCommand.Integration.App;
@@ -10,6 +12,7 @@ using ShrinkNetwork;
using ShrinkNetwork.Integration.App;
using ShrinkApp;
using UnityEngine;
+using UnityEngine.TestTools;
using Object = UnityEngine.Object;
namespace ShrinkContext.AppAdapter.Tests
@@ -21,92 +24,94 @@ namespace ShrinkContext.AppAdapter.Tests
///
public class NativeWiringTests
{
- [Test]
- public void BasicComposition_UsesNativeComponents_AndRetiresDependentsReversibly()
+ private ShrinkAppSettings? _settings;
+ private ShrinkAppLoaderHost? _host;
+
+ [UnityTearDown]
+ public IEnumerator TearDown()
{
- var settings = ScriptableObject.CreateInstance();
- ShrinkAppLoaderHost? host = null;
- try
+ if (_host?.IsRunning == true)
+ yield return _host.ShutdownAsync().ToCoroutine();
+ if (_settings != null)
+ Object.DestroyImmediate(_settings);
+ }
+
+ [UnityTest]
+ public IEnumerator BasicComposition_UsesNativeComponents_AndRetiresDependentsReversibly()
+ {
+ _settings = ScriptableObject.CreateInstance();
+ var coreInstallers = new List();
+ foreach (var installerType in ShrinkAppInstallers.GetDiscoveredInstallerTypes())
{
- var coreInstallers = new List();
- foreach (var installerType in ShrinkAppInstallers.GetDiscoveredInstallerTypes())
- {
- if (Activator.CreateInstance(installerType) is not IShrinkAppModuleInstaller installer)
- continue;
- if (installer.ModuleId is "shrink.network" or "shrink.command" or "shrink.datasaver")
- coreInstallers.Add(installer);
- }
-
- host = new ShrinkAppLoaderHost(settings, coreInstallers);
- ShrinkAppBasicContextComposition.Configure(host);
- host.ApplyComposition(ShrinkAppBasicContextComposition.CreateDefaultDocument());
-
- TestAwait.Run(host.StartAsync());
-
- Assert.AreEqual(7, host.ModuleIds.Count);
- Assert.AreEqual(7, host.ActiveModuleIds.Count);
- Assert.IsTrue(host.IsModuleActive("shrink.network"));
- Assert.IsTrue(host.IsModuleActive("shrink.command"));
- Assert.IsTrue(host.IsModuleActive("shrink.datasaver"));
- Assert.IsTrue(host.IsModuleActive("shrink.integration.command-network"));
- Assert.IsTrue(host.IsModuleActive("shrink.integration.command-eventbus"));
- Assert.IsTrue(host.IsModuleActive("shrink.integration.datasaver-eventbus"));
- Assert.IsTrue(host.IsModuleActive("shrink.integration.network-eventbus"));
-
- var root = host.Context.RootContext;
- Assert.IsTrue(host.Context.TryGetRaw(root,
- ShrinkNetworkAppComponent.ServiceKey, out _), "网络服务键由原生组件提供");
- Assert.IsTrue(host.Context.TryGetRaw(root,
- ShrinkCommandAppComponent.ServiceKey, out _), "命令服务键由原生组件提供");
- Assert.IsTrue(host.Context.TryGetRaw