mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-14 06:34:30 +08:00
test(architectures): 拆分优先级测试辅助类型文件
- 拆分 PriorityServiceTests 末尾的测试接口与辅助类型到独立文件 - 保留原有命名空间、可见性与优先级测试语义 - 补充新文件的 XML 注释并清理原测试文件的无关 using
This commit is contained in:
parent
b6a9fefda9
commit
86cfaa7122
10
GFramework.Core.Tests/Architectures/IMixedTestSystem.cs
Normal file
10
GFramework.Core.Tests/Architectures/IMixedTestSystem.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using GFramework.Core.Abstractions.Systems;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定义用于混合优先级排序测试的系统契约。
|
||||||
|
/// </summary>
|
||||||
|
public interface IMixedTestSystem : ISystem
|
||||||
|
{
|
||||||
|
}
|
||||||
10
GFramework.Core.Tests/Architectures/IPriorityTestModel.cs
Normal file
10
GFramework.Core.Tests/Architectures/IPriorityTestModel.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using GFramework.Core.Abstractions.Model;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定义用于优先级排序测试的模型契约。
|
||||||
|
/// </summary>
|
||||||
|
public interface IPriorityTestModel : IModel
|
||||||
|
{
|
||||||
|
}
|
||||||
10
GFramework.Core.Tests/Architectures/IPriorityTestSystem.cs
Normal file
10
GFramework.Core.Tests/Architectures/IPriorityTestSystem.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using GFramework.Core.Abstractions.Systems;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定义用于优先级排序测试的系统契约。
|
||||||
|
/// </summary>
|
||||||
|
public interface IPriorityTestSystem : ISystem
|
||||||
|
{
|
||||||
|
}
|
||||||
10
GFramework.Core.Tests/Architectures/IPriorityTestUtility.cs
Normal file
10
GFramework.Core.Tests/Architectures/IPriorityTestUtility.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using GFramework.Core.Abstractions.Utility;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定义用于优先级排序测试的工具契约。
|
||||||
|
/// </summary>
|
||||||
|
public interface IPriorityTestUtility : IUtility
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示显式声明负优先级的混合测试系统。
|
||||||
|
/// </summary>
|
||||||
|
public class MixedTestSystemNegativePriority : AbstractSystem, IMixedTestSystem, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试系统的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => -10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示显式声明正优先级的混合测试系统。
|
||||||
|
/// </summary>
|
||||||
|
public class MixedTestSystemWithPriority : AbstractSystem, IMixedTestSystem, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试系统的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示未声明优先级、依赖默认排序值的混合测试系统。
|
||||||
|
/// </summary>
|
||||||
|
public class MixedTestSystemWithoutPriority : AbstractSystem, IMixedTestSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,7 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using GFramework.Core.Abstractions.Bases;
|
|
||||||
using GFramework.Core.Abstractions.Logging;
|
using GFramework.Core.Abstractions.Logging;
|
||||||
using GFramework.Core.Abstractions.Model;
|
|
||||||
using GFramework.Core.Abstractions.Systems;
|
|
||||||
using GFramework.Core.Abstractions.Utility;
|
|
||||||
using GFramework.Core.Ioc;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using GFramework.Core.Model;
|
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Architectures;
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
@ -120,129 +115,3 @@ public class PriorityServiceTests
|
|||||||
Assert.That(systems[2], Is.InstanceOf<MixedTestSystemWithPriority>()); // 10
|
Assert.That(systems[2], Is.InstanceOf<MixedTestSystemWithPriority>()); // 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Test Interfaces
|
|
||||||
|
|
||||||
public interface IPriorityTestSystem : ISystem
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IPriorityTestModel : IModel
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IPriorityTestUtility : IUtility
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IMixedTestSystem : ISystem
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Test Systems
|
|
||||||
|
|
||||||
public class PriorityTestSystemA : AbstractSystem, IPriorityTestSystem, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 10;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PriorityTestSystemB : AbstractSystem, IPriorityTestSystem, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 20;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PriorityTestSystemC : AbstractSystem, IPriorityTestSystem, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 30;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MixedTestSystemWithPriority : AbstractSystem, IMixedTestSystem, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 10;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MixedTestSystemWithoutPriority : AbstractSystem, IMixedTestSystem
|
|
||||||
{
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MixedTestSystemNegativePriority : AbstractSystem, IMixedTestSystem, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => -10;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Test Models
|
|
||||||
|
|
||||||
public class PriorityTestModelA : AbstractModel, IPriorityTestModel, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 10;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PriorityTestModelB : AbstractModel, IPriorityTestModel, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 20;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PriorityTestModelC : AbstractModel, IPriorityTestModel, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 30;
|
|
||||||
|
|
||||||
protected override void OnInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Test Utilities
|
|
||||||
|
|
||||||
public class PriorityTestUtilityA : IPriorityTestUtility, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PriorityTestUtilityB : IPriorityTestUtility, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PriorityTestUtilityC : IPriorityTestUtility, IPrioritized
|
|
||||||
{
|
|
||||||
public int Priority => 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|||||||
22
GFramework.Core.Tests/Architectures/PriorityTestModelA.cs
Normal file
22
GFramework.Core.Tests/Architectures/PriorityTestModelA.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
using GFramework.Core.Model;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 10 的测试模型。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestModelA : AbstractModel, IPriorityTestModel, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试模型的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
22
GFramework.Core.Tests/Architectures/PriorityTestModelB.cs
Normal file
22
GFramework.Core.Tests/Architectures/PriorityTestModelB.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
using GFramework.Core.Model;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 20 的测试模型。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestModelB : AbstractModel, IPriorityTestModel, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试模型的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
22
GFramework.Core.Tests/Architectures/PriorityTestModelC.cs
Normal file
22
GFramework.Core.Tests/Architectures/PriorityTestModelC.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
using GFramework.Core.Model;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 30 的测试模型。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestModelC : AbstractModel, IPriorityTestModel, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试模型的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
21
GFramework.Core.Tests/Architectures/PriorityTestSystemA.cs
Normal file
21
GFramework.Core.Tests/Architectures/PriorityTestSystemA.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 10 的测试系统。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestSystemA : AbstractSystem, IPriorityTestSystem, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试系统的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
21
GFramework.Core.Tests/Architectures/PriorityTestSystemB.cs
Normal file
21
GFramework.Core.Tests/Architectures/PriorityTestSystemB.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 20 的测试系统。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestSystemB : AbstractSystem, IPriorityTestSystem, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试系统的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
21
GFramework.Core.Tests/Architectures/PriorityTestSystemC.cs
Normal file
21
GFramework.Core.Tests/Architectures/PriorityTestSystemC.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 30 的测试系统。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestSystemC : AbstractSystem, IPriorityTestSystem, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试系统的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持空初始化,以便测试仅覆盖优先级排序行为。
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
14
GFramework.Core.Tests/Architectures/PriorityTestUtilityA.cs
Normal file
14
GFramework.Core.Tests/Architectures/PriorityTestUtilityA.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 10 的测试工具。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestUtilityA : IPriorityTestUtility, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试工具的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 10;
|
||||||
|
}
|
||||||
14
GFramework.Core.Tests/Architectures/PriorityTestUtilityB.cs
Normal file
14
GFramework.Core.Tests/Architectures/PriorityTestUtilityB.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 20 的测试工具。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestUtilityB : IPriorityTestUtility, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试工具的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 20;
|
||||||
|
}
|
||||||
14
GFramework.Core.Tests/Architectures/PriorityTestUtilityC.cs
Normal file
14
GFramework.Core.Tests/Architectures/PriorityTestUtilityC.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using GFramework.Core.Abstractions.Bases;
|
||||||
|
|
||||||
|
namespace GFramework.Core.Tests.Architectures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示优先级为 30 的测试工具。
|
||||||
|
/// </summary>
|
||||||
|
public class PriorityTestUtilityC : IPriorityTestUtility, IPrioritized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前测试工具的排序优先级。
|
||||||
|
/// </summary>
|
||||||
|
public int Priority => 30;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user