< Summary

Information
Class: event_list.modules.eventlist.services.EventListFetchByIdentifierService
Assembly: event-list
File(s): /Users/tiagoamaral/Workspace/desafio/event-list-api/Src/Modules/Eventlist/Services/EventListFetchByIdentifierService.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 37
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%
Fetch()100%22100%

File(s)

/Users/tiagoamaral/Workspace/desafio/event-list-api/Src/Modules/Eventlist/Services/EventListFetchByIdentifierService.cs

#LineLine coverage
 1/*
 2* eventListFetchByIdentifier.cs
 3* event-list
 4*
 5* Created by Tiago Amaral on 06/09/2025.
 6* Copyright ©2024 Tiago Amaral. All rights reserved.
 7*/
 8
 9using event_list.modules.eventlist.storage;
 10using event_list.shared.exceptionsMessage;
 11
 12namespace event_list.modules.eventlist.services;
 13
 14public interface IEventListFetchByIdentifierService
 15{
 16    Task<EventFormDto?> Fetch(Guid id);
 17}
 18
 19public class EventListFetchByIdentifierService: IEventListFetchByIdentifierService
 20{
 21    private readonly IEventListStorage _storage;
 22
 223    public EventListFetchByIdentifierService(IEventListStorage storage)
 224    {
 225        this._storage = storage;
 226    }
 27
 28    public async Task<EventFormDto?> Fetch(Guid id)
 229    {
 230        var eventF = await _storage.GetByIdAsync(id);
 31
 232        if (eventF == null)
 133            throw new KeyNotFoundException(ExceptionsMessages.EventNotFounded);
 34
 135        return eventF;
 136    }
 37}