Premiere commit - Omika
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace Omika.Tests.Architecture;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user