mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
test(environment): 拆分 EnvironmentTests 测试环境类型
- 拆分 TestEnvironment 到独立文件以消除 EnvironmentTests 的 MA0048 警告 - 补充 TestEnvironment 的 XML 文档并保留原有测试行为
This commit is contained in:
parent
7b432c60c7
commit
88c439c2ef
@ -184,31 +184,3 @@ public class EnvironmentTests
|
||||
Assert.That(result, Is.EqualTo("interfaceValue"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试环境实现类,继承自EnvironmentBase
|
||||
/// </summary>
|
||||
public class TestEnvironment : EnvironmentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取环境名称
|
||||
/// </summary>
|
||||
public override string Name { get; } = "TestEnvironment";
|
||||
|
||||
/// <summary>
|
||||
/// 注册键值对到环境中
|
||||
/// </summary>
|
||||
/// <param name="key">要注册的键</param>
|
||||
/// <param name="value">要注册的值</param>
|
||||
public new void Register(string key, object value)
|
||||
{
|
||||
base.Register(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化环境
|
||||
/// </summary>
|
||||
public override void Initialize()
|
||||
{
|
||||
}
|
||||
}
|
||||
34
GFramework.Core.Tests/Environment/TestEnvironment.cs
Normal file
34
GFramework.Core.Tests/Environment/TestEnvironment.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using GFramework.Core.Environment;
|
||||
|
||||
namespace GFramework.Core.Tests.Environment;
|
||||
|
||||
/// <summary>
|
||||
/// 为环境相关测试提供可写注册入口的测试环境实现。
|
||||
/// </summary>
|
||||
public class TestEnvironment : EnvironmentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取测试环境名称。
|
||||
/// </summary>
|
||||
public override string Name { get; } = "TestEnvironment";
|
||||
|
||||
/// <summary>
|
||||
/// 将测试数据注册到基础环境存储中,便于测试通过公开入口准备上下文。
|
||||
/// </summary>
|
||||
/// <param name="key">要注册的环境键。</param>
|
||||
/// <param name="value">要注册的环境值。</param>
|
||||
public new void Register(string key, object value)
|
||||
{
|
||||
base.Register(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化测试环境。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 当前测试环境没有额外初始化逻辑,但仍保留重写以匹配 <see cref="EnvironmentBase"/> 契约。
|
||||
/// </remarks>
|
||||
public override void Initialize()
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -76,10 +76,3 @@ public class EventBusTests
|
||||
Assert.That(count2, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EventBus测试专用事件类
|
||||
/// </summary>
|
||||
public class EventBusTestsEvent
|
||||
{
|
||||
}
|
||||
8
GFramework.Core.Tests/Events/EventBusTestsEvent.cs
Normal file
8
GFramework.Core.Tests/Events/EventBusTestsEvent.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace GFramework.Core.Tests.Events;
|
||||
|
||||
/// <summary>
|
||||
/// 表示 <see cref="EventBusTests" /> 使用的测试事件。
|
||||
/// </summary>
|
||||
public class EventBusTestsEvent
|
||||
{
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user