< Summary

Information
Class: Minesweeper.Cell
Assembly: Minesweeper
File(s): /home/runner/work/poc-csharp-tdd-kata-minesweeper2/poc-csharp-tdd-kata-minesweeper2/src/Minesweeper/Cell.cs
Tag: 29_2324258472
Line coverage
88%
Covered lines: 37
Uncovered lines: 5
Coverable lines: 42
Total lines: 56
Line coverage: 88%
Branch coverage
79%
Covered branches: 19
Total branches: 24
Branch coverage: 79.1%
Method coverage

Method coverage is only available for sponsors.

Upgrade to PRO version

Coverage History

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Inner()100%1100%
get_Value()100%1100%
ClickTo()75%483.33%
BombTo()50%477.77%
IsBomb()100%4100%
ToChar()83.33%685.71%
New()100%1100%
ToInnerChar()50%280%
AddNumberTo()100%4100%

File(s)

/home/runner/work/poc-csharp-tdd-kata-minesweeper2/poc-csharp-tdd-kata-minesweeper2/src/Minesweeper/Cell.cs

#LineLine coverage
 1namespace Minesweeper;
 2
 3public record Cell
 4{
 2635    public record Covered(Cell Inner) : Cell;
 6    public record Bomb : Cell;
 2297    public record Number(int Value) : Cell;
 8    public record Empty : Cell;
 9
 2810    public Cell ClickTo() => this switch
 2811    {
 012        Empty x => x,
 1413        Covered x => x.Inner.ClickTo(),
 1414        var x => x
 2815    };
 16
 917    public Cell BombTo() => this switch
 918    {
 019        Empty x => x,
 920        Covered x => x with
 921        {
 922            Inner = new Bomb()
 923        },
 024        _ => new Bomb()
 925    };
 26
 4927    public bool IsBomb() => this switch
 4928    {
 729        Bomb => true,
 2030        Covered x => x.Inner.IsBomb(),
 2231        _ => false
 4932    };
 33
 2234    public char ToChar() => this switch
 2235    {
 636        Covered => '.',
 337        Bomb => '*',
 1338        Number x => Convert.ToChar(48 + x.Value),
 039        _ => throw new NotImplementedException(),
 2240    };
 41
 5442    public static Cell New() => new Covered(new Number(0));
 43
 944    public char ToInnerChar() => this switch
 945    {
 946        Covered x => x.Inner.ToChar(),
 047        var x => x.ToChar()
 948    };
 49
 7150    public Cell AddNumberTo() => this switch
 7151    {
 3352        Covered x => new Covered(x.Inner.AddNumberTo()),
 3053        Number x => new Number(x.Value + 1),
 854        var x => x
 7155    };
 56}