< Summary

Information
Class: MRA.DTO.Models.DrawingModel
Assembly: MRA.DTO
File(s): D:\a\MiguelRomerART\MiguelRomerART\MRA.DTO\Models\DrawingModel.cs
Line coverage
97%
Covered lines: 71
Uncovered lines: 2
Coverable lines: 73
Total lines: 244
Line coverage: 97.2%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_Id()100%11100%
get_UrlBase()100%11100%
get_Path()100%11100%
get_Url()100%11100%
get_PathThumbnail()100%11100%
get_UrlThumbnail()100%11100%
get_Title()100%11100%
get_Favorite()100%11100%
get_Name()100%11100%
get_ModelName()100%11100%
get_ProductType()100%11100%
get_ProductTypeName()100%11100%
get_ProductName()100%11100%
get_Type()100%11100%
get_TypeName()100%11100%
get_Software()100%11100%
get_SoftwareName()100%11100%
get_Paper()100%11100%
get_PaperHuman()100%11100%
get_Filter()100%11100%
get_FilterName()100%11100%
get_Date()100%11100%
get_DateObject()100%11100%
get_DateHyphen()100%11100%
get_FormattedDate()100%11100%
get_Time()100%11100%
get_TimeHuman()100%11100%
get_Views()100%11100%
get_ViewsHuman()100%11100%
get_Likes()100%11100%
get_LikesHuman()100%11100%
get_ScoreCritic()100%11100%
get_ScorePopular()100%11100%
get_VotesPopular()100%11100%
get_ScorePopularHuman()100%210%
CalculateScorePopular(...)100%11100%
get_ListComments()100%11100%
get_ListCommentsStyle()100%11100%
get_ListCommentsPros()100%11100%
get_ListCommentsCons()100%11100%
get_ReferenceUrl()100%11100%
get_SpotifyUrl()100%11100%
get_SpotifyTrackId()100%11100%
get_Visible()100%11100%
get_TwitterUrl()100%11100%
get_InstagramUrl()100%11100%
get_TagsText()100%210%
get_Tags()100%11100%
get_Popularity()100%11100%
get_PopularityDate()100%11100%
get_PopularityCritic()100%11100%
get_PopularityPopular()100%11100%
get_PopularityFavorite()100%11100%
CalculatePopularity(...)100%22100%
ToString()100%44100%
GetId()100%11100%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\MRA.DTO\Models\DrawingModel.cs

#LineLine coverage
 1using MRA.DTO.Enums.Drawing;
 2using MRA.DTO.Models.Interfaces;
 3using MRA.Extensions;
 4using MRA.Infrastructure.Enums;
 5using MRA.Infrastructure.Excel.Attributes;
 6using System.Text;
 7
 8namespace MRA.DTO.Models;
 9
 10public class DrawingModel : IModel
 11{
 12    public const string SEPARATOR_COMMENTS = "#";
 13
 14214    public DrawingModel()
 15    {
 14216        Tags = new List<string>();
 14217        ListComments = new List<string>();
 14218        ListCommentsStyle = new List<string>();
 14219        ListCommentsPros = new List<string>();
 14220        ListCommentsCons = new List<string>();
 14221    }
 22
 23
 24    #region Document Data
 25    [ExcelColumn("ID", 1, width: 30)]
 28626    public string Id { get; set; }
 27    #endregion
 28
 29    #region Azure Image
 9830    public string UrlBase { get; set; }
 31
 32    [ExcelColumn("Path", 10)]
 3933    public string Path { get; set; }
 34
 35    [ExcelColumn("URL", 11, url: true, wrapText: true)]
 136    public string Url { get { return UrlBase + Path; } }
 37
 38    [ExcelColumn("Path Thumbnail", 15)]
 3939    public string PathThumbnail { get; set; }
 40
 41    [ExcelColumn("URL Thumbnail", 16, url: true, wrapText: true)]
 142    public string UrlThumbnail { get { return UrlBase + PathThumbnail; } }
 43    #endregion
 44
 45    #region Title
 46    [ExcelColumn("Title", 20)]
 3947    public string Title { get; set; }
 48
 49    [ExcelColumn("Favorite", 21, width: 10)]
 12350    public bool Favorite { get; set; }
 51    #endregion
 52
 53    #region Character
 54
 55    [ExcelColumn("Name", 30, width: 20)]
 14356    public string Name { get; set; }
 57
 58    [ExcelColumn("Model Name", 31, width: 20)]
 6159    public string ModelName { get; set; }
 60    #endregion
 61
 62    #region Product
 63    [ExcelColumn("#Product Type", 40, width: 5)]
 5764    public int ProductType { get; set; }
 65
 66    [ExcelColumn("Product Type", 41, width: 15)]
 167    public string ProductTypeName { get => ProductType.ToEnum<DrawingProductTypes>().GetDescription(); }
 68
 69
 70    [ExcelColumn("Product", 42, width: 30)]
 6971    public string ProductName { get; set; }
 72    #endregion
 73
 74    #region Style
 75    [ExcelColumn("#Type", 50, width: 5)]
 4576    public int Type { get; set; }
 77
 78    [ExcelColumn("Type", 51, width: 20)]
 179    public string TypeName { get => Type.ToEnum<DrawingTypes>().GetDescription(); }
 80
 81    [ExcelColumn("#Software", 52, width: 5)]
 4582    public int Software { get; set; }
 83
 84    [ExcelColumn("Software", 53, width: 20)]
 185    public string SoftwareName { get => Software.ToEnum<DrawingSoftwares>().GetDescription(); }
 86
 87    [ExcelColumn("#Paper", 54, width: 5)]
 4588    public int Paper { get; set; }
 89
 90    [ExcelColumn("Paper", 55, width: 10)]
 191    public string PaperHuman { get => Paper.ToEnum<DrawingPaperSizes>().GetDescription(); }
 92
 93    [ExcelColumn("#Filter", 56, width: 5)]
 3994    public int Filter { get; set; }
 95
 96    [ExcelColumn("Filter", 57, width: 20)]
 197    public string FilterName { get => Filter.ToEnum<DrawingFilterTypes>().GetDescription(); }
 98    #endregion
 99
 100    #region Details
 31101    public string Date { get; set; }
 102
 103    [ExcelColumn("Date", 60, width: 15)]
 141104    public DateTime DateObject { get; set; }
 105
 30106    public string DateHyphen { get; set; }
 107
 108    [ExcelColumn("Formatted Date", 63, width: 20)]
 1109    public string FormattedDate { get => DateObject.FormattedDate(); }
 110
 111    [ExcelColumn("Time (Minutes)", 65, width: 8)]
 112112    public int Time { get; set; }
 113
 114    [ExcelColumn("Time", 66, width: 12)]
 2115    public string TimeHuman { get => Time.GetHumanTime(); }
 116
 117    [ExcelColumn("Views", 67, width: 8)]
 118118    public long Views { get; set; }
 119
 1120    public string ViewsHuman => Views.HumanFormat();
 121
 122    [ExcelColumn("Likes", 69, width: 8)]
 116123    public long Likes { get; set; }
 124
 2125    public string LikesHuman => Likes.HumanFormat();
 126    #endregion
 127
 128    #region Scores
 129    [ExcelColumn("Score Critic", 70, width: 10)]
 274130    public int ScoreCritic { get; set; }
 131
 132    [ExcelColumn("Score Popular", 71, width: 10)]
 281133    public double ScorePopular { get; set; }
 134
 135    [ExcelColumn("Votes Popular", 72, width: 10)]
 371136    public int VotesPopular { get; set; }
 137
 0138    public int ScorePopularHuman { get => CalculateScorePopular(ScorePopular); }
 2139    public static int CalculateScorePopular(double score) => (int)Math.Round(score);
 140    #endregion
 141
 142    #region Comments
 143    [ExcelColumn("List Comments", 81)]
 179144    public IEnumerable<string> ListComments { get; set; }
 145    #endregion
 146
 147    #region Style Comments
 148    [ExcelColumn("Style Comment", 91)]
 179149    public IEnumerable<string> ListCommentsStyle { get; set; }
 150    #endregion
 151
 152    #region Positive Comments
 153
 154    [ExcelColumn("Positive Comments", 100)]
 179155    public IEnumerable<string> ListCommentsPros { get; set; }
 156    #endregion
 157
 158    #region Negative Comments
 159
 160    [ExcelColumn("Negative Comments", 100)]
 179161    public IEnumerable<string> ListCommentsCons { get; set; }
 162    #endregion
 163
 164    #region References
 165    [ExcelColumn("Reference URL", 120, url: true, wrapText: true)]
 37166    public string ReferenceUrl { get; set; }
 167
 168    [ExcelColumn("Spotify URL", 121, url: true, wrapText: true)]
 50169    public string SpotifyUrl { get; set; }
 170
 171    [ExcelColumn("Spotify Track ID", 122, width: 30)]
 2172    public string SpotifyTrackId { get => SpotifyUrl.GetSpotifyTrackId(); }
 173
 174    [ExcelColumn("Visible", 123, width: 10)]
 74175    public bool Visible { get; set; }
 176    #endregion
 177
 178    #region Social Networks
 179    [ExcelColumn("Twitter URL", 130, url: true, wrapText: true)]
 37180    public string TwitterUrl { get; set; }
 181
 182    [ExcelColumn("Instagram URL", 131, url: true, wrapText: true)]
 37183    public string InstagramUrl { get; set; }
 184    #endregion
 185
 186    #region Tags
 0187    public string TagsText { get; set; }
 188
 189    [ExcelColumn("Tags", 140)]
 191190    public IEnumerable<string> Tags { get; set; }
 191    #endregion
 192
 193    #region Popularity
 194    [ExcelColumn("Popularity", 150, ignoreOnImport: true, width: 10)]
 195    public double Popularity
 196    {
 197        get
 198        {
 102199            return PopularityDate + PopularityCritic + PopularityPopular + PopularityFavorite;
 200        }
 201    }
 202
 203    [ExcelColumn("Popularity Date", 151, ignoreOnImport: true, width: 20)]
 118204    public double PopularityDate { get; set; }
 205
 206    [ExcelColumn("Popularity Critic", 152, ignoreOnImport: true, width: 20)]
 121207    public double PopularityCritic { get; set; }
 208
 209    [ExcelColumn("Popularity Popular", 153, ignoreOnImport: true, width: 20)]
 118210    public double PopularityPopular { get; set; }
 211
 212    [ExcelColumn("Popularity Favorite", 154, ignoreOnImport: true, width: 20)]
 118213    public double PopularityFavorite { get; set; }
 214
 215    public double CalculatePopularity(double dateWeight, int months, double criticWeight, double popularWeight, double f
 216    {
 16217        PopularityCritic = Utilities.CalculatePopularity(DateObject, dateWeight, DateTime.Now.AddMonths(-months), DateTi
 16218        PopularityDate = Utilities.CalculatePopularity(ScoreCritic, criticWeight);
 16219        PopularityPopular = Utilities.CalculatePopularity(ScorePopular, popularWeight);
 16220        PopularityFavorite = (Favorite ? favoriteWeight : 0);
 16221        return Popularity;
 222    }
 223    #endregion
 224
 225    public override string ToString()
 226    {
 2227        StringBuilder sb = new StringBuilder();
 228
 2229        sb.Append(Id);
 230
 2231        if (!String.IsNullOrEmpty(Name))
 232        {
 2233            sb.Append($" ({Name})");
 234        }
 2235        if (!String.IsNullOrEmpty(ModelName))
 236        {
 2237            sb.Append($" [{ModelName}]");
 238        }
 239
 2240        return sb.ToString();
 241    }
 242
 2243    public string GetId() => Id;
 244}