28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using Heimdall.Application.DTOs;
|
|
using Heimdall.Application.Events.Notifications;
|
|
using Heimdall.Application.Services;
|
|
using Heimdall.Domain.Enums;
|
|
using NSubstitute;
|
|
|
|
namespace Heimdall.Application.Tests.Handlers.Events;
|
|
|
|
public class ManualSnapshotNotificationTests
|
|
{
|
|
[Fact]
|
|
public async Task ManualSnapshot_BroadcastsEventWithoutDetectionAlert()
|
|
{
|
|
var broadcast = Substitute.For<IEventBroadcastService>();
|
|
var access = Substitute.For<ICameraAccessService>();
|
|
var notifications = Substitute.For<INotificationService>();
|
|
var handler = new EventCreatedNotificationHandler(broadcast, access, notifications);
|
|
var cameraEvent = new CameraEventResponse(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(),
|
|
null, null, EventType.ManualSnapshot, 1, "manual", null, null, null,
|
|
DateTime.UtcNow, DateTime.UtcNow);
|
|
|
|
await handler.Handle(new EventCreatedNotification(cameraEvent), CancellationToken.None);
|
|
|
|
await broadcast.Received(1).NotifyEventCreated(cameraEvent, Arg.Any<CancellationToken>());
|
|
await access.DidNotReceiveWithAnyArgs().GetUserIdsWithCameraAccessAsync(default);
|
|
}
|
|
}
|