< Summary

Information
Class: MRA.Extensions.StringExtensions
Assembly: MRA.Extensions
File(s): D:\a\MiguelRomerART\MiguelRomerART\Shared\MRA.Extensions\StringExtensions.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 17
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetSpotifyTrackId(...)100%44100%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\Shared\MRA.Extensions\StringExtensions.cs

#LineLine coverage
 1using System.Text.RegularExpressions;
 2
 3namespace MRA.Extensions;
 4
 5public static class StringExtensions
 6{
 7    public static string GetSpotifyTrackId(this string url)
 8    {
 29        string pattern = @"\/track\/([^\/?]+)(?:\?|$)";
 10
 211        Regex regex = new Regex(pattern);
 12
 213        Match match = regex.Match(url ?? string.Empty);
 14
 215        return match.Success ? match.Groups[1].Value : string.Empty;
 16    }
 17}