< Summary

Information
Class: Syki.Back.Features.Academic.CreateEnrollmentPeriod.EnrollmentPeriod
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/CreateEnrollmentPeriod/EnrollmentPeriod.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 29
Uncovered lines: 0
Coverable lines: 29
Total lines: 54
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_InstitutionId()100%11100%
get_StartAt()100%11100%
get_EndAt()100%11100%
.ctor(...)100%11100%
New(...)100%22100%
Update(...)100%22100%
ToOut()100%11100%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/CreateEnrollmentPeriod/EnrollmentPeriod.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.CreateEnrollmentPeriod;
 2
 3public class EnrollmentPeriod
 4{
 7015    public string Id { get; set; }
 2356    public Guid InstitutionId { get; set; }
 5427    public DateOnly StartAt { get; set; }
 6998    public DateOnly EndAt { get; set; }
 9
 23310    public EnrollmentPeriod(
 23311        string id,
 23312        Guid institutionId,
 23313        DateOnly startAt,
 23314        DateOnly endAt
 23315    ) {
 23316        Id = id;
 23317        InstitutionId = institutionId;
 23318        StartAt = startAt;
 23319        EndAt = endAt;
 23320    }
 21
 22    public static OneOf<EnrollmentPeriod, SykiError> New(
 23        string id,
 24        Guid institutionId,
 25        DateOnly startAt,
 26        DateOnly endAt
 27    ) {
 6528        if (startAt >= endAt)
 629            return new InvalidEnrollmentPeriodDates();
 30
 5931        return new EnrollmentPeriod(id, institutionId, startAt, endAt);
 32    }
 33
 34    public OneOf<SykiSuccess, SykiError> Update(DateOnly startAt, DateOnly endAt)
 35    {
 3936        if (startAt >= endAt)
 237            return new InvalidEnrollmentPeriodDates();
 38
 3739        StartAt = startAt;
 3740        EndAt = endAt;
 41
 3742        return new SykiSuccess();
 43    }
 44
 45    public EnrollmentPeriodOut ToOut()
 46    {
 9847        return new()
 9848        {
 9849            Id = Id,
 9850            StartAt = StartAt,
 9851            EndAt = EndAt,
 9852        };
 53    }
 54}