Files
hrynco-notification-service/HrynCo.NotificationService.Services.Tests/Push/SendPushDeliveryValidatorTests.cs
T
agrynco 1631786ce2 feat(push): add service-owned firebase channels and delivery
Add push contracts, provider delivery and channel diagnostics. Link email channels to services and document migration and validation.

Ref: IT-1074
2026-10-24 12:31:35 +03:00

43 lines
1.6 KiB
C#

namespace HrynCo.NotificationService.Services.Tests.Push;
using HrynCo.NotificationService.Contracts.Messages;
using HrynCo.NotificationService.Worker;
using HrynCo.NotificationService.Worker.Services.Push;
using Hrynco.RabbitMq;
public sealed class SendPushDeliveryValidatorTests
{
[Theory]
[InlineData("Notification.SendPush.v1", true)]
[InlineData("Notification.SendEmail.v1", false)]
[InlineData("Notification.SendPush.v2", false)]
[InlineData("notification.sendpush.v1", false)]
[InlineData("Notification.SendPush.v1 ", false)]
[InlineData("SendPushV1", false)]
[InlineData("1", false)]
[InlineData("", false)]
[InlineData(null, false)]
public void AcceptsOnlyTheExistingPushWireContract(string? wireType, bool expected)
{
var id = Guid.NewGuid().ToString("D");
var now = DateTimeOffset.UtcNow;
var message = new SendPushMessage
{
CorrelationContext = new CorrelationContext { CorrelationId = id },
Data = new SendPushMessageData
{
RegistrationId = Guid.NewGuid(), BindingId = Guid.NewGuid(), UserId = Guid.NewGuid(),
ServiceName = "Invemory", Title = "Test", Body = "Test", Token = "test-device-token",
TokenHash = new string('a', 64), ExpiresAt = now.AddMinutes(10)
}
};
var context = new RabbitMqMessageContext
{
QueueName = "notification.send-push", RoutingKey = "notification.send-push", Exchange = "",
MessageId = id, MessageType = wireType
};
Assert.Equal(expected, SendPushDeliveryValidator.IsValid(message, context));
}
}