< Summary

Class:AvatarModel
Assembly:AvatarModel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarModel/AvatarModel.cs
Covered lines:21
Uncovered lines:4
Coverable lines:25
Total lines:78
Line coverage:84% (21 of 25)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AvatarModel()0%110100%
HaveSameWearablesAndColors(...)0%6.566075%
HaveSameExpressions(...)0%12300%
Equals(...)0%1101000%
CopyFrom(...)0%220100%
GetDataFromJSON(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarModel/AvatarModel.cs

#LineLine coverage
 1using DCL.Helpers;
 2using System.Collections.Generic;
 3using System.Linq;
 4using UnityEngine;
 5
 6[System.Serializable]
 7public class AvatarModel : BaseModel
 8{
 9    public string id;
 10    public string name;
 11    public string bodyShape;
 12    public Color skinColor;
 13    public Color hairColor;
 14    public Color eyeColor;
 238015    public List<string> wearables = new List<string>();
 16    public string expressionTriggerId = null;
 238017    public long expressionTriggerTimestamp = -1;
 18    public string stickerTriggerId = null;
 238019    public long stickerTriggerTimestamp = -1;
 20    public bool talking = false;
 21
 22    public bool HaveSameWearablesAndColors(AvatarModel other)
 23    {
 12324        if (other == null)
 025            return false;
 26
 12327        bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count;
 28
 12329        return bodyShape == other.bodyShape &&
 30               skinColor == other.skinColor &&
 31               hairColor == other.hairColor &&
 32               eyeColor == other.eyeColor &&
 33               wearablesAreEqual;
 34    }
 35
 36    public bool HaveSameExpressions(AvatarModel other)
 37    {
 038        return expressionTriggerId == other.expressionTriggerId &&
 39               expressionTriggerTimestamp == other.expressionTriggerTimestamp &&
 40               stickerTriggerTimestamp == other.stickerTriggerTimestamp;
 41    }
 42
 43    public bool Equals(AvatarModel other)
 44    {
 045        bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count;
 46
 047        return id == other.id &&
 48               name == other.name &&
 49               bodyShape == other.bodyShape &&
 50               skinColor == other.skinColor &&
 51               hairColor == other.hairColor &&
 52               eyeColor == other.eyeColor &&
 53               expressionTriggerId == other.expressionTriggerId &&
 54               expressionTriggerTimestamp == other.expressionTriggerTimestamp &&
 55               stickerTriggerTimestamp == other.stickerTriggerTimestamp &&
 56               wearablesAreEqual;
 57    }
 58
 59    public void CopyFrom(AvatarModel other)
 60    {
 31161        if (other == null)
 15662            return;
 63
 15564        id = other.id;
 15565        name = other.name;
 15566        bodyShape = other.bodyShape;
 15567        skinColor = other.skinColor;
 15568        hairColor = other.hairColor;
 15569        eyeColor = other.eyeColor;
 15570        expressionTriggerId = other.expressionTriggerId;
 15571        expressionTriggerTimestamp = other.expressionTriggerTimestamp;
 15572        stickerTriggerId = other.stickerTriggerId;
 15573        stickerTriggerTimestamp = other.stickerTriggerTimestamp;
 15574        wearables = new List<string>(other.wearables);
 15575    }
 76
 277    public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<AvatarModel>(json); }
 78}