From abf78aa9343ed7f7ba3e36a495e7fa609156eedc Mon Sep 17 00:00:00 2001
From: GeWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Sat, 11 Apr 2026 07:39:19 +0800
Subject: [PATCH] =?UTF-8?q?refactor(tests):=20=E9=87=8D=E6=9E=84=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=85=A8=E5=B1=80=E5=BC=95?=
=?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 GodotYamlConfigLoaderTests 中添加 GFramework.Game.Config 引用
- 从 GodotYamlConfigTableSourceTests 中移除未使用的 System 引用
- 新增 GlobalUsings.cs 文件统一管理所有全局引用
- 将常用的系统命名空间配置为全局引用以减少重复导入
- 优化测试代码的引用管理和项目结构
---
.../Config/GodotYamlConfigLoaderTests.cs | 14 ++++-------
.../Config/GodotYamlConfigTableSourceTests.cs | 1 -
GFramework.Godot.Tests/GlobalUsings.cs | 25 +++++++++++++++++++
3 files changed, 30 insertions(+), 10 deletions(-)
create mode 100644 GFramework.Godot.Tests/GlobalUsings.cs
diff --git a/GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs b/GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
index bef0737a..32b16f9a 100644
--- a/GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
+++ b/GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
@@ -1,11 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
using GFramework.Game.Abstractions.Config;
+using GFramework.Game.Config;
using GFramework.Godot.Config;
namespace GFramework.Godot.Tests.Config;
@@ -16,10 +12,6 @@ namespace GFramework.Godot.Tests.Config;
[TestFixture]
public sealed class GodotYamlConfigLoaderTests
{
- private string _resourceRoot = null!;
- private string _testRoot = null!;
- private string _userRoot = null!;
-
///
/// 为每个测试准备独立的资源根目录与用户目录。
///
@@ -48,6 +40,10 @@ public sealed class GodotYamlConfigLoaderTests
}
}
+ private string _resourceRoot = null!;
+ private string _testRoot = null!;
+ private string _userRoot = null!;
+
///
/// 验证导出态会把注册过的 YAML 与 schema 文本同步到运行时缓存,再交给底层加载器。
///
diff --git a/GFramework.Godot.Tests/Config/GodotYamlConfigTableSourceTests.cs b/GFramework.Godot.Tests/Config/GodotYamlConfigTableSourceTests.cs
index ccb8ab6a..d0e491d8 100644
--- a/GFramework.Godot.Tests/Config/GodotYamlConfigTableSourceTests.cs
+++ b/GFramework.Godot.Tests/Config/GodotYamlConfigTableSourceTests.cs
@@ -1,4 +1,3 @@
-using System;
using GFramework.Godot.Config;
namespace GFramework.Godot.Tests.Config;
diff --git a/GFramework.Godot.Tests/GlobalUsings.cs b/GFramework.Godot.Tests/GlobalUsings.cs
new file mode 100644
index 00000000..8a7c367a
--- /dev/null
+++ b/GFramework.Godot.Tests/GlobalUsings.cs
@@ -0,0 +1,25 @@
+// Copyright (c) 2025 GeWuYou
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+global using System;
+global using System.Collections.Generic;
+global using System.Linq;
+global using System.Threading;
+global using System.Threading.Tasks;
+global using System.Collections.Immutable;
+global using Microsoft.CodeAnalysis;
+global using NUnit.Framework;
+global using System.Globalization;
+global using System.IO;
+global using System.Text;
+global using System.Text.Json;