< Summary - Syki

Information
Class: Syki.Back.Features.Academic.CreateCampus.Campus
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/CreateCampus/Campus.cs
Tag: 4_16869239191
Line coverage
85%
Covered lines: 30
Uncovered lines: 5
Coverable lines: 35
Total lines: 67
Line coverage: 85.7%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
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_Name()100%11100%
get_State()100%11100%
get_City()100%11100%
get_Capacity()100%11100%
.ctor()100%11100%
.ctor(...)100%11100%
New(...)50%22100%
Update(...)100%11100%
ToOut()100%11100%
ToGetAcademicTeacherCampusOut()100%210%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/CreateCampus/Campus.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.CreateCampus;
 2
 3/// <summary>
 4/// Campus
 5/// </summary>
 6public class Campus
 7{
 6148    public Guid Id { get; set; }
 2929    public Guid InstitutionId { get; set; }
 110410    public string Name { get; set; }
 59811    public BrazilState State { get; set; }
 59812    public string City { get; set; }
 59813    public int Capacity { get; set; }
 14
 103615    private Campus() { }
 16
 29217    public Campus(Guid institutionId, string name, BrazilState state, string city, int capacity)
 18    {
 29219        Id = Guid.CreateVersion7();
 29220        InstitutionId = institutionId;
 29221        Name = name;
 29222        State = state;
 29223        City = city;
 29224        Capacity = capacity;
 29225    }
 26
 27    public static OneOf<Campus, SykiError> New(
 28        Guid institutionId,
 29        string name,
 30        BrazilState state,
 31        string city,
 32        int capacity
 33    ) {
 29034        if (capacity <= 0) return new InvalidCampusCapacity();
 35
 29036        return new Campus(institutionId, name, state, city, capacity);
 37    }
 38
 39    public void Update(string name, BrazilState state, string city, int capacity)
 40    {
 441        Name = name;
 442        State = state;
 443        City = city;
 444        Capacity = capacity;
 445    }
 46
 47    public CampusOut ToOut()
 48    {
 30249        return new()
 30250        {
 30251            Id = Id,
 30252            Name = Name,
 30253            State = State,
 30254            City = City,
 30255            Capacity = Capacity,
 30256        };
 57    }
 58
 59    public GetAcademicTeacherCampusOut ToGetAcademicTeacherCampusOut()
 60    {
 061        return new()
 062        {
 063            Id = Id,
 064            Name = $"{Name} ({City} - {State})",
 065        };
 66    }
 67}