37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using IM.Application.Chat.Queries;
|
|
using IM.Application.Chat.Validators;
|
|
using Xunit;
|
|
|
|
namespace BuildFlow.IM.Tests.Chat;
|
|
|
|
public class GetConversationParticipantIdsQueryValidatorTests
|
|
{
|
|
private readonly GetConversationParticipantIdsQueryValidator _validator = new();
|
|
|
|
[Fact]
|
|
public void Rejects_empty_conversation_id()
|
|
{
|
|
var query = new GetConversationParticipantIdsQuery(
|
|
Guid.Empty,
|
|
Guid.Parse("22222222-2222-2222-2222-222222222222"));
|
|
|
|
var result = _validator.Validate(query);
|
|
|
|
Assert.False(result.IsValid);
|
|
Assert.Contains(result.Errors, e => e.ErrorMessage == "会话 ID 不能为空");
|
|
}
|
|
|
|
[Fact]
|
|
public void Rejects_empty_requester_id()
|
|
{
|
|
var query = new GetConversationParticipantIdsQuery(
|
|
Guid.Parse("11111111-1111-1111-1111-111111111111"),
|
|
Guid.Empty);
|
|
|
|
var result = _validator.Validate(query);
|
|
|
|
Assert.False(result.IsValid);
|
|
Assert.Contains(result.Errors, e => e.ErrorMessage == "用户 ID 不能为空");
|
|
}
|
|
}
|