diff --git a/migration/.editorconfig b/migration/.editorconfig
new file mode 100644
index 0000000..f4d2421
--- /dev/null
+++ b/migration/.editorconfig
@@ -0,0 +1,22 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
+
+[*.{json,xml,props,csproj,slnx}]
+indent_size = 2
+
+[*.cs]
+csharp_style_namespace_declarations = file_scoped:warning
+csharp_style_var_for_built_in_types = false:suggestion
+csharp_style_var_when_type_is_apparent = false:suggestion
+csharp_style_var_elsewhere = false:suggestion
+
+[tests/**/*.cs]
+# AGENTS.md impose Methode_Condition_ResultatAttendu pour les tests.
+dotnet_diagnostic.CA1707.severity = none
diff --git a/migration/CHANGELOG.md b/migration/CHANGELOG.md
new file mode 100644
index 0000000..1af2b71
--- /dev/null
+++ b/migration/CHANGELOG.md
@@ -0,0 +1,9 @@
+# Changelog de la migration
+
+## 2026-10-14 — incrément 01
+
+Ajout du socle Domain Sites/Cameras du pilote, isolé de l'héritage : identités immuables, noms bornés, fuseau validé, flux RTSP/RTSPS sans credentials intégrés et désactivation non destructive. Validation atomique en mémoire ; référence site/secret sans dépendance inter-plugin. SDK 10.0.301, Central Package Management et analyseurs actifs.
+
+Validation de `Heimdall.Migration.slnx` avec le SDK Windows existant : restore réussi, build strict réussi (0 avertissement, 0 erreur), 26 tests réussis. Format `--verify-no-changes` réussi. Domaine sans E/S : aucun test PostgreSQL, API/UI, inférence ou caméra réelle exécuté. H0/H1 et le MVP pilote ne sont pas terminés ; dépendances et restrictions décrites dans README.md.
+
+Aucune modification du patrimoine, du transport historique, d'Android ou des configurations du produit legacy ; aucun déploiement ni publication.
diff --git a/migration/Directory.Build.props b/migration/Directory.Build.props
new file mode 100644
index 0000000..699c24f
--- /dev/null
+++ b/migration/Directory.Build.props
@@ -0,0 +1,11 @@
+
+
+ net10.0
+ latest
+ enable
+ enable
+ true
+ Recommended
+ true
+
+
diff --git a/migration/Directory.Packages.props b/migration/Directory.Packages.props
new file mode 100644
index 0000000..0d67c65
--- /dev/null
+++ b/migration/Directory.Packages.props
@@ -0,0 +1,11 @@
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/migration/Heimdall.Migration.slnx b/migration/Heimdall.Migration.slnx
new file mode 100644
index 0000000..52ee983
--- /dev/null
+++ b/migration/Heimdall.Migration.slnx
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/migration/README.md b/migration/README.md
new file mode 100644
index 0000000..d9570a2
--- /dev/null
+++ b/migration/README.md
@@ -0,0 +1,44 @@
+# Migration Heimdall — incrément 01
+
+Premier socle métier du [MVP pilote](../../Specification/projects/heimdall/implementation/mvp-surveillance.md), préparatoire à H0/H1. Installation neuve isolée ; aucune bascule du patrimoine ni modification du Central historique.
+
+## Code livré
+
+- `Heimdall.Sites.Domain` : identité site/tenant immuable, nom et fuseau reconnus, mise à jour atomique en mémoire.
+- `Heimdall.Cameras.Domain` : référence site/tenant immuable, nom, URI RTSP/RTSPS et référence opaque de credential ; désactivation idempotente. Pas de référence de projet vers Sites.
+- Tests de comportement et d'architecture : Domain BCL seul, propriétés protégées, validation et conservation de l'état après erreur.
+
+La solution `Heimdall.Migration.slnx` sépare la cible des dépendances héritées. Elle ne crée pas un autre Host ni un produit déployable. Ses propriétés et versions sont locales ; les configurations historiques restent intactes. Les couches Application/Infrastructure et les packages Business seront ajoutés avec leurs comportements réels, sans projets vides ni SDK simulé.
+
+## Limites du premier contrat
+
+Noms bornés à 200 caractères ; fuseau borné à 100 caractères et reconnu par `TimeZoneInfo` ; URI bornée à 2048 caractères, sans userinfo, query ni fragment pour éviter les credentials intégrés. Les caméras nécessitant des paramètres de query ne sont pas prises en charge par cet incrément ; leur représentation doit être définie avec Secrets et la politique réseau avant H1. Les URI peuvent rester sensibles : ne pas les journaliser.
+
+Le Domain ne prouve ni l'existence du tenant/site/secret ni l'autorisation. Ces contrôles appartiendront au service applicatif, via les contrats plateforme et Sites. Aucun accès réseau ni contrôle SSRF effectué ici. Les identifiants sont fournis par l'appelant ; l'idempotence persistante reste à réaliser. Pas de version de concurrence EF fictive. L'archivage du site attend la vérification propriétaire des références actives ; aucune suppression locale ajoutée.
+
+## Suite du chemin critique
+
+1. YH0 : qualifier les packages de composition/runtime, provenance et compatibilité, et les samples indépendantes sur le Host commun. Les descriptors existants ne constituent pas encore une provenance de package validée.
+2. YH1 : évaluateur EF Core, repositories/Unit of Work, contextes propriétaires Npgsql et tests PostgreSQL réels.
+3. YH2 : tenant validé, ressources et permissions, identité humaine, auth locale et Secrets. Ces capacités ne sont pas disponibles dans le code Yggdrasil inspecté le 14 octobre 2026.
+4. H0/H1 : packages Business versionnés, Application Definition/profil, services Sites/Cameras directs et Specifications, puis CRUD autorisé et UI du Host commun.
+5. H2 et suivants : identité machine, affectations/epochs, capture/spool et événement durable, modèle CPU qualifié, alertes, PWA, conservation et restauration.
+
+Aucun H0/H1 ni MVP complet annoncé terminé. Pas de retrait RabbitMQ/MassTransit ou Android : la parité, le drainage et le rollback restent des conditions de H7.
+
+## Dépendances de test
+
+Versions alignées sur les produits voisins, vérifiées sur NuGet : [xUnit v3 3.2.2](https://www.nuget.org/packages/xunit.v3/3.2.2) et [runner 3.1.4](https://www.nuget.org/packages/xunit.runner.visualstudio/3.1.4) (Apache-2.0), [Shouldly 4.3.0](https://www.nuget.org/packages/Shouldly/4.3.0) (BSD-3-Clause), [Test SDK 17.14.1](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.14.1) (MIT). Uniquement pour les tests, versions centralisées ; aucun package runtime ajouté au Domain.
+
+## Validation
+
+Depuis ce dossier avec SDK 10.0.301 :
+
+```bash
+dotnet restore Heimdall.Migration.slnx
+dotnet build Heimdall.Migration.slnx --no-restore -warnaserror
+dotnet test Heimdall.Migration.slnx --no-build
+dotnet format Heimdall.Migration.slnx --verify-no-changes
+```
+
+Sous WSL, le SDK Windows existant est invoqué via `/mnt/c/Program Files/dotnet/dotnet.exe` avec exécution autorisée hors sandbox ; aucune installation ni configuration globale. Résultats consignés dans [CHANGELOG.md](CHANGELOG.md). La solution historique n'est pas modifiée et ses suites ne sont pas une validation de ce socle. Aucune preuve PostgreSQL, HTTP/UI ou caméra réelle dans cet incrément sans persistance/transport.
diff --git a/migration/global.json b/migration/global.json
new file mode 100644
index 0000000..a0e9d0e
--- /dev/null
+++ b/migration/global.json
@@ -0,0 +1,7 @@
+{
+ "sdk": {
+ "version": "10.0.301",
+ "rollForward": "latestPatch",
+ "allowPrerelease": false
+ }
+}
diff --git a/migration/src/Heimdall.Cameras.Domain/Camera.cs b/migration/src/Heimdall.Cameras.Domain/Camera.cs
new file mode 100644
index 0000000..4445e10
--- /dev/null
+++ b/migration/src/Heimdall.Cameras.Domain/Camera.cs
@@ -0,0 +1,94 @@
+namespace Heimdall.Cameras.Domain;
+
+/// Inventaire RTSP ; ne capture pas et ne possède ni site ni secret.
+public sealed class Camera
+{
+ private Camera(Guid id, Guid tenantId, Guid siteId, string name, Uri streamUri, Guid? credentialReference)
+ {
+ Id = id;
+ TenantId = tenantId;
+ SiteId = siteId;
+ Name = name;
+ StreamUri = streamUri;
+ CredentialReference = credentialReference;
+ }
+
+ /// Identité stable de la caméra.
+ public Guid Id { get; }
+
+ /// Tenant propriétaire immuable.
+ public Guid TenantId { get; }
+
+ /// Référence au site ; son existence et ses droits sont vérifiés par le service.
+ public Guid SiteId { get; }
+
+ /// Nom normalisé.
+ public string Name { get; private set; }
+
+ /// Flux sans credentials intégrés ; ne doit pas être journalisé.
+ public Uri StreamUri { get; private set; }
+
+ /// Référence opaque au secret externe, jamais sa valeur.
+ public Guid? CredentialReference { get; private set; }
+
+ /// Indique si le flux peut être affecté.
+ public bool IsEnabled { get; private set; } = true;
+
+ /// Déclare une caméra ; ne réalise aucun accès réseau.
+ public static Camera Register(Guid id, Guid tenantId, Guid siteId, string name, string streamUri, Guid? credentialReference = null)
+ {
+ if (id == Guid.Empty || tenantId == Guid.Empty || siteId == Guid.Empty)
+ {
+ throw new CamerasDomainException("Les identifiants caméra, tenant et site sont obligatoires.");
+ }
+
+ return new Camera(id, tenantId, siteId, ValidateName(name), ValidateStreamUri(streamUri), ValidateCredentialReference(credentialReference));
+ }
+
+ /// Remplace la configuration uniquement après validation de tous les champs.
+ public void Update(string name, string streamUri, Guid? credentialReference)
+ {
+ string validatedName = ValidateName(name);
+ Uri validatedUri = ValidateStreamUri(streamUri);
+ Guid? validatedReference = ValidateCredentialReference(credentialReference);
+ Name = validatedName;
+ StreamUri = validatedUri;
+ CredentialReference = validatedReference;
+ }
+
+ /// Désactive sans supprimer la configuration ni les références.
+ public void Disable() => IsEnabled = false;
+
+ private static string ValidateName(string name)
+ {
+ if (string.IsNullOrWhiteSpace(name) || name.Trim().Length > 200)
+ {
+ throw new CamerasDomainException("Le nom de la caméra doit contenir entre 1 et 200 caractères.");
+ }
+
+ return name.Trim();
+ }
+
+ private static Uri ValidateStreamUri(string streamUri)
+ {
+ if (string.IsNullOrWhiteSpace(streamUri) || streamUri.Length > 2048 ||
+ !Uri.TryCreate(streamUri, UriKind.Absolute, out Uri? uri) ||
+ (uri.Scheme != "rtsp" && uri.Scheme != "rtsps") || string.IsNullOrEmpty(uri.Host) ||
+ !string.IsNullOrEmpty(uri.UserInfo) || !string.IsNullOrEmpty(uri.Query) || !string.IsNullOrEmpty(uri.Fragment))
+ {
+ throw new CamerasDomainException("Le flux doit être une URI RTSP absolue sans credentials, query ni fragment.");
+ }
+
+ return uri;
+ }
+
+ private static Guid? ValidateCredentialReference(Guid? credentialReference)
+ {
+ if (credentialReference == Guid.Empty)
+ {
+ throw new CamerasDomainException("La référence de secret ne peut pas être vide.");
+ }
+
+ return credentialReference;
+ }
+}
diff --git a/migration/src/Heimdall.Cameras.Domain/CamerasDomainException.cs b/migration/src/Heimdall.Cameras.Domain/CamerasDomainException.cs
new file mode 100644
index 0000000..095b3eb
--- /dev/null
+++ b/migration/src/Heimdall.Cameras.Domain/CamerasDomainException.cs
@@ -0,0 +1,4 @@
+namespace Heimdall.Cameras.Domain;
+
+/// Violation d'un invariant du propriétaire Cameras.
+public sealed class CamerasDomainException(string message) : Exception(message);
diff --git a/migration/src/Heimdall.Cameras.Domain/Heimdall.Cameras.Domain.csproj b/migration/src/Heimdall.Cameras.Domain/Heimdall.Cameras.Domain.csproj
new file mode 100644
index 0000000..6b512ec
--- /dev/null
+++ b/migration/src/Heimdall.Cameras.Domain/Heimdall.Cameras.Domain.csproj
@@ -0,0 +1 @@
+
diff --git a/migration/src/Heimdall.Sites.Domain/Heimdall.Sites.Domain.csproj b/migration/src/Heimdall.Sites.Domain/Heimdall.Sites.Domain.csproj
new file mode 100644
index 0000000..6b512ec
--- /dev/null
+++ b/migration/src/Heimdall.Sites.Domain/Heimdall.Sites.Domain.csproj
@@ -0,0 +1 @@
+
diff --git a/migration/src/Heimdall.Sites.Domain/Site.cs b/migration/src/Heimdall.Sites.Domain/Site.cs
new file mode 100644
index 0000000..d91f90a
--- /dev/null
+++ b/migration/src/Heimdall.Sites.Domain/Site.cs
@@ -0,0 +1,76 @@
+namespace Heimdall.Sites.Domain;
+
+/// Site de surveillance ; le tenant est fourni par la plateforme.
+public sealed class Site
+{
+ private Site(Guid id, Guid tenantId, string name, string timeZoneId)
+ {
+ Id = id;
+ TenantId = tenantId;
+ Name = name;
+ TimeZoneId = timeZoneId;
+ }
+
+ /// Identité stable du site.
+ public Guid Id { get; }
+
+ /// Propriétaire tenant immuable, sans preuve d'autorisation implicite.
+ public Guid TenantId { get; }
+
+ /// Nom normalisé du site.
+ public string Name { get; private set; }
+
+ /// Fuseau reconnu sur l'environnement d'exécution.
+ public string TimeZoneId { get; private set; }
+
+ /// Construit un site après validation complète.
+ public static Site Create(Guid id, Guid tenantId, string name, string timeZoneId)
+ {
+ if (id == Guid.Empty || tenantId == Guid.Empty)
+ {
+ throw new SitesDomainException("Les identifiants du site et du tenant sont obligatoires.");
+ }
+
+ return new Site(id, tenantId, ValidateName(name), ValidateTimeZone(timeZoneId));
+ }
+
+ /// Valide tous les champs avant de modifier le site.
+ public void Update(string name, string timeZoneId)
+ {
+ string validatedName = ValidateName(name);
+ string validatedTimeZone = ValidateTimeZone(timeZoneId);
+ Name = validatedName;
+ TimeZoneId = validatedTimeZone;
+ }
+
+ private static string ValidateName(string name)
+ {
+ if (string.IsNullOrWhiteSpace(name) || name.Trim().Length > 200)
+ {
+ throw new SitesDomainException("Le nom du site doit contenir entre 1 et 200 caractères.");
+ }
+
+ return name.Trim();
+ }
+
+ private static string ValidateTimeZone(string timeZoneId)
+ {
+ if (string.IsNullOrWhiteSpace(timeZoneId) || timeZoneId.Length > 100)
+ {
+ throw new SitesDomainException("Le fuseau est obligatoire et limité à 100 caractères.");
+ }
+
+ try
+ {
+ return TimeZoneInfo.FindSystemTimeZoneById(timeZoneId.Trim()).Id;
+ }
+ catch (TimeZoneNotFoundException)
+ {
+ throw new SitesDomainException("Le fuseau est inconnu.");
+ }
+ catch (InvalidTimeZoneException)
+ {
+ throw new SitesDomainException("Le fuseau est invalide.");
+ }
+ }
+}
diff --git a/migration/src/Heimdall.Sites.Domain/SitesDomainException.cs b/migration/src/Heimdall.Sites.Domain/SitesDomainException.cs
new file mode 100644
index 0000000..187be03
--- /dev/null
+++ b/migration/src/Heimdall.Sites.Domain/SitesDomainException.cs
@@ -0,0 +1,4 @@
+namespace Heimdall.Sites.Domain;
+
+/// Violation d'un invariant du propriétaire Sites.
+public sealed class SitesDomainException(string message) : Exception(message);
diff --git a/migration/tests/Heimdall.Migration.Domain.Tests/ArchitectureTests.cs b/migration/tests/Heimdall.Migration.Domain.Tests/ArchitectureTests.cs
new file mode 100644
index 0000000..b4bdbce
--- /dev/null
+++ b/migration/tests/Heimdall.Migration.Domain.Tests/ArchitectureTests.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using Heimdall.Cameras.Domain;
+using Heimdall.Sites.Domain;
+using Shouldly;
+using Xunit;
+
+namespace Heimdall.Migration.Domain.Tests;
+
+public sealed class ArchitectureTests
+{
+ [Theory]
+ [InlineData(typeof(Site))]
+ [InlineData(typeof(Camera))]
+ public void Domain_AssemblyReferences_UsesOnlyBcl(Type aggregate)
+ {
+ foreach (AssemblyName reference in aggregate.Assembly.GetReferencedAssemblies())
+ {
+ reference.Name.ShouldNotBeNull();
+ (reference.Name == "System" || reference.Name.StartsWith("System.", StringComparison.Ordinal)).ShouldBeTrue();
+ }
+ }
+
+ [Theory]
+ [InlineData(typeof(Site))]
+ [InlineData(typeof(Camera))]
+ public void Domain_PublicProperties_CannotBeAssignedExternally(Type aggregate)
+ {
+ foreach (PropertyInfo property in aggregate.GetProperties())
+ {
+ (property.SetMethod is null || !property.SetMethod.IsPublic).ShouldBeTrue();
+ }
+ }
+}
diff --git a/migration/tests/Heimdall.Migration.Domain.Tests/CameraTests.cs b/migration/tests/Heimdall.Migration.Domain.Tests/CameraTests.cs
new file mode 100644
index 0000000..4d66536
--- /dev/null
+++ b/migration/tests/Heimdall.Migration.Domain.Tests/CameraTests.cs
@@ -0,0 +1,93 @@
+using Heimdall.Cameras.Domain;
+using Shouldly;
+using Xunit;
+
+namespace Heimdall.Migration.Domain.Tests;
+
+public sealed class CameraTests
+{
+ [Fact]
+ public void Register_ValidInput_PreservesReferences()
+ {
+ Guid id = Guid.NewGuid();
+ Guid tenant = Guid.NewGuid();
+ Guid site = Guid.NewGuid();
+ Guid secret = Guid.NewGuid();
+ Camera camera = Camera.Register(id, tenant, site, " Entrée ", "rtsp://camera.example/stream", secret);
+ camera.Id.ShouldBe(id);
+ camera.TenantId.ShouldBe(tenant);
+ camera.SiteId.ShouldBe(site);
+ camera.Name.ShouldBe("Entrée");
+ camera.CredentialReference.ShouldBe(secret);
+ camera.IsEnabled.ShouldBeTrue();
+ }
+
+ [Theory]
+ [InlineData("https://camera.example/stream")]
+ [InlineData("rtsp://user:password@camera.example/stream")]
+ [InlineData("rtsp://camera.example/stream?token=sensitive")]
+ [InlineData("rtsp://camera.example/stream#sensitive")]
+ [InlineData("relative/stream")]
+ [InlineData("")]
+ public void Register_InvalidStream_RejectsWithoutEchoingInput(string stream)
+ {
+ CamerasDomainException error = Should.Throw(() =>
+ Camera.Register(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "Camera", stream));
+ error.Message.ShouldNotContain("sensitive");
+ error.Message.ShouldNotContain("password");
+ }
+
+ [Theory]
+ [InlineData(0)]
+ [InlineData(1)]
+ [InlineData(2)]
+ public void Register_MissingIdentity_RejectsCamera(int missing)
+ {
+ Should.Throw(() => Camera.Register(
+ missing == 0 ? Guid.Empty : Guid.NewGuid(),
+ missing == 1 ? Guid.Empty : Guid.NewGuid(),
+ missing == 2 ? Guid.Empty : Guid.NewGuid(), "Camera", "rtsp://camera.example/stream"));
+ }
+
+ [Fact]
+ public void Update_InvalidSecretReference_PreservesAllConfiguration()
+ {
+ Guid secret = Guid.NewGuid();
+ Camera camera = Camera.Register(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "Avant", "rtsp://camera.example/old", secret);
+ Should.Throw(() => camera.Update("Après", "rtsps://camera.example/new", Guid.Empty));
+ camera.Name.ShouldBe("Avant");
+ camera.StreamUri.AbsoluteUri.ShouldBe("rtsp://camera.example/old");
+ camera.CredentialReference.ShouldBe(secret);
+ }
+
+ [Fact]
+ public void Update_InvalidStream_PreservesPreviousState()
+ {
+ Camera camera = Camera.Register(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "Avant", "rtsp://camera.example/old");
+ Should.Throw(() => camera.Update("Après", "relative", null));
+ camera.Name.ShouldBe("Avant");
+ camera.StreamUri.AbsoluteUri.ShouldBe("rtsp://camera.example/old");
+ }
+
+ [Fact]
+ public void Update_ValidConfiguration_RemovesSecretReferenceWithoutEnabling()
+ {
+ Camera camera = Camera.Register(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "Avant", "rtsp://camera.example/old", Guid.NewGuid());
+ camera.Disable();
+ camera.Update(" Après ", "rtsps://camera.example/new", null);
+ camera.Name.ShouldBe("Après");
+ camera.StreamUri.Scheme.ShouldBe("rtsps");
+ camera.CredentialReference.ShouldBeNull();
+ camera.IsEnabled.ShouldBeFalse();
+ }
+
+ [Fact]
+ public void Disable_RepeatedCall_PreservesConfiguration()
+ {
+ Camera camera = Camera.Register(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "Camera", "rtsp://camera.example/stream");
+ camera.Disable();
+ camera.Disable();
+ camera.IsEnabled.ShouldBeFalse();
+ camera.Name.ShouldBe("Camera");
+ }
+}
diff --git a/migration/tests/Heimdall.Migration.Domain.Tests/Heimdall.Migration.Domain.Tests.csproj b/migration/tests/Heimdall.Migration.Domain.Tests/Heimdall.Migration.Domain.Tests.csproj
new file mode 100644
index 0000000..7b99b05
--- /dev/null
+++ b/migration/tests/Heimdall.Migration.Domain.Tests/Heimdall.Migration.Domain.Tests.csproj
@@ -0,0 +1,18 @@
+
+
+ Exe
+ false
+ true
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
diff --git a/migration/tests/Heimdall.Migration.Domain.Tests/SiteTests.cs b/migration/tests/Heimdall.Migration.Domain.Tests/SiteTests.cs
new file mode 100644
index 0000000..0b1584b
--- /dev/null
+++ b/migration/tests/Heimdall.Migration.Domain.Tests/SiteTests.cs
@@ -0,0 +1,62 @@
+using Heimdall.Sites.Domain;
+using Shouldly;
+using Xunit;
+
+namespace Heimdall.Migration.Domain.Tests;
+
+public sealed class SiteTests
+{
+ [Fact]
+ public void Create_ValidInput_PreservesIdentityAndNormalizesName()
+ {
+ Guid id = Guid.NewGuid();
+ Guid tenant = Guid.NewGuid();
+ Site site = Site.Create(id, tenant, " Entrée ", "UTC");
+ site.Id.ShouldBe(id);
+ site.TenantId.ShouldBe(tenant);
+ site.Name.ShouldBe("Entrée");
+ site.TimeZoneId.ShouldBe("UTC");
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public void Create_MissingIdentity_RejectsSite(bool missingSite)
+ {
+ Should.Throw(() =>
+ Site.Create(missingSite ? Guid.Empty : Guid.NewGuid(), missingSite ? Guid.NewGuid() : Guid.Empty, "Site", "UTC"));
+ }
+
+ [Theory]
+ [InlineData("")]
+ [InlineData(" ")]
+ public void Create_EmptyName_RejectsSite(string name)
+ {
+ Should.Throw(() => Site.Create(Guid.NewGuid(), Guid.NewGuid(), name, "UTC"));
+ }
+
+ [Fact]
+ public void Update_InvalidTimeZone_PreservesPreviousState()
+ {
+ Site site = Site.Create(Guid.NewGuid(), Guid.NewGuid(), "Avant", "UTC");
+ Should.Throw(() => site.Update("Après", "invalid/timezone"));
+ site.Name.ShouldBe("Avant");
+ site.TimeZoneId.ShouldBe("UTC");
+ }
+
+ [Fact]
+ public void Update_LongName_PreservesPreviousState()
+ {
+ Site site = Site.Create(Guid.NewGuid(), Guid.NewGuid(), "Avant", "UTC");
+ Should.Throw(() => site.Update(new string('x', 201), "UTC"));
+ site.Name.ShouldBe("Avant");
+ }
+
+ [Fact]
+ public void Update_ValidInput_ChangesConfiguration()
+ {
+ Site site = Site.Create(Guid.NewGuid(), Guid.NewGuid(), "Avant", "UTC");
+ site.Update(" Après ", "UTC");
+ site.Name.ShouldBe("Après");
+ }
+}