Files
Heimdall/tests/Heimdall.Application.Tests/Handlers/Events/ManualSnapshotNotificationTests.cs
T
Arnaud Dartois b793bae739
Heimdall Gitea / Build and tests (pull_request) Failing after 56s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Connect manual camera snapshots to agent capture
2026-10-23 07:20:47 +02:00

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);
}
}