Premiere commit - Omika
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Omika.Core.Domain.Entities.Interventions;
|
||||
using Omika.Core.Domain.ValueObjects;
|
||||
|
||||
namespace Omika.Tests.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// Tests de l'entité métier canonique <see cref="Intervention"/>.
|
||||
/// </summary>
|
||||
public class InterventionDomainTests
|
||||
{
|
||||
[Fact]
|
||||
public void Intervention_UsesReferenceValuesForTypeEtatPriorite()
|
||||
{
|
||||
var intervention = new Intervention
|
||||
{
|
||||
Type = new ReferenceValue("Maintenance") { Key = "MAINT" },
|
||||
Etat = new ReferenceValue("En cours"),
|
||||
Priorite = new ReferenceValue("Haute") { LegacyId = 3 }
|
||||
};
|
||||
|
||||
Assert.Equal("MAINT", intervention.Type!.Key);
|
||||
Assert.Equal("En cours", intervention.Etat!.Label);
|
||||
Assert.Equal(3, intervention.Priorite!.LegacyId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Intervention_CanCarryCollaborateursActionsAndComptesRendus()
|
||||
{
|
||||
var intervention = new Intervention();
|
||||
|
||||
intervention.AddCollaborateur(Guid.NewGuid());
|
||||
intervention.AddContact(Guid.NewGuid());
|
||||
intervention.AddAction(new ActionIntervention { Description = "Préparer le plan", Terminee = false });
|
||||
intervention.AddCompteRendu(new CompteRendu { Contenu = "Site inspecté" });
|
||||
|
||||
Assert.Single(intervention.CollaborateurIds);
|
||||
Assert.Single(intervention.ContactIds);
|
||||
Assert.Single(intervention.Actions);
|
||||
Assert.Single(intervention.ComptesRendus);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Intervention_DoesNotExposeZombieFields()
|
||||
{
|
||||
var intervention = new Intervention();
|
||||
|
||||
string[] forbidden = ["Pkid", "IdStatut", "CleStatut", "CleType", "RDP_"];
|
||||
|
||||
foreach (var property in intervention.GetType().GetProperties())
|
||||
{
|
||||
Assert.DoesNotContain(forbidden, f => property.Name.Contains(f, StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user