mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 将IocContainer的Init方法重命名为OnContextReady并设为protected override - 重构AbstractModel中的Architecture字段为_context属性并实现IContextAware接口 - 移除GetArchitecture和SetArchitecture方法,添加GetContext和SetContext方法 - 为IModel接口添加IContextAware继承 - 添加TestArchitecture、TestModel和TestSystem测试类 - 创建ArchitectureInitializationTests测试用例验证组件初始化 - 更新项目文件添加NUnit包引用和测试项目配置 - 在解决方案文件中添加测试项目引用
35 lines
736 B
C#
35 lines
736 B
C#
using GFramework.Core.Abstractions.architecture;
|
|
using GFramework.Core.Abstractions.model;
|
|
|
|
namespace GFramework.Core.Tests.model;
|
|
|
|
/// <summary>
|
|
/// 测试模型类,用于框架测试目的
|
|
/// </summary>
|
|
public sealed class TestModel : IModel
|
|
{
|
|
private IArchitectureContext _context = null!;
|
|
|
|
/// <summary>
|
|
/// 获取模型是否已初始化的状态
|
|
/// </summary>
|
|
public bool Inited { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 初始化模型
|
|
/// </summary>
|
|
public void Init()
|
|
{
|
|
Inited = true;
|
|
}
|
|
|
|
public void SetContext(IArchitectureContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public IArchitectureContext GetContext()
|
|
{
|
|
return _context;
|
|
}
|
|
} |