< Summary - Syki

Information
Class: Syki.Back.Features.Cross.SeedInstitutionData.SeedInstitutionUsersCommand
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/SeedInstitutionData/SeedInstitutionUsersCommand.cs
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 58
Line coverage: 0%
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
get_InstitutionId()100%210%

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")]
 07public record SeedInstitutionUsersCommand(Guid InstitutionId, Guid DireitoCourseOfferingId, Guid AdsCourseOfferingId) : 
 8
 9public class SeedInstitutionUsersCommandHandler(
 10    SykiDbContext ctx,
 11    CreateTeacherService createTeacherService,
 12    CreateStudentService createStudentService) : ICommandHandler<SeedInstitutionUsersCommand>
 13{
 14    public async Task Handle(CommandId commandId, SeedInstitutionUsersCommand command)
 15    {
 16        var id = command.InstitutionId;
 17
 18        var teachers = new List<string>()
 19        {
 20            "Davi Pessoa Ferraz",
 21            "Luciete Bezerra Alves",
 22            "Manuela Abath Valença",
 23            "Paulo Marcelo Pedrosa de Almeida",
 24        };
 25        foreach (var name in teachers)
 26        {
 27            await createTeacherService.CreateWithThrowOnError(id, CreateTeacherIn.Seed(name));
 28        }
 29
 30        var direitoStudents = new List<string>()
 31        {
 32            "Alisson Aranda de Aguiar",
 33            "Maria Júlia de Oliveira Melo",
 34            "Everton Ian de Galhardo Filho",
 35            "Alma Celeste Maldonado Mendonça",
 36        };
 37        foreach (var name in direitoStudents)
 38        {
 39            await createStudentService.CreateWithThrowOnError(id, CreateStudentIn.Seed(name, command.DireitoCourseOfferi
 40        }
 41
 42        var adsStudents = new List<string>()
 43        {
 44            "Simone Bezerra",
 45            "Marcelo Lima Filho",
 46            "Josilda Aragão Paz",
 47            "Marlene de Oliveira",
 48            "Miguel Gomes da Silva",
 49            "Zaqueu do Vale Cavalcante",
 50        };
 51        foreach (var name in adsStudents)
 52        {
 53            await createStudentService.CreateWithThrowOnError(id, CreateStudentIn.Seed(name, command.AdsCourseOfferingId
 54        }
 55
 56        ctx.AddCommand(id, new SeedInstitutionClassesCommand(id), parentId: commandId);
 57    }
 58}

Methods/Properties

get_InstitutionId()