using System.Reflection; namespace Omika.Tests.Architecture; /// /// Omika.Core ne doit pas référencer Omika.Data : le modèle métier canonique et /// les contrats API sont indépendants de la persistance HFSQL. /// public class CoreMustNotReferenceDataTests { [Fact] public void OmikaCore_DoesNotReference_OmikaData() { Assembly core = typeof(Omika.Core.Domain.Common.EntityBase).Assembly; Assert.DoesNotContain( core.GetReferencedAssemblies(), assembly => assembly.Name == "Omika.Data"); } [Fact] public void OmikaCore_ContainsNoHfSqlAttribute() { Assembly core = typeof(Omika.Core.Domain.Common.EntityBase).Assembly; // Les attributs HFSQL appartiennent à Omika.Data : aucun type d'Omika.Core // ne doit en porter. var hfSqlAttributeNames = new[] { "HfSqlTableAttribute", "HfSqlColumnAttribute", "HfSqlPrimaryKeyAttribute" }; foreach (Type type in core.GetTypes()) { foreach (string attributeName in hfSqlAttributeNames) { Assert.DoesNotContain( type.GetCustomAttributesData(), attr => attr.AttributeType.Name == attributeName); } } } }