< Summary

Information
Class: MRA.DTO.ViewModels.Art.Select.CharacterListItem
Assembly: MRA.DTO
File(s): D:\a\MiguelRomerART\MiguelRomerART\MRA.DTO\ViewModels\Art\Select\CharacterListItem.cs
Line coverage
92%
Covered lines: 12
Uncovered lines: 1
Coverable lines: 13
Total lines: 38
Line coverage: 92.3%
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
get_CharacterName()100%11100%
get_ProductTypeId()100%210%
get_ProductType()100%11100%
.ctor(...)100%11100%
GetCharactersFromDrawings(...)100%11100%
Equals(...)100%11100%
GetHashCode()100%11100%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\MRA.DTO\ViewModels\Art\Select\CharacterListItem.cs

#LineLine coverage
 1using Google.Api.Gax.ResourceNames;
 2using MRA.DTO.Enums.Drawing;
 3using MRA.DTO.Models;
 4using MRA.Infrastructure.Enums;
 5
 6namespace MRA.DTO.ViewModels.Art.Select
 7{
 8    public class CharacterListItem
 9    {
 2110        public string CharacterName { get; set; }
 011        public int ProductTypeId { get => (int)ProductType; }
 912        public DrawingProductTypes ProductType { get; set; }
 13
 914        public CharacterListItem(string characterName, DrawingProductTypes productType)
 15        {
 916            CharacterName = characterName;
 917            ProductType = productType;
 918        }
 19
 20        public static IEnumerable<CharacterListItem> GetCharactersFromDrawings(IEnumerable<DrawingModel> drawings)
 21        {
 122            return drawings
 423                .Where(x => !string.IsNullOrEmpty(x.Name))
 424                .Select(x => new CharacterListItem(x.Name, x.ProductType.ToEnum<DrawingProductTypes>()))
 125                .Distinct();
 26        }
 27
 28        public override bool Equals(object obj)
 29        {
 430            return GetHashCode() == obj.GetHashCode();
 31        }
 32
 33        public override int GetHashCode()
 34        {
 1235            return HashCode.Combine(CharacterName);
 36        }
 37    }
 38}