< Summary

Class:UserProfileModel
Assembly:UserProfile
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/UserProfile/UserProfileModel.cs
Covered lines:29
Uncovered lines:20
Coverable lines:49
Total lines:126
Line coverage:59.1% (29 of 49)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Equals(...)0%20400%
Equals(...)0%30500%
UserProfileModel()0%110100%
Clone()0%2100%
Equals(...)0%117.7532056.25%
ComposeCorrectUrl(...)0%4.134080%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/UserProfile/UserProfileModel.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3
 4[System.Serializable]
 5public class UserProfileModel
 6{
 7    [System.Serializable]
 8    public class Snapshots
 9    {
 10        public string face256;
 11        public string body;
 12
 13        public bool Equals(Snapshots snapshots)
 14        {
 015            if (snapshots == null) return false;
 016            if (snapshots.face256 != face256) return false;
 017            if (snapshots.body != body) return false;
 018            return true;
 19        }
 20    }
 21
 22    [System.Serializable]
 23    public class ParcelsWithAccess
 24    {
 25        public int x;
 26        public int y;
 27        public LandRole landRole;
 28
 29        [System.Serializable]
 30        public enum LandRole
 31        {
 32            OWNER = 0,
 33            OPERATOR = 1
 34        }
 35
 36        public bool Equals(ParcelsWithAccess parcelsWithAccess)
 37        {
 038            if (parcelsWithAccess == null) return false;
 039            if (parcelsWithAccess.x != x) return false;
 040            if (parcelsWithAccess.y != y) return false;
 041            if (parcelsWithAccess.landRole != landRole) return false;
 042            return true;
 43        }
 44    }
 45
 46    public string userId;
 47    public string ethAddress;
 48    public string name;
 49    public string email;
 50    public string description;
 51    public string baseUrl;
 52    public ParcelsWithAccess[] parcelsWithAccess;
 53    public ulong created_at;
 54    public ulong updated_at;
 55    public int version;
 56    public AvatarModel avatar;
 130957    public Snapshots snapshots = new Snapshots();
 058    public UserProfileModel Clone() => (UserProfileModel)MemberwiseClone();
 59
 130960    public bool hasConnectedWeb3 = true;
 61
 62    public int tutorialFlagsMask;
 63    public List<string> blocked;
 64    public List<string> muted;
 65    public int tutorialStep;
 66    public bool hasClaimedName = false;
 67
 68    public bool Equals(UserProfileModel model)
 69    {
 65370        if (model == null) return false;
 119571        if (model.userId != userId) return false;
 11172        if (model.ethAddress != ethAddress) return false;
 16073        if (model.name != name) return false;
 6374        if (model.email != email) return false;
 6175        if (model.description != description) return false;
 6176        if (model.baseUrl != baseUrl) return false;
 6177        if (model.created_at != created_at) return false;
 6178        if (model.updated_at != updated_at) return false;
 6179        if (model.version != version) return false;
 10180        if (!model.avatar.Equals(avatar)) return false;
 81
 2182        if (model.parcelsWithAccess != null)
 83        {
 084            if (!model.parcelsWithAccess.Equals(parcelsWithAccess))
 085                return false;
 86        }
 2187        else if (parcelsWithAccess != null)
 088            return false;
 89
 2190        if (model.hasConnectedWeb3 != hasConnectedWeb3) return false;
 2191        if (model.tutorialFlagsMask != tutorialFlagsMask) return false;
 2192        if (model.tutorialFlagsMask != tutorialFlagsMask) return false;
 93
 2194        if (model.blocked != null && blocked != null)
 95        {
 096            if (!model.blocked.All(blocked.Contains) || model.blocked.Count != blocked.Count)
 097                return false;
 98        }
 2199        else if (model.blocked != null || blocked != null)
 0100            return false;
 101
 21102        if (model.muted != null && muted != null)
 103        {
 0104            if (!model.muted.All(muted.Contains) || model.muted.Count != muted.Count)
 0105                return false;
 106        }
 21107        else if (model.muted != null || muted != null)
 0108            return false;
 109
 21110        if (model.tutorialStep != tutorialStep) return false;
 21111        if (model.hasClaimedName != hasClaimedName) return false;
 112
 21113        return true;
 114    }
 115
 116    public string ComposeCorrectUrl(string url)
 117    {
 150118        if (string.IsNullOrEmpty(url))
 95119            return url;
 120
 55121        if (!url.StartsWith("Qm") && !url.StartsWith("ba"))
 55122            return url;
 123
 0124        return baseUrl + url;
 125    }
 126}