< Summary

Information
Class: Elsa.Persistence.VNext.Document.DocumentDatabasePlanner
Assembly: Elsa.Persistence.VNext
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.VNext/Document/DocumentDatabasePlanner.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 25
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Plan(...)100%11100%
PlanCollection(...)50%44100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.VNext/Document/DocumentDatabasePlanner.cs

#LineLine coverage
 1using Elsa.Persistence.VNext.Contracts;
 2
 3namespace Elsa.Persistence.VNext.Document;
 4
 5public class DocumentDatabasePlanner : IPersistenceSchemaPlanner<DocumentDatabasePlan>
 6{
 7    public DocumentDatabasePlan Plan(PersistenceSchema schema)
 8    {
 189        var collections = schema.StorageUnits.Select(PlanCollection).ToList();
 1810        return new DocumentDatabasePlan(collections);
 11    }
 12
 13    private static DocumentCollection PlanCollection(PersistenceStorageUnit storageUnit)
 14    {
 2415        var fields = storageUnit.Fields
 15616            .Select(field => new DocumentField(field.Name, field.Type, field.IsNullable))
 2417            .ToList();
 2418        var indexes = storageUnit.Indexes
 6619            .Select(index => new DocumentIndex(index.Name, storageUnit.Name, storageUnit.Namespace, index.Columns, index
 2420            .ToList();
 2421        var keyFields = storageUnit.Key?.Columns ?? [];
 22
 2423        return new DocumentCollection(storageUnit.Name, storageUnit.Namespace, fields, keyFields, indexes);
 24    }
 25}