You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.8 KiB
104 lines
2.8 KiB
using System.ComponentModel.DataAnnotations;
|
|
using X1.Domain.Entities.Common;
|
|
|
|
namespace X1.Domain.Entities.TestCase;
|
|
|
|
/// <summary>
|
|
/// 用例步骤配置实体
|
|
/// </summary>
|
|
public class CaseStepConfig : AuditableEntity
|
|
{
|
|
/// <summary>
|
|
/// 步骤名称
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string StepName { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// 步骤类型
|
|
/// </summary>
|
|
[Required]
|
|
public CaseStepType StepType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 步骤说明
|
|
/// </summary>
|
|
[MaxLength(500)]
|
|
public string? Description { get; set; }
|
|
|
|
/// <summary>
|
|
/// 步骤图标
|
|
/// </summary>
|
|
[MaxLength(100)]
|
|
public string? Icon { get; set; }
|
|
|
|
/// <summary>
|
|
/// 步骤映射 - 指定当前步骤使用哪个子级类
|
|
/// </summary>
|
|
[Required(ErrorMessage = "步骤映射不能为空")]
|
|
[MaxLength(200, ErrorMessage = "步骤映射不能超过200个字符")]
|
|
public string Mapping { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// 是否启用
|
|
/// </summary>
|
|
public bool IsEnabled { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 表单类型
|
|
/// </summary>
|
|
public FormType FormType { get; set; } = FormType.None;
|
|
|
|
/// <summary>
|
|
/// 默认构造函数
|
|
/// </summary>
|
|
public CaseStepConfig()
|
|
{
|
|
Id = Guid.NewGuid().ToString();
|
|
CreatedAt = DateTime.UtcNow;
|
|
UpdatedAt = DateTime.UtcNow;
|
|
IsEnabled = true; // 默认启用
|
|
FormType = FormType.None; // 默认无表单
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建用例步骤配置
|
|
/// </summary>
|
|
/// <param name="stepName">步骤名称</param>
|
|
/// <param name="stepType">步骤类型</param>
|
|
/// <param name="mapping">步骤映射</param>
|
|
/// <param name="createdBy">创建人ID</param>
|
|
/// <param name="description">步骤说明</param>
|
|
/// <param name="icon">步骤图标</param>
|
|
/// <param name="isEnabled">是否启用</param>
|
|
/// <param name="formType">表单类型</param>
|
|
public static CaseStepConfig Create(
|
|
string stepName,
|
|
CaseStepType stepType,
|
|
string mapping,
|
|
string createdBy,
|
|
string? description = null,
|
|
string? icon = null,
|
|
bool isEnabled = true,
|
|
FormType formType = FormType.None)
|
|
{
|
|
var caseStepConfig = new CaseStepConfig
|
|
{
|
|
Id = Guid.NewGuid().ToString(),
|
|
StepName = stepName,
|
|
StepType = stepType,
|
|
Mapping = mapping,
|
|
Description = description,
|
|
Icon = icon,
|
|
IsEnabled = isEnabled,
|
|
FormType = formType,
|
|
CreatedAt = DateTime.UtcNow,
|
|
UpdatedAt = DateTime.UtcNow,
|
|
CreatedBy = createdBy,
|
|
UpdatedBy = createdBy
|
|
};
|
|
|
|
return caseStepConfig;
|
|
}
|
|
}
|
|
|