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

ThreeMammals / Ocelot / 26241073880

21 May 2026 05:06PM UTC coverage: 95.327% (+0.6%) from 94.721%
26241073880

push

github

raman-m
Ref SDK 10.0.300 (Runtime 10.0.8) to release Ocelot v25 beta 3 and Ocelot.Testing v25 beta 8+ (#2389)

* Prepare to release Ocelot.Testing v25.0.0-beta.8 package
* Bump all packages to the latest versions, including .NET SDK 10.0.203 (Runtime 10.0.7) released April 21, 2026
* Migrate unit testing from VSTest framework to Microsoft.Testing.Platform
* Do not use 'Cake Build' step in PR workflow, use plain dotnet scripting instead
* Fix "Unit Tests" step in PR workflow
* Rename job to "build" since it's not Cake anymore
* Suppress non-zero result and check test running status
* Update "Acceptance Tests" step
* Don't collect Coverlet code coverage data in "Acceptance Tests" step
* Update prepare-coveralls.sh
* Prepare Coveralls script v2
* Prepare Coveralls script v3
* Prepare Coveralls script v4
* Prepare Coveralls script v5 -> Add 2nd BUILD_CONFIGURATION argument
* Upgrade to SDK 10.0.300 aka Runtime 10.0.8
* Update samples
* Update workflows: prefer plain dotnet scripting over Cake Build

6752 of 7083 relevant lines covered (95.33%)

2730.81 hits per line

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

90.32
src/Ocelot/Configuration/Parser/ClaimToThingConfigurationParser.cs
1
using Ocelot.Infrastructure;
2
using Ocelot.Responses;
3

4
namespace Ocelot.Configuration.Parser;
5

6
/// <summary>
7
/// Default implementation of the <see cref="IClaimToThingConfigurationParser"/> interface.
8
/// </summary>
9
public partial class ClaimToThingConfigurationParser : IClaimToThingConfigurationParser
10
{
11
    private const char SplitToken = '>';
12

13
    [GeneratedRegex("Claims\\[.*\\]", RegexOptions.None, RegexGlobal.DefaultMatchTimeoutMilliseconds)]
14
    private static partial Regex ClaimRegex();
15

16
    [GeneratedRegex("value\\[.*\\]", RegexOptions.None, RegexGlobal.DefaultMatchTimeoutMilliseconds)]
17
    private static partial Regex IndexRegex();
18

19
    public Response<ClaimToThing> Extract(string existingKey, string value)
20
    {
4✔
21
        try
22
        {
4✔
23
            var instructions = value.Split(SplitToken);
4✔
24

25
            if (instructions.Length <= 1)
4✔
26
            {
1✔
27
                return new ErrorResponse<ClaimToThing>(new NoInstructionsError(SplitToken.ToString()));
1✔
28
            }
29

30
            var claimMatch = ClaimRegex().IsMatch(instructions[0]);
3✔
31

32
            if (!claimMatch)
3✔
33
            {
1✔
34
                return new ErrorResponse<ClaimToThing>(new InstructionNotForClaimsError());
1✔
35
            }
36

37
            var newKey = GetIndexValue(instructions[0]);
2✔
38
            var index = 0;
2✔
39
            var delimiter = string.Empty;
2✔
40

41
            if (instructions.Length > 2 && IndexRegex().IsMatch(instructions[1]))
2✔
42
            {
1✔
43
                index = int.Parse(GetIndexValue(instructions[1]));
1✔
44
                delimiter = instructions[2].Trim();
1✔
45
            }
1✔
46

47
            return new OkResponse<ClaimToThing>(
2✔
48
                           new ClaimToThing(existingKey, newKey, delimiter, index));
2✔
49
        }
50
        catch (Exception exception)
×
51
        {
×
52
            return new ErrorResponse<ClaimToThing>(new ParsingConfigurationHeaderError(exception));
×
53
        }
54
    }
4✔
55

56
    private static string GetIndexValue(string instruction)
57
    {
3✔
58
        var firstIndexer = instruction.IndexOf('[', StringComparison.Ordinal);
3✔
59
        var lastIndexer = instruction.IndexOf(']', StringComparison.Ordinal);
3✔
60
        var length = lastIndexer - firstIndexer;
3✔
61
        var claimKey = instruction.Substring(firstIndexer + 1, length - 1);
3✔
62
        return claimKey;
3✔
63
    }
3✔
64
}
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