< Summary

Information
Class: Backend.Services.Impl.CategoryService
Assembly: Backend
File(s): D:\a\smart-meal-planner\smart-meal-planner\backend\Backend\Services\Impl\CategoryService.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 26
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 Cyclomatic complexity Line coverage
.ctor(...)100%10%
GetAllAsync()100%10%

File(s)

D:\a\smart-meal-planner\smart-meal-planner\backend\Backend\Services\Impl\CategoryService.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2using Backend.DTOs;
 3
 4namespace Backend.Services.Impl
 5{
 6    public class CategoryService : ICategoryService
 7    {
 8        private readonly PlannerContext _context;
 9        private readonly ILogger<PlannerContext> _logger;
 010        public CategoryService(PlannerContext context, ILogger<PlannerContext> logger)
 11        {
 012            _context = context;
 013            _logger = logger;
 014        }
 15
 16        public async Task<IEnumerable<CategoryDto>> GetAllAsync()
 17        {
 018            var categories = await _context.Categories
 019                .Select(c => new CategoryDto { Id = c.Id, Name = c.Name })
 020                .ToListAsync();
 21
 022            _logger.LogInformation("Retrieved {Count} categories", categories.Count);
 023            return categories;
 024        }
 25    }
 26}