diff --git a/Assets/Tests/Editor/DynamicCodeToolTests/AutoInjectedNamespacesTests.cs b/Assets/Tests/Editor/DynamicCodeToolTests/AutoInjectedNamespacesTests.cs
index 2e228d7205..7437031398 100644
--- a/Assets/Tests/Editor/DynamicCodeToolTests/AutoInjectedNamespacesTests.cs
+++ b/Assets/Tests/Editor/DynamicCodeToolTests/AutoInjectedNamespacesTests.cs
@@ -1,11 +1,7 @@
using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
using NUnit.Framework;
using io.github.hatayama.UnityCliLoop.FirstPartyTools;
-using io.github.hatayama.UnityCliLoop.ToolContracts;
-using io.github.hatayama.UnityCliLoop.Domain;
namespace io.github.hatayama.UnityCliLoop.Tests.Editor.DynamicCodeToolTests
{
@@ -77,193 +73,4 @@ public void Resolve_WhenAlreadyHasUsing_ShouldNotReportIt()
}
}
- ///
- /// Test fixture that verifies Auto Injected Namespaces Integration behavior.
- ///
- [TestFixture]
- public class AutoInjectedNamespacesIntegrationTests
- {
- private IPreloadAssemblySecurityValidator _previousValidator;
-
- [SetUp]
- public void SetUp()
- {
- _previousValidator = PreloadAssemblySecurityValidatorRegistry.SwapValidatorForTests(
- new SystemReflectionMetadataPreloadValidator());
- }
-
- [TearDown]
- public void TearDown()
- {
- PreloadAssemblySecurityValidatorRegistry.SwapValidatorForTests(_previousValidator);
- }
-
- [Test]
- public async Task CompileAsync_ScriptMode_MissingUsing_ShouldReportAutoInjectedNamespaces()
- {
- DynamicCodeCompiler compiler = new(DynamicCodeSecurityLevel.Restricted);
- CompilationRequest request = new() {
- Code = @"
- StringBuilder builder = new();
- builder.Append(""hello"");
- return builder.ToString();
- ",
- ClassName = "AutoInjectedNsTestCommand",
- Namespace = "TestNamespace"
- };
-
- CompilationResult result = await compiler.CompileAsync(request, CancellationToken.None);
-
- Assert.IsTrue(result.Success,
- result.Errors != null && result.Errors.Count > 0 ? result.Errors[0].Message : "Should compile");
- Assert.That(result.AutoInjectedNamespaces, Does.Contain("System.Text"));
- }
-
- [Test]
- public async Task CompileAsync_ScriptMode_NoMissingUsing_ShouldReportEmptyAutoInjectedNamespaces()
- {
- DynamicCodeCompiler compiler = new(DynamicCodeSecurityLevel.Restricted);
- CompilationRequest request = new() {
- Code = "return 1 + 2;",
- ClassName = "NoAutoInjectionCommand",
- Namespace = "TestNamespace"
- };
-
- CompilationResult result = await compiler.CompileAsync(request, CancellationToken.None);
-
- Assert.IsTrue(result.Success,
- result.Errors != null && result.Errors.Count > 0 ? result.Errors[0].Message : "Should compile");
- Assert.That(result.AutoInjectedNamespaces, Is.Empty);
- }
-
- [Test]
- public async Task CompileAsync_ScriptMode_WithExistingUsing_ShouldNotReportIt()
- {
- DynamicCodeCompiler compiler = new(DynamicCodeSecurityLevel.Restricted);
- CompilationRequest request = new() {
- Code = @"
- using System.Text;
- StringBuilder builder = new();
- builder.Append(""already imported"");
- return builder.ToString();
- ",
- ClassName = "ExistingUsingCommand",
- Namespace = "TestNamespace"
- };
-
- CompilationResult result = await compiler.CompileAsync(request, CancellationToken.None);
-
- Assert.IsTrue(result.Success,
- result.Errors != null && result.Errors.Count > 0 ? result.Errors[0].Message : "Should compile");
- Assert.That(result.AutoInjectedNamespaces, Is.Empty);
- }
-
- [Test]
- public async Task CompileAsync_ScriptMode_MultipleMissing_ShouldReportAll()
- {
- DynamicCodeCompiler compiler = new(DynamicCodeSecurityLevel.Restricted);
- CompilationRequest request = new() {
- Code = @"
- StringBuilder sb = new();
- Regex regex = new(@""\d+"");
- return sb.ToString() + regex.ToString();
- ",
- ClassName = "MultipleAutoInjectedCommand",
- Namespace = "TestNamespace"
- };
-
- CompilationResult result = await compiler.CompileAsync(request, CancellationToken.None);
-
- Assert.IsTrue(result.Success,
- result.Errors != null && result.Errors.Count > 0 ? result.Errors[0].Message : "Should compile");
- Assert.That(result.AutoInjectedNamespaces, Does.Contain("System.Text"));
- Assert.That(result.AutoInjectedNamespaces, Does.Contain("System.Text.RegularExpressions"));
- }
-
- [Test]
- public async Task CompileAsync_RawMode_MissingUsing_ShouldReportAutoInjectedNamespaces()
- {
- DynamicCodeCompiler compiler = new(DynamicCodeSecurityLevel.Restricted);
- CompilationRequest request = new() {
- Code = @"
- ///
- /// Test fixture that verifies Raw Mode Missing Using behavior.
- ///
- public class RawModeMissingUsingTest
- {
- public async System.Threading.Tasks.Task