< Summary

Class:KernelConfigModel
Assembly:KernelConfiguration
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/KernelConfiguration/KernelConfigModel.cs
Covered lines:32
Uncovered lines:4
Coverable lines:36
Total lines:78
Line coverage:88.8% (32 of 36)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:5
Method coverage:60% (3 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
KernelConfigModel()0%110100%
Equals(...)0%6200%
Equals(...)0%18.0516080%
GetTld()0%6200%
Clone()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/KernelConfiguration/KernelConfigModel.cs

#LineLine coverage
 1using KernelConfigurationTypes;
 2using System;
 3using System.Collections.Generic;
 4
 5[Serializable]
 6public class KernelConfigModel
 7{
 8    private const string MAIN_NET = "mainnet";
 9    private const string ORG = ".org";
 10    private const string ZONE = ".zone";
 11
 5012    public Features features = new Features();
 5013    public Comms comms = new Comms();
 5014    public Profiles profiles = new Profiles();
 15    public bool gifSupported = false;
 5016    public string network = MAIN_NET;
 5017    public List<WorldRange> validWorldRanges = new List<WorldRange>();
 5018    public string kernelVersion = string.Empty;
 5019    public string rendererVersion = string.Empty;
 5020    public Debugging debugConfig = new Debugging();
 5021    public ProceduralSkybox proceduralSkyboxConfig = new ProceduralSkybox();
 5022    public string avatarTextureAPIBaseUrl = string.Empty;
 23    public bool urlParamsForWearablesDebug = false;
 5024    public string builderUrl = string.Empty;
 25
 026    public override bool Equals(object obj) { return obj is KernelConfigModel other && Equals(other); }
 27
 28    public bool Equals(KernelConfigModel other)
 29    {
 4930        if (other == null)
 031            return false;
 32
 4933        if (validWorldRanges.Count != other.validWorldRanges.Count)
 234            return false;
 35
 9636        for (var i = 0; i < validWorldRanges.Count; i++)
 37        {
 138            if (!validWorldRanges[i].Equals(other.validWorldRanges[i]))
 039                return false;
 40        }
 41
 4742        return comms.Equals(other.comms)
 43               && profiles.Equals(other.profiles)
 44               && features.Equals(other.features)
 45               && gifSupported == other.gifSupported
 46               && network == other.network
 47               && kernelVersion == other.kernelVersion
 48               && rendererVersion == other.rendererVersion
 49               && debugConfig.Equals(other.debugConfig)
 50               && proceduralSkyboxConfig.Equals(other.proceduralSkyboxConfig)
 51               && avatarTextureAPIBaseUrl == other.avatarTextureAPIBaseUrl
 52               && urlParamsForWearablesDebug == other.urlParamsForWearablesDebug
 53               && builderUrl == other.builderUrl;
 54    }
 55
 56    public string GetTld() =>
 057        network.Equals(MAIN_NET, StringComparison.OrdinalIgnoreCase) ? ORG : ZONE;
 58
 59    public KernelConfigModel Clone()
 60    {
 61        // NOTE: We need to use deep clone
 262        KernelConfigModel clone = new KernelConfigModel();
 263        clone.comms = comms.Clone();
 264        clone.profiles = profiles.Clone();
 265        clone.features = features.Clone();
 266        clone.gifSupported = gifSupported;
 267        clone.network = network;
 268        clone.validWorldRanges = new List<WorldRange>(validWorldRanges);
 269        clone.kernelVersion = kernelVersion;
 270        clone.rendererVersion = rendererVersion;
 271        clone.debugConfig = debugConfig.Clone();
 272        clone.proceduralSkyboxConfig = proceduralSkyboxConfig.Clone();
 273        clone.avatarTextureAPIBaseUrl = avatarTextureAPIBaseUrl;
 274        clone.urlParamsForWearablesDebug = urlParamsForWearablesDebug;
 275        clone.builderUrl = builderUrl;
 276        return clone;
 77    }
 78}