< Summary

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

File(s)

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

#LineLine coverage
 1using MRA.DTO.Enums.Drawing;
 2using MRA.DTO.Models;
 3using MRA.Infrastructure.Enums;
 4
 5namespace MRA.DTO.ViewModels.Art.Select;
 6
 7public class ProductListItem
 8{
 339    public string ProductName { get; set; }
 010    public int ProductTypeId { get => (int)ProductType; }
 1111    public DrawingProductTypes ProductType { get; set; }
 12
 1113    public ProductListItem(string productName, DrawingProductTypes productType)
 14    {
 1115        ProductName = productName;
 1116        ProductType = productType;
 1117    }
 18
 19    public static IEnumerable<ProductListItem> GetProductsFromDrawings(IEnumerable<DrawingModel> drawings)
 20    {
 121        return drawings
 822            .Where(x => !string.IsNullOrEmpty(x.ProductName))
 823            .Select(x => new ProductListItem(x.ProductName, x.ProductType.ToEnum<DrawingProductTypes>()))
 124            .Distinct();
 25    }
 26
 27    public override bool Equals(object obj)
 28    {
 729        return GetHashCode() == obj.GetHashCode();
 30    }
 31
 32    public override int GetHashCode()
 33    {
 2234        return HashCode.Combine(ProductName);
 35    }
 36}