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

loresoft / MediatR.CommandQuery / 14067111219

25 Mar 2025 06:14PM UTC coverage: 59.397% (-0.5%) from 59.879%
14067111219

push

github

pwelter34
Update MediatorServiceExtensions.cs

495 of 971 branches covered (50.98%)

Branch coverage included in aggregate %.

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

113 existing lines in 15 files now uncovered.

1474 of 2344 relevant lines covered (62.88%)

22.57 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
using System.Text.Json.Serialization;
4

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

8
using SystemTextJsonPatch;
9

10
namespace MediatR.CommandQuery.Commands;
11

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

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

36
    /// <summary>
37
    /// Gets the JSON patch to apply to the entity with the specified identifier.
38
    /// </summary>
39
    /// <value>
40
    /// The patch.
41
    /// </value>
42
    [JsonPropertyName("patch")]
43
    public JsonPatchDocument Patch { get; }
10✔
44

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