< Summary

Class:DCL.MyAccount.AdditionalInfoOptionsModel
Assembly:MyAccountHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/AdditionalInfoOptionsModel.cs
Covered lines:6
Uncovered lines:20
Coverable lines:26
Total lines:73
Line coverage:23% (6 of 26)
Covered branches:0
Total branches:0
Covered methods:12
Total methods:18
Method coverage:66.6% (12 of 18)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Equals(...)0%30500%
Equals(...)0%20400%
GetHashCode()0%2100%
Equals(...)0%30500%
Equals(...)0%20400%
GetHashCode()0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/AdditionalInfoOptionsModel.cs

#LineLine coverage
 1using JetBrains.Annotations;
 2using System;
 3using System.Collections.Generic;
 4
 5namespace DCL.MyAccount
 6{
 7    public class AdditionalInfoOptionsModel
 8    {
 9        public enum InputType
 10        {
 11            FreeFormText,
 12            StrictValueList,
 13            Date
 14        }
 15
 16
 17        public class Option
 18        {
 19            public Action<string> OnValueSubmitted;
 20            public Action OnRemoved;
 21
 36322            public bool IsAvailable { get; set; }
 35223            public string Name { get; set; }
 35224            public InputType InputType { get; set; }
 22425            [CanBeNull] public string[] Values { get; set; }
 3226            [CanBeNull] public string DateFormat { get; set; }
 27
 28            protected bool Equals(Option other) =>
 029                IsAvailable == other.IsAvailable && Name == other.Name && InputType == other.InputType && Equals(Values,
 30
 31            public override bool Equals(object obj)
 32            {
 033                if (ReferenceEquals(null, obj)) return false;
 034                if (ReferenceEquals(this, obj)) return true;
 035                if (obj.GetType() != this.GetType()) return false;
 036                return Equals((Option)obj);
 37            }
 38
 39            public override int GetHashCode() =>
 040                HashCode.Combine(IsAvailable, Name, (int)InputType, Values, DateFormat);
 41        }
 42
 8743        public Dictionary<string, Option> Options { get; set; }
 44
 45        protected bool Equals(AdditionalInfoOptionsModel other)
 46        {
 047            if (Options.Count != other.Options.Count)
 048                return false;
 49
 050            foreach (string key in Options.Keys)
 51            {
 052                if (!other.Options.ContainsKey(key))
 053                    return false;
 54
 055                if (!Options[key].Equals(other.Options[key]))
 056                    return false;
 57            }
 58
 059            return true;
 060        }
 61
 62        public override bool Equals(object obj)
 63        {
 064            if (ReferenceEquals(null, obj)) return false;
 065            if (ReferenceEquals(this, obj)) return true;
 066            if (obj.GetType() != this.GetType()) return false;
 067            return Equals((AdditionalInfoOptionsModel)obj);
 68        }
 69
 70        public override int GetHashCode() =>
 071            (Options != null ? Options.GetHashCode() : 0);
 72    }
 73}