< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AvatarModel()0%110100%
HaveSameWearablesAndColors(...)0%550100%
HaveSameExpressions(...)0%330100%
Equals(...)0%10100100%
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;
 172015    public List<string> wearables = new List<string>();
 16    public string expressionTriggerId = null;
 172017    public long expressionTriggerTimestamp = -1;
 18    public string stickerTriggerId = null;
 172019    public long stickerTriggerTimestamp = -1;
 20    public bool talking = false;
 21
 22    public bool HaveSameWearablesAndColors(AvatarModel other)
 23    {
 3124        bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count;
 25
 3126        return bodyShape == other.bodyShape &&
 27               skinColor == other.skinColor &&
 28               hairColor == other.hairColor &&
 29               eyeColor == other.eyeColor &&
 30               wearablesAreEqual;
 31    }
 32
 33    public bool HaveSameExpressions(AvatarModel other)
 34    {
 3135        return expressionTriggerId == other.expressionTriggerId &&
 36               expressionTriggerTimestamp == other.expressionTriggerTimestamp &&
 37               stickerTriggerTimestamp == other.stickerTriggerTimestamp;
 38    }
 39
 40
 41    public bool Equals(AvatarModel other)
 42    {
 9043        bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count;
 44
 9045        return id == other.id &&
 46               name == other.name &&
 47               bodyShape == other.bodyShape &&
 48               skinColor == other.skinColor &&
 49               hairColor == other.hairColor &&
 50               eyeColor == other.eyeColor &&
 51               expressionTriggerId == other.expressionTriggerId &&
 52               expressionTriggerTimestamp == other.expressionTriggerTimestamp &&
 53               stickerTriggerTimestamp == other.stickerTriggerTimestamp &&
 54               wearablesAreEqual;
 55    }
 56
 57    public void CopyFrom(AvatarModel other)
 58    {
 25759        if (other == null)
 10360            return;
 61
 15462        id = other.id;
 15463        name = other.name;
 15464        bodyShape = other.bodyShape;
 15465        skinColor = other.skinColor;
 15466        hairColor = other.hairColor;
 15467        eyeColor = other.eyeColor;
 15468        expressionTriggerId = other.expressionTriggerId;
 15469        expressionTriggerTimestamp = other.expressionTriggerTimestamp;
 15470        stickerTriggerId = other.stickerTriggerId;
 15471        stickerTriggerTimestamp = other.stickerTriggerTimestamp;
 15472        wearables = new List<string>(other.wearables);
 15473    }
 74
 275    public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<AvatarModel>(json); }
 76}