< Summary - Syki

Information
Class: Syki.Back.Features.Cross.SeedInstitutionData.SeedInstitutionUsersCommandHandler
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/SeedInstitutionData/SeedInstitutionUsersCommand.cs
Tag: 21_17346963026
Line coverage
0%
Covered lines: 0
Uncovered lines: 34
Coverable lines: 34
Total lines: 55
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
Handle()0%4260%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/SeedInstitutionData/SeedInstitutionUsersCommand.cs

#LineLine coverage
 1using Syki.Back.Features.Academic.CreateStudent;
 2using Syki.Back.Features.Academic.CreateTeacher;
 3
 4namespace Syki.Back.Features.Cross.SeedInstitutionData;
 5
 6[CommandDescription("Realizar seed de usuários da instituição")]
 7public record SeedInstitutionUsersCommand(Guid InstitutionId, Guid DireitoCourseOfferingId, Guid AdsCourseOfferingId) : 
 8
 09public class SeedInstitutionUsersCommandHandler(
 010    CreateTeacherService createTeacherService,
 011    CreateStudentService createStudentService) : ICommandHandler<SeedInstitutionUsersCommand>
 12{
 13    public async Task Handle(CommandId commandId, SeedInstitutionUsersCommand command)
 14    {
 015        var id = command.InstitutionId;
 16
 017        var teachers = new List<string>()
 018        {
 019            "Davi Pessoa Ferraz",
 020            "Luciete Bezerra Alves",
 021            "Manuela Abath Valença",
 022            "Paulo Marcelo Pedrosa de Almeida",
 023        };
 024        foreach (var name in teachers)
 25        {
 026            await createTeacherService.Create(id, CreateTeacherIn.Seed(name));
 27        }
 28
 029        var direitoStudents = new List<string>()
 030        {
 031            "Alisson Aranda de Aguiar",
 032            "Maria Júlia de Oliveira Melo",
 033            "Everton Ian de Galhardo Filho",
 034            "Alma Celeste Maldonado Mendonça",
 035        };
 036        foreach (var name in direitoStudents)
 37        {
 038            await createStudentService.Create(id, CreateStudentIn.Seed(name, command.DireitoCourseOfferingId));
 39        }
 40
 041        var adsStudents = new List<string>()
 042        {
 043            "Simone Bezerra",
 044            "Marcelo Lima Filho",
 045            "Josilda Aragão Paz",
 046            "Marlene de Oliveira",
 047            "Miguel Gomes da Silva",
 048            "Zaqueu do Vale Cavalcante",
 049        };
 050        foreach (var name in adsStudents)
 51        {
 052            await createStudentService.Create(id, CreateStudentIn.Seed(name, command.AdsCourseOfferingId));
 53        }
 054    }
 55}