< Summary

Information
Class: LifeChart.Application.UseCases.Medications.GetActiveMedicationsUseCase
Assembly: LifeChart.Application
File(s): /home/runner/work/lifechart/lifechart/src/LifeChart.Application/UseCases/Medications/GetActiveMedicationsUseCase.cs
Tag: 113_29159449707
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 24
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
.ctor(...)100%210%
ExecuteAsync()100%210%

File(s)

/home/runner/work/lifechart/lifechart/src/LifeChart.Application/UseCases/Medications/GetActiveMedicationsUseCase.cs

#LineLine coverage
 1using LifeChart.Application.DTOs;
 2using LifeChart.Domain.Medications;
 3
 4namespace LifeChart.Application.UseCases.Medications;
 5
 6public class GetActiveMedicationsUseCase
 7{
 8    private readonly IMedicationRepository _repository;
 9
 010    public GetActiveMedicationsUseCase(IMedicationRepository repository)
 011        => _repository = repository;
 12
 13    public async Task<IEnumerable<MedicationDto>> ExecuteAsync()
 14    {
 015        var medications = await _repository.GetAllActiveAsync();
 016        return medications.Select(m => new MedicationDto(
 017            m.Id, m.Name, m.Dosage,
 018            m.MinStock, m.CurrentStock, m.IsStockLow,
 019            m.IntakeTimes
 020                .Select(i => new IntakeTimeDto(i.Time.ToString("HH:mm"), i.DoseCount))
 021                .ToList()
 022                .AsReadOnly()));
 023    }
 24}