< Summary

Information
Class: TicTacToeApp.API.Services.EtagService
Assembly: TicTacToeApp.API
File(s): /home/runner/work/TicTacToe/TicTacToe/TicTacToeApp.API/Services/EtagService.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 16
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GenerateETag(...)100%210%

File(s)

/home/runner/work/TicTacToe/TicTacToe/TicTacToeApp.API/Services/EtagService.cs

#LineLine coverage
 1using System.Security.Cryptography;
 2using System.Text;
 3using TicTacToeApp.API.Entity;
 4
 5namespace TicTacToeApp.API.Services;
 6
 7internal sealed class EtagService
 8{
 9    public static string GenerateETag(Game game)
 10    {
 011        var content = $"{game.Id}-{game.Board}";
 012        var bytes = Encoding.UTF8.GetBytes(content);
 013        var hash = SHA256.HashData(bytes);
 014        return $"\"{Convert.ToBase64String(hash)}\"";
 15    }
 16}