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

loresoft / MediatR.CommandQuery / 11712653438

06 Nov 2024 10:05PM CUT coverage: 59.479%. Remained the same
11712653438

push

github

pwelter34
fix dependance issue

389 of 741 branches covered (52.5%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

1208 of 1944 relevant lines covered (62.14%)

19.58 hits per line

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

0.0
/src/MediatR.CommandQuery.Cosmos/Handlers/EntityIdentifierQueryHandler.cs
1
using AutoMapper;
2

3
using Cosmos.Abstracts;
4

5
using MediatR.CommandQuery.Definitions;
6
using MediatR.CommandQuery.Queries;
7

8
using Microsoft.Extensions.Logging;
9

10
namespace MediatR.CommandQuery.Cosmos.Handlers;
11

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

21
    protected override async Task<TReadModel> Process(EntityIdentifierQuery<string, TReadModel> request, CancellationToken cancellationToken)
22
    {
23
        ArgumentNullException.ThrowIfNull(request);
×
24
        if (!CosmosKey.TryDecode(request.Id, out var id, out var partitionKey))
×
25
            throw new InvalidOperationException("Invalid Cosmos Key format");
×
26

27
        var entity = await Repository
×
28
            .FindAsync(id, partitionKey, cancellationToken)
×
29
            .ConfigureAwait(false);
×
30

31
        // convert deleted entity to read model
32
        var model = Mapper.Map<TReadModel>(entity);
×
33

34
        return model;
×
35
    }
×
36
}
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