Complete MVP implementation (Étape 1) covering: - Domain: primitives (Entity<TId>, ValueObject), 10 entities, 6 enums - EF Core: AppDbContext + Identity, 8 EntityTypeConfigurations, audit/soft-delete interceptors, initial migration - Application: service interfaces, DTOs, FluentValidation, ServiceResult pattern - Security: Identity + JWT + API Key multi-auth, role-based permissions, constant-time key validation - API: Auth/Sites/Agents controllers with explicit auth scheme policies - Workers: Hangfire PostgreSQL setup with schema isolation, HeartbeatMonitorJob - Agent: registration service + 30s heartbeat loop - Docker: multi-stage Dockerfiles for central + agent, docker-compose.yml - CI/CD: GitHub Actions pipeline with build+test and Docker build - Tests: 13 domain tests (Site, Agent, Camera entities) Architecture decisions per deliberation council: - API Key via AuthenticationHandler<T> (not middleware) - Explicit [Authorize(AuthenticationSchemes)] on all endpoints - Event/Recording/Person/Vehicle deferred from initial migration - Hangfire compatible with .NET 10 (v1.8.17)
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using Heimdall.Domain.Entities;
|
|
using Heimdall.Domain.Enums;
|
|
using Shouldly;
|
|
|
|
namespace Heimdall.Domain.Tests.Entities;
|
|
|
|
public class CameraTests
|
|
{
|
|
[Fact]
|
|
public void Create_camera_should_set_properties()
|
|
{
|
|
var siteId = Guid.NewGuid();
|
|
var camera = new Camera(siteId, "Caméra Entrée", "rtsp://192.168.1.100:554/stream1");
|
|
|
|
camera.Id.ShouldNotBe(Guid.Empty);
|
|
camera.SiteId.ShouldBe(siteId);
|
|
camera.Name.ShouldBe("Caméra Entrée");
|
|
camera.RtspUrl.ShouldBe("rtsp://192.168.1.100:554/stream1");
|
|
camera.Status.ShouldBe(CameraStatus.Disabled);
|
|
}
|
|
|
|
[Fact]
|
|
public void Assign_agent_should_set_agent_id()
|
|
{
|
|
var camera = new Camera(Guid.NewGuid(), "Camera-1");
|
|
var agentId = Guid.NewGuid();
|
|
|
|
camera.AssignAgent(agentId);
|
|
|
|
camera.AgentId.ShouldBe(agentId);
|
|
}
|
|
|
|
[Fact]
|
|
public void Set_status_should_update_status()
|
|
{
|
|
var camera = new Camera(Guid.NewGuid(), "Camera-1");
|
|
|
|
camera.SetStatus(CameraStatus.Online);
|
|
|
|
camera.Status.ShouldBe(CameraStatus.Online);
|
|
}
|
|
}
|