< Summary

Information
Class: LOCKnet.App.Converters.IconSelectedBrushConverter
Assembly: LOCKnet.App
File(s): /home/runner/work/LOCKnet/LOCKnet/src/LOCKnet.App/Converters/IconSelectedBrushConverter.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 23
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
Convert(...)100%22100%
ConvertBack(...)100%11100%

File(s)

/home/runner/work/LOCKnet/LOCKnet/src/LOCKnet.App/Converters/IconSelectedBrushConverter.cs

#LineLine coverage
 1using Avalonia.Data.Converters;
 2using Avalonia.Media;
 3using System.Globalization;
 4
 5namespace LOCKnet.App.Converters;
 6
 7public sealed class IconSelectedBrushConverter : IValueConverter
 8{
 19  private static readonly IBrush SelectedBrush = new SolidColorBrush(Color.Parse("#6C63FF"));
 110  private static readonly IBrush UnselectedBrush = Brushes.Transparent;
 11
 12  public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
 213  {
 214    var selectedKey = value as string;
 215    var currentKey = parameter as string;
 216    return string.Equals(selectedKey, currentKey, StringComparison.Ordinal) ? SelectedBrush : UnselectedBrush;
 217  }
 18
 19  public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
 120  {
 121    throw new NotSupportedException();
 22  }
 23}