• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

loresoft / MediatR.CommandQuery / 8911801772

01 May 2024 04:09PM CUT coverage: 57.379% (-1.8%) from 59.163%
8911801772

push

github

pwelter34
tweak build

342 of 700 branches covered (48.86%)

Branch coverage included in aggregate %.

1011 of 1658 relevant lines covered (60.98%)

18.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/MediatR.CommandQuery.MongoDB/Handlers/EntityIdentifierQueryHandler.cs
1
using AutoMapper;
2

3
using MediatR.CommandQuery.Definitions;
4
using MediatR.CommandQuery.Queries;
5

6
using Microsoft.Extensions.Logging;
7

8
using MongoDB.Abstracts;
9

10
namespace MediatR.CommandQuery.MongoDB.Handlers;
11

12
public class EntityIdentifierQueryHandler<TRepository, TEntity, TKey, TReadModel>
13
    : RepositoryHandlerBase<TRepository, TEntity, TKey, EntityIdentifierQuery<TKey, TReadModel>, TReadModel>
14
    where TRepository : IMongoRepository<TEntity, TKey>
15
    where TEntity : class, IHaveIdentifier<TKey>, new()
16
{
17
    public EntityIdentifierQueryHandler(ILoggerFactory loggerFactory, TRepository repository, IMapper mapper) : base(loggerFactory, repository, mapper)
15✔
18
    {
19
    }
15✔
20

21
    protected override async Task<TReadModel> Process(EntityIdentifierQuery<TKey, TReadModel> request, CancellationToken cancellationToken)
22
    {
23
        if (request is null)
15!
24
            throw new ArgumentNullException(nameof(request));
×
25

26
        var entity = await Repository
15✔
27
            .FindAsync(request.Id, cancellationToken)
15✔
28
            .ConfigureAwait(false);
15✔
29

30
        // convert entity to read model
31
        var model = Mapper.Map<TReadModel>(entity);
15✔
32

33
        return model;
15✔
34
    }
15✔
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc