< Summary

Information
Class: Syki.Back.Features.Academic.CreateCourse.CreateCourseService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/CreateCourse/CreateCourseService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 16
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Create()100%22100%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/CreateCourse/CreateCourseService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.CreateCourse;
 2
 2543public class CreateCourseService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<OneOf<CourseOut, SykiError>> Create(Guid institutionId, CreateCourseIn data)
 6    {
 2547        if (!data.Type.IsValid()) return new InvalidCourseType();
 8
 2529        var course = new Course(institutionId, data.Name, data.Type);
 10
 25211        ctx.Add(course);
 25212        await ctx.SaveChangesAsync();
 13
 25214        return course.ToOut();
 25315    }
 16}