< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Line coverage
100%
Covered lines: 25
Uncovered lines: 0
Coverable lines: 25
Total lines: 107
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
MigrationNotFound(...)100%11100%
TargetNotFound(...)100%11100%
SchemaNotReady(...)100%11100%
RowsReferenced(...)100%11100%
SoftDeleteNotSupported(...)100%11100%
ChecksumMismatch(...)100%11100%
OutOfOrderMigration(...)100%11100%
LockTimeout(...)100%11100%
InvalidDataFile(...)100%11100%
UnknownProperty(...)100%11100%
CycleDetected(...)100%11100%
SystemUserRequired(...)100%11100%
Data(...)100%11100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.DbSeeder/Errors/SeedErrors.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.DbSeeder;
 2
 3/// <summary>
 4/// The errors and warnings of seed migrations. Type: <c>SeedError</c>. Warnings (<see cref="ChecksumMismatch"/>,
 5/// <see cref="OutOfOrderMigration"/>) have <see cref="Severity.Low"/> and come back in <see cref="SeedRunResult.Warning
 6/// Database failures are classified by the provider (<see cref="ISeedDatabaseProvider.Classify"/>).
 7/// </summary>
 8public static class SeedErrors
 9{
 10    private const string SeedError = nameof( SeedError );
 11
 12
 13    /// <summary>A migration's manifest lists a table file that isn't embedded.</summary>
 14    /// <param name="migrationId">The migration id.</param>
 15    /// <param name="file">The missing file name.</param>
 16    /// <returns>The <c>MigrationNotFound</c> error (severity High).</returns>
 17    public static Error MigrationNotFound( string migrationId, string file )
 718        => new( nameof( MigrationNotFound ), SeedError, "ملف بيانات ترحيل البيانات الأولية غير موجود.", "A seed migratio
 719                additionalData: Data( ( "MigrationId", migrationId ), ( "File", file ) ) );
 20
 21    /// <summary>The target migration id isn't one of the context's seed migrations.</summary>
 22    /// <param name="targetMigrationId">The requested id.</param>
 23    /// <returns>The <c>TargetNotFound</c> error (severity Medium).</returns>
 24    public static Error TargetNotFound( string targetMigrationId )
 725        => new( nameof( TargetNotFound ), SeedError, "ترحيل البيانات الأولية المطلوب غير موجود.", "The target seed migra
 726                additionalData: Data( ( "MigrationId", targetMigrationId ) ) );
 27
 28    /// <summary>The schema migration the seed migration needs isn't applied yet.</summary>
 29    /// <param name="migrationId">The seed migration id.</param>
 30    /// <param name="schemaMigrationId">The EF migration it needs.</param>
 31    /// <returns>The <c>SchemaNotReady</c> error (severity High).</returns>
 32    public static Error SchemaNotReady( string migrationId, string schemaMigrationId )
 633        => new( nameof( SchemaNotReady ), SeedError, "مخطط قاعدة البيانات غير محدث لهذه البيانات الأولية.", "The databas
 634                Severity.High, additionalData: Data( ( "MigrationId", migrationId ), ( "RequiresSchemaMigration", schema
 35
 36    /// <summary>Seed rows can't be deleted because other rows still reference them.</summary>
 37    /// <param name="table">The table of the seed rows.</param>
 38    /// <param name="blockers">The referencing tables, columns and row counts.</param>
 39    /// <returns>The <c>RowsReferenced</c> error (severity High).</returns>
 40    public static Error RowsReferenced( string table, IReadOnlyList<SeedBlocker> blockers )
 1141        => new( nameof( RowsReferenced ), SeedError, "لا يمكن حذف البيانات الأولية لأنها مستخدمة في سجلات أخرى.", "The s
 1142                Severity.High, additionalData: Data( ( "Table", table ), ( "Blockers", blockers ) ) );
 43
 44    /// <summary>A soft delete was asked for an entity without a soft-delete flag.</summary>
 45    /// <param name="entity">The entity type name.</param>
 46    /// <returns>The <c>SoftDeleteNotSupported</c> error (severity Medium).</returns>
 47    public static Error SoftDeleteNotSupported( string entity )
 448        => new( nameof( SoftDeleteNotSupported ), SeedError, "هذا الكيان لا يدعم الحذف المنطقي.", "This entity doesn't s
 449                additionalData: Data( ( "Entity", entity ) ) );
 50
 51    /// <summary>Warning: an applied migration's files changed since it was applied.</summary>
 52    /// <param name="migrationId">The migration id.</param>
 53    /// <returns>The <c>ChecksumMismatch</c> warning (severity Low).</returns>
 54    public static Error ChecksumMismatch( string migrationId )
 955        => new( nameof( ChecksumMismatch ), SeedError, "تم تعديل ملفات ترحيل بيانات أولية بعد تطبيقه.", "An applied seed
 956                Severity.Low, additionalData: Data( ( "MigrationId", migrationId ) ) );
 57
 58    /// <summary>Warning: a pending migration is older than the newest applied one; it was applied anyway.</summary>
 59    /// <param name="migrationId">The migration id.</param>
 60    /// <returns>The <c>OutOfOrderMigration</c> warning (severity Low).</returns>
 61    public static Error OutOfOrderMigration( string migrationId )
 662        => new( nameof( OutOfOrderMigration ), SeedError, "تم تطبيق ترحيل بيانات أولية أقدم من آخر ترحيل مطبق.", "A seed
 663                Severity.Low, additionalData: Data( ( "MigrationId", migrationId ) ) );
 64
 65    /// <summary>Another runner holds the seed lock and it wasn't released in time.</summary>
 66    /// <param name="timeout">How long the runner waited.</param>
 67    /// <returns>The <c>LockTimeout</c> error (severity Medium).</returns>
 68    public static Error LockTimeout( TimeSpan timeout )
 769        => new( nameof( LockTimeout ), SeedError, "انتهت مهلة انتظار قفل ترحيل البيانات الأولية.", "Timed out waiting fo
 770                additionalData: Data( ( "Timeout", timeout ) ) );
 71
 72    /// <summary>A manifest or table file is malformed or doesn't fit the model.</summary>
 73    /// <param name="file">The file (resource) name.</param>
 74    /// <param name="reason">What is wrong, in English, for logs.</param>
 75    /// <param name="exception">The parse exception, if any.</param>
 76    /// <returns>The <c>InvalidDataFile</c> error (severity High).</returns>
 77    public static Error InvalidDataFile( string file, string reason, Exception? exception = null )
 7878        => new( nameof( InvalidDataFile ), SeedError, "ملف البيانات الأولية غير صالح.", "A seed data file is invalid.", 
 7879                Data( ( "File", file ), ( "Reason", reason ) ) );
 80
 81    /// <summary>A data file names a property the entity doesn't have.</summary>
 82    /// <param name="file">The file (resource) name.</param>
 83    /// <param name="entity">The entity type name.</param>
 84    /// <param name="property">The unknown property.</param>
 85    /// <returns>The <c>UnknownProperty</c> error (severity High).</returns>
 86    public static Error UnknownProperty( string file, string entity, string property )
 687        => new( nameof( UnknownProperty ), SeedError, "ملف البيانات الأولية يحتوي على خاصية غير معروفة.", "A seed data f
 688                additionalData: Data( ( "File", file ), ( "Entity", entity ), ( "Property", property ) ) );
 89
 90    /// <summary>The tables of a migration reference each other in a cycle, so there is no safe order.</summary>
 91    /// <param name="migrationId">The migration id.</param>
 92    /// <param name="entities">The entities in the cycle.</param>
 93    /// <returns>The <c>CycleDetected</c> error (severity High).</returns>
 94    public static Error CycleDetected( string migrationId, IReadOnlyList<string> entities )
 695        => new( nameof( CycleDetected ), SeedError, "توجد علاقات دائرية بين جداول البيانات الأولية.", "The seed tables r
 696                additionalData: Data( ( "MigrationId", migrationId ), ( "Entities", entities ) ) );
 97
 98    /// <summary>An entity has created-by / updated-by / deleted-by fields, but no system user is configured.</summary>
 99    /// <param name="entity">The entity type name.</param>
 100    /// <returns>The <c>SystemUserRequired</c> error (severity High).</returns>
 101    public static Error SystemUserRequired( string entity )
 6102        => new( nameof( SystemUserRequired ), SeedError, "يجب تحديد مستخدم النظام للبيانات الأولية.", "A system user mus
 6103                additionalData: Data( ( "Entity", entity ) ) );
 104
 105
 153106    private static Dictionary<string, object> Data( params (string Key, object Value)[] values ) => values.ToDictionary(
 107}