using Omika.Core.Domain.Entities.Planning; using Omika.Core.Domain.ValueObjects; namespace Omika.Tests.Domain; /// /// Tests de l'agrégat métier canonique , unique pour /// l'ancien et le nouveau schéma de base. /// public class RendezVousDomainTests { [Fact] public void RendezVous_IsIndependentOfPhysicalTableNames() { var rendezVous = new RendezVous(); string[] forbidden = ["Planning_RDV", "RDV_Planning", "RDP_GUID", "PL_PKID"]; Assert.DoesNotContain(forbidden, name => rendezVous.GetType().Name.Contains(name, StringComparison.Ordinal)); foreach (var property in rendezVous.GetType().GetProperties()) { Assert.DoesNotContain(forbidden, name => property.Name.Contains(name, StringComparison.Ordinal)); } } [Fact] public void RendezVous_HoldsPeriodeAsValueObject() { var rendezVous = new RendezVous { Titre = "Visite", Periode = new DateTimeRange(new DateTime(2026, 2, 1, 9, 0, 0), new DateTime(2026, 2, 1, 11, 0, 0)) }; Assert.Equal(new DateTime(2026, 2, 1, 9, 0, 0), rendezVous.Periode.Start); Assert.Equal(new DateTime(2026, 2, 1, 11, 0, 0), rendezVous.Periode.End); } [Fact] public void RendezVous_CanCarryCollaborateursAndContacts() { var rendezVous = new RendezVous(); rendezVous.AddCollaborateur(new AffectationCollaborateur { CollaborateurId = Guid.NewGuid(), Responsable = true }); rendezVous.AddCollaborateur(new AffectationCollaborateur { CollaborateurId = Guid.NewGuid() }); rendezVous.AddContact(new ParticipantRendezVous { ContactId = Guid.NewGuid(), PresenceConfirmee = true }); Assert.Equal(2, rendezVous.Collaborateurs.Count); Assert.Single(rendezVous.Contacts); Assert.True(rendezVous.Contacts[0].PresenceConfirmee); } [Fact] public void RendezVous_CanCarryAnnulation() { var rendezVous = new RendezVous { Annulation = new AnnulationRendezVous { DateAnnulation = new DateTime(2026, 2, 1, 8, 0, 0), Commentaire = "Reporté" } }; Assert.NotNull(rendezVous.Annulation); Assert.Equal("Reporté", rendezVous.Annulation.Commentaire); } }