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

loresoft / MediatR.CommandQuery / 12567339125

01 Jan 2025 04:52AM UTC coverage: 60.229% (-0.1%) from 60.328%
12567339125

push

github

pwelter34
switch to Testcontainers

402 of 761 branches covered (52.83%)

Branch coverage included in aggregate %.

1282 of 2035 relevant lines covered (63.0%)

19.24 hits per line

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

83.33
/src/MediatR.CommandQuery/Commands/EntityPatchCommand.cs
1
using System.Diagnostics.CodeAnalysis;
2
using System.Security.Claims;
3

4
using MediatR.CommandQuery.Definitions;
5
using MediatR.CommandQuery.Services;
6

7
using SystemTextJsonPatch;
8

9
namespace MediatR.CommandQuery.Commands;
10

11
/// <summary>
12
/// A command to apply a JSON patch to the entity with the specified identifier.
13
/// <typeparamref name="TReadModel"/> will be the result of the command.
14
/// </summary>
15
/// <typeparam name="TKey">The type of the key.</typeparam>
16
/// <typeparam name="TReadModel">The type of the read model.</typeparam>
17
public record EntityPatchCommand<TKey, TReadModel>
18
    : EntityIdentifierCommand<TKey, TReadModel>, ICacheExpire
19
{
20
    /// <summary>
21
    /// Initializes a new instance of the <see cref="EntityPatchCommand{TKey, TReadModel}"/> class.
22
    /// </summary>
23
    /// <param name="principal">the <see cref="ClaimsPrincipal" /> this command is run for</param>
24
    /// <param name="id">The identifier to apply JSON patch to.</param>
25
    /// <param name="patch">The JSON patch to apply.</param>
26
    /// <exception cref="System.ArgumentNullException">When <paramref name="id"/> or <paramref name="patch"/> is null</exception>
27
    public EntityPatchCommand(ClaimsPrincipal? principal, [NotNull] TKey id, [NotNull] JsonPatchDocument patch)
28
        : base(principal, id)
12✔
29
    {
30
        ArgumentNullException.ThrowIfNull(patch);
12✔
31

32
        Patch = patch;
10✔
33
    }
10✔
34

35
    /// <summary>
36
    /// Gets the JSON patch to apply to the entity with the specified identifier.
37
    /// </summary>
38
    /// <value>
39
    /// The patch.
40
    /// </value>
41
    public JsonPatchDocument Patch { get; }
10✔
42

43
    /// <inheritdoc />
44
    string? ICacheExpire.GetCacheTag()
45
        => CacheTagger.GetTag<TReadModel>();
×
46
}
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

© 2026 Coveralls, Inc