< Summary

Class:SearchInfo
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/SectionController/SearchInfo/SearchInfo.cs
Covered lines:15
Uncovered lines:8
Coverable lines:23
Total lines:74
Line coverage:65.2% (15 of 23)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
get_id()0%110100%
get_name()0%110100%
get_size()0%110100%
get_isOwner()0%2100%
get_isOperator()0%2100%
get_isContributor()0%2100%
get_keywords()0%2100%
SearchInfo()0%2100%
SetId(...)0%110100%
SetName(...)0%110100%
SetSize(...)0%110100%
SetCoords(...)0%110100%
SetRole(...)0%110100%
ISortable<ISearchInfo>.Compare(...)0%13.786040%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/SectionController/SearchInfo/SearchInfo.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4internal interface ISearchInfo : ISearchable, ISortable<ISearchInfo>
 5{
 6    string id { get; }
 7    string name { get; }
 8    int size { get; }
 9    bool isOwner { get; }
 10    bool isOperator { get; }
 11    bool isContributor { get; }
 12    void SetId(string id);
 13    void SetName(string name);
 14    void SetSize(int size);
 15    void SetCoords(string coords);
 16    void SetRole(bool isOwner);
 17}
 18
 19internal class SearchInfo : ISearchInfo
 20{
 1621    string ISearchInfo.id => id;
 122    string ISearchInfo.name => name;
 923    int ISearchInfo.size => size;
 024    bool ISearchInfo.isOwner => isOwner;
 025    bool ISearchInfo.isOperator => isOperator;
 026    bool ISearchInfo.isContributor => isContributor;
 027    string[] ISearchable.keywords => keywords;
 28
 29    private bool isOwner;
 30    private bool isOperator;
 31    private bool isContributor;
 32    internal string id;
 33    private string name;
 34    private int size;
 35    private string[] keywords;
 36
 037    public SearchInfo() { keywords = new string[2]; }
 38
 7439    void ISearchInfo.SetId(string id) { this.id = id; }
 40
 41    void ISearchInfo.SetName(string name)
 42    {
 3843        this.name = name;
 3844        keywords[0] = name;
 3845    }
 46
 7847    void ISearchInfo.SetSize(int size) { this.size = size; }
 48
 6049    void ISearchInfo.SetCoords(string coords) { keywords[1] = coords; }
 50
 51    void ISearchInfo.SetRole(bool isOwner)
 52    {
 3253        this.isOwner = isOwner;
 3254        this.isOperator = !isOwner;
 3255        this.isContributor = false;
 3256    }
 57
 58    int ISortable<ISearchInfo>.Compare(string sortType, bool isDescendingOrder, ISearchInfo other)
 59    {
 60        switch (sortType)
 61        {
 62            case SectionSearchHandler.NAME_SORT_TYPE_ASC:
 163                return String.CompareOrdinal(name, other.name);
 64            case SectionSearchHandler.NAME_SORT_TYPE_DESC:
 065                return String.CompareOrdinal(other.name, name);
 66            case SectionSearchHandler.SIZE_SORT_TYPE_DESC:
 067                return other.size - size;
 68            case SectionSearchHandler.SIZE_SORT_TYPE_ASC:
 969                return size - other.size;
 70            default:
 071                return 0;
 72        }
 73    }
 74}