< Summary

Class:DCL.Social.Chat.ChannelEntryFactory
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelEntryFactory.cs
Covered lines:2
Uncovered lines:0
Coverable lines:2
Total lines:30
Line coverage:100% (2 of 2)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:1
Method coverage:100% (1 of 1)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Create(...)0%660100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelEntryFactory.cs

#LineLine coverage
 1using DCL.Social.Chat;
 2using System;
 3using System.Collections.Generic;
 4using System.Linq;
 5using UnityEngine;
 6
 7namespace DCL.Social.Chat
 8{
 9    [CreateAssetMenu(fileName = "ChannelEntryFactory", menuName = "DCL/Social/ChannelEntryFactory")]
 10    public class ChannelEntryFactory : ScriptableObject
 11    {
 12        [Serializable]
 13        private struct SpecialEntry
 14        {
 15            public string channelId;
 16            public PublicChatEntry prefab;
 17        }
 18
 19        [SerializeField] private PublicChatEntry defaultEntryPrefab;
 20        [SerializeField] private SpecialEntry[] specialEntryPrefabs;
 21
 22        private Dictionary<string, PublicChatEntry> specialEntries;
 23
 24        public PublicChatEntry Create(string channelId)
 25        {
 3626            specialEntries ??= specialEntryPrefabs.ToDictionary(entry => entry.channelId, entry => entry.prefab);
 3227            return Instantiate(specialEntries.ContainsKey(channelId) ? specialEntries[channelId] : defaultEntryPrefab);
 28        }
 29    }
 30}

Methods/Properties

Create(System.String)