< Summary

Information
Class: MRA.DTO.ViewModels.Art.DrawingFilter
Assembly: MRA.DTO
File(s): D:\a\MiguelRomerART\MiguelRomerART\MRA.DTO\ViewModels\Art\DrawingFilter.cs
Line coverage
100%
Covered lines: 45
Uncovered lines: 0
Coverable lines: 45
Total lines: 85
Line coverage: 100%
Branch coverage
100%
Covered branches: 18
Total branches: 18
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Type()100%11100%
get_ProductType()100%11100%
get_ProductName()100%11100%
get_ModelName()100%11100%
get_CharacterName()100%11100%
get_Collection()100%11100%
get_Software()100%11100%
get_Paper()100%11100%
get_Sortby()100%11100%
get_Spotify()100%11100%
get_TextQuery()100%11100%
get_Tags()100%11100%
get_Favorites()100%11100%
get_PageSize()100%11100%
get_PageNumber()100%11100%
get_OnlyVisible()100%11100%
get_CacheKey()100%11100%
GetModelNoFilters()100%11100%
OnlyFilterCollection()100%1818100%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\MRA.DTO\ViewModels\Art\DrawingFilter.cs

#LineLine coverage
 1using MRA.DTO.Enums;
 2using MRA.DTO.Enums.Drawing;
 3using MRA.DTO.Enums.DrawingFilter;
 4using MRA.Infrastructure.Enums;
 5using System.Text.Json.Serialization;
 6
 7namespace MRA.DTO.ViewModels.Art;
 8
 9public class DrawingFilter
 10{
 11    public const string PRODUCT_NONE = "none";
 12    public const string CHARACTER_NONE = "none";
 13    public const string MODEL_NONE = "none";
 14
 15    [JsonConverter(typeof(EnumStringJsonConverter<DrawingTypes>))]
 15616    public DrawingTypes Type { get; set; }
 17
 15418    public DrawingProductTypes ProductType { get; set; }
 19
 15520    public string ProductName { get; set; }
 21
 13022    public string ModelName { get; set; }
 23
 13024    public string CharacterName { get; set; }
 25
 14926    public string Collection { get; set; }
 27
 12828    public DrawingSoftwares Software { get; set; }
 29
 12830    public DrawingPaperSizes Paper { get; set; }
 31
 32    [JsonConverter(typeof(EnumStringJsonConverter<DrawingFilterSortBy>))]
 20033    public DrawingFilterSortBy Sortby { get; set; }
 34
 12835    public bool? Spotify { get; set; }
 36
 15837    public string TextQuery { get; set; }
 6438    public IEnumerable<string> Tags { get { return TextQuery.Split(" ").Select(x => x.ToLower()); } }
 39
 12540    public bool Favorites { get; set; }
 41
 6242    public int PageSize { get; set; }
 43
 3144    public int PageNumber { get; set; }
 45
 18946    public bool OnlyVisible { get; set; }
 47
 3148    public string CacheKey { get => $"filter_{Type}_{ProductType}_{ProductName}_{ModelName}_{CharacterName}_{Collection}
 49
 50
 51    public static DrawingFilter GetModelNoFilters() =>
 6252        new DrawingFilter()
 6253        {
 6254            Sortby = EnumExtensions.GetDefaultValue<DrawingFilterSortBy>(),
 6255            TextQuery = "",
 6256            Type = EnumExtensions.GetDefaultValue<DrawingTypes>(),
 6257            ProductType = EnumExtensions.GetDefaultValue<DrawingProductTypes>(),
 6258            ProductName = "",
 6259            Collection = "",
 6260            CharacterName = "",
 6261            ModelName = "",
 6262            Software = EnumExtensions.GetDefaultValue<DrawingSoftwares>(),
 6263            Paper = EnumExtensions.GetDefaultValue<DrawingPaperSizes>(),
 6264            Favorites = false,
 6265            Spotify = null,
 6266            OnlyVisible = false,
 6267        };
 68
 69    public bool OnlyFilterCollection()
 70    {
 3171        var noFilters = GetModelNoFilters();
 72
 3173        return
 3174            Sortby == noFilters.Sortby &&
 3175            TextQuery == noFilters.TextQuery &&
 3176            Type == noFilters.Type &&
 3177            ProductType == noFilters.ProductType &&
 3178            ProductName == noFilters.ProductName &&
 3179            Collection != noFilters.Collection &&
 3180            CharacterName == noFilters.CharacterName &&
 3181            ModelName == noFilters.ModelName &&
 3182            Software == noFilters.Software &&
 3183            Paper == noFilters.Paper;
 84    }
 85}