refactor: 移除平台公告与跨租户目标
This commit is contained in:
@@ -65,7 +65,7 @@ public sealed class AnnouncementRegressionTests
|
||||
AnnouncementId = announcement.Id,
|
||||
Title = "更新后的标题",
|
||||
Content = "更新后的内容",
|
||||
TargetType = "ALL_TENANTS",
|
||||
TargetType = "TENANT_ALL",
|
||||
RowVersion = announcement.RowVersion
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ public sealed class AnnouncementRegressionTests
|
||||
EffectiveTo = null,
|
||||
PublisherScope = PublisherScope.Tenant,
|
||||
Status = AnnouncementStatus.Draft,
|
||||
TargetType = "ALL_TENANTS",
|
||||
TargetType = "TENANT_ALL",
|
||||
TargetParameters = null,
|
||||
RowVersion = new byte[] { 1 }
|
||||
};
|
||||
|
||||
@@ -146,7 +146,7 @@ public sealed class AnnouncementWorkflowTests
|
||||
AnnouncementId = announcement.Id,
|
||||
Title = "更新标题",
|
||||
Content = "更新内容",
|
||||
TargetType = "ALL_TENANTS",
|
||||
TargetType = "TENANT_ALL",
|
||||
RowVersion = announcement.RowVersion
|
||||
};
|
||||
|
||||
@@ -185,7 +185,7 @@ public sealed class AnnouncementWorkflowTests
|
||||
AnnouncementId = announcement.Id,
|
||||
Title = "并发更新",
|
||||
Content = "内容",
|
||||
TargetType = "ALL_TENANTS",
|
||||
TargetType = "TENANT_ALL",
|
||||
RowVersion = new byte[] { 1 }
|
||||
};
|
||||
|
||||
@@ -210,7 +210,7 @@ public sealed class AnnouncementWorkflowTests
|
||||
EffectiveTo = DateTime.UtcNow.AddMinutes(30),
|
||||
PublisherScope = PublisherScope.Tenant,
|
||||
Status = AnnouncementStatus.Draft,
|
||||
TargetType = "ALL_TENANTS",
|
||||
TargetType = "TENANT_ALL",
|
||||
TargetParameters = null,
|
||||
RowVersion = new byte[] { 1 }
|
||||
};
|
||||
|
||||
@@ -9,16 +9,16 @@ namespace TakeoutSaaS.Integration.Tests.App.Tenants;
|
||||
public sealed class TenantAnnouncementRepositoryScopeTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task GivenTenantAndPlatformAnnouncements_WhenSearchAsync_ThenReturnsBoth()
|
||||
public async Task GivenDifferentTenantsAnnouncements_WhenSearchAsync_ThenReturnsOnlyCurrentTenant()
|
||||
{
|
||||
// Arrange
|
||||
using var database = new SqliteTestDatabase();
|
||||
using var context = database.CreateContext(tenantId: 800);
|
||||
|
||||
var tenantAnnouncement = CreateAnnouncement(tenantId: 800, id: 9200);
|
||||
var platformAnnouncement = CreateAnnouncement(tenantId: 0, id: 9201);
|
||||
var otherTenantAnnouncement = CreateAnnouncement(tenantId: 801, id: 9201);
|
||||
|
||||
context.TenantAnnouncements.AddRange(tenantAnnouncement, platformAnnouncement);
|
||||
context.TenantAnnouncements.AddRange(tenantAnnouncement, otherTenantAnnouncement);
|
||||
await context.SaveChangesAsync();
|
||||
context.ChangeTracker.Clear();
|
||||
|
||||
@@ -37,7 +37,8 @@ public sealed class TenantAnnouncementRepositoryScopeTests
|
||||
cancellationToken: CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
results.Select(x => x.Id).Should().Contain(new[] { tenantAnnouncement.Id, platformAnnouncement.Id });
|
||||
results.Select(x => x.Id).Should().Contain(tenantAnnouncement.Id);
|
||||
results.Select(x => x.Id).Should().NotContain(otherTenantAnnouncement.Id);
|
||||
}
|
||||
|
||||
private static TenantAnnouncement CreateAnnouncement(long tenantId, long id)
|
||||
@@ -52,7 +53,7 @@ public sealed class TenantAnnouncementRepositoryScopeTests
|
||||
EffectiveFrom = DateTime.UtcNow.AddMinutes(-5),
|
||||
PublisherScope = PublisherScope.Tenant,
|
||||
Status = AnnouncementStatus.Draft,
|
||||
TargetType = "ALL_TENANTS",
|
||||
TargetType = "TENANT_ALL",
|
||||
RowVersion = new byte[] { 1 }
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user