73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
using TakeoutSaaS.Application.App.Tenants.Commands;
|
|
using TakeoutSaaS.Domain.Tenants.Entities;
|
|
using TakeoutSaaS.Domain.Tenants.Enums;
|
|
|
|
namespace TakeoutSaaS.Application.Tests.TestUtilities;
|
|
|
|
public static class AnnouncementTestData
|
|
{
|
|
public static CreateTenantAnnouncementCommand CreateValidCreateCommand()
|
|
=> new()
|
|
{
|
|
TenantId = 100,
|
|
Title = "公告标题",
|
|
Content = "公告内容",
|
|
AnnouncementType = TenantAnnouncementType.System,
|
|
Priority = 1,
|
|
EffectiveFrom = DateTime.UtcNow.AddHours(-1),
|
|
EffectiveTo = DateTime.UtcNow.AddHours(2),
|
|
PublisherScope = PublisherScope.Tenant,
|
|
TargetType = "TENANT_ALL",
|
|
TargetParameters = null
|
|
};
|
|
|
|
public static UpdateTenantAnnouncementCommand CreateValidUpdateCommand()
|
|
=> new()
|
|
{
|
|
TenantId = 100,
|
|
AnnouncementId = 9001,
|
|
Title = "更新公告",
|
|
Content = "更新内容",
|
|
TargetType = "TENANT_ALL",
|
|
TargetParameters = null,
|
|
RowVersion = new byte[] { 1, 2, 3 }
|
|
};
|
|
|
|
public static PublishAnnouncementCommand CreateValidPublishCommand()
|
|
=> new()
|
|
{
|
|
AnnouncementId = 9001,
|
|
RowVersion = new byte[] { 1, 2, 3 }
|
|
};
|
|
|
|
public static RevokeAnnouncementCommand CreateValidRevokeCommand()
|
|
=> new()
|
|
{
|
|
AnnouncementId = 9001,
|
|
RowVersion = new byte[] { 1, 2, 3 }
|
|
};
|
|
|
|
public static TenantAnnouncement CreateAnnouncement(
|
|
long id,
|
|
long tenantId,
|
|
int priority,
|
|
DateTime effectiveFrom,
|
|
AnnouncementStatus status = AnnouncementStatus.Draft)
|
|
=> new()
|
|
{
|
|
Id = id,
|
|
TenantId = tenantId,
|
|
Title = $"公告-{id}",
|
|
Content = "内容",
|
|
AnnouncementType = TenantAnnouncementType.System,
|
|
Priority = priority,
|
|
EffectiveFrom = effectiveFrom,
|
|
EffectiveTo = null,
|
|
PublisherScope = PublisherScope.Tenant,
|
|
Status = status,
|
|
TargetType = string.Empty,
|
|
TargetParameters = null,
|
|
RowVersion = new byte[] { 1, 1, 1 }
|
|
};
|
|
}
|