< Summary

Class:CollapsableChatSearchListComponentView
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/CollapsableChatSearchListComponentView.cs
Covered lines:34
Uncovered lines:15
Coverable lines:49
Total lines:106
Line coverage:69.3% (34 of 49)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%110100%
Filter(...)0%2100%
Filter(...)0%110100%
Filter(...)0%2100%
Count()0%110100%
Clear(...)0%110100%
Clear()0%2100%
Get(...)0%220100%
Dispose()0%110100%
Remove(...)0%6200%
Set(...)0%110100%
Export(...)0%330100%
Import(...)0%330100%

File(s)

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

#LineLine coverage
 1using System;
 2using UIComponents.CollapsableSortedList;
 3using UnityEngine;
 4
 5public class CollapsableChatSearchListComponentView : CollapsableSortedListComponentView<string, BaseComponentView>
 6{
 7    [SerializeField] private CollapsableDirectChatListComponentView directChatList;
 8    [SerializeField] private CollapsablePublicChannelListComponentView publicChannelList;
 9
 10    public void Initialize(IChatController chatController, ILastReadMessagesService lastReadMessagesService)
 11    {
 2312        directChatList.Initialize(chatController, lastReadMessagesService);
 2313        publicChannelList.Initialize(chatController, lastReadMessagesService);
 2314    }
 15
 16    public void Filter(string search)
 17    {
 018        directChatList.Filter(search);
 019        publicChannelList.Filter(search);
 020        UpdateEmptyState();
 021    }
 22
 23    public void Filter(Func<PrivateChatEntry, bool> privateComparision,
 24        Func<PublicChannelEntry, bool> publicComparision)
 25    {
 626        directChatList.Filter(privateComparision);
 627        publicChannelList.Filter(publicComparision);
 628        UpdateEmptyState();
 629    }
 30
 31    public override void Filter(Func<BaseComponentView, bool> comparision)
 32    {
 033        directChatList.Filter(comparision);
 034        publicChannelList.Filter(comparision);
 035        UpdateEmptyState();
 036    }
 37
 38    public override int Count()
 39    {
 10340        return directChatList.Count() + publicChannelList.Count();
 41    }
 42
 43    public void Clear(bool releaseEntriesFromPool)
 44    {
 345        directChatList.Clear(releaseEntriesFromPool);
 346        publicChannelList.Clear(releaseEntriesFromPool);
 347        UpdateEmptyState();
 348    }
 49
 50    public override void Clear()
 51    {
 052        directChatList.Clear();
 053        publicChannelList.Clear();
 054        UpdateEmptyState();
 055    }
 56
 57    public override BaseComponentView Get(string key)
 58    {
 1859        return (BaseComponentView) directChatList.Get(key) ?? publicChannelList.Get(key);
 60    }
 61
 62    public override void Dispose()
 63    {
 364        base.Dispose();
 365        directChatList.Dispose();
 366        publicChannelList.Dispose();
 367    }
 68
 69    public override BaseComponentView Remove(string key)
 70    {
 071        var view = (BaseComponentView) directChatList.Remove(key) ?? publicChannelList.Remove(key);
 072        UpdateEmptyState();
 073        return view;
 74    }
 75
 76    public void Set(PrivateChatEntry.PrivateChatEntryModel model)
 77    {
 878        directChatList.Set(model.userId, model);
 879        UpdateEmptyState();
 880    }
 81
 82    public void Export(CollapsablePublicChannelListComponentView publicChannelList,
 83        CollapsableDirectChatListComponentView privateChatList)
 84    {
 1285        foreach (var pair in this.publicChannelList.Entries)
 386            publicChannelList.Add(pair.Key, pair.Value);
 2487        foreach (var pair in directChatList.Entries)
 988            privateChatList.Add(pair.Key, pair.Value);
 89
 390        Clear(false);
 391    }
 92
 93    public void Import(CollapsablePublicChannelListComponentView publicChannelList,
 94        CollapsableDirectChatListComponentView privateChatList)
 95    {
 4096        foreach (var pair in privateChatList.Entries)
 1497            directChatList.Add(pair.Key, pair.Value);
 2498        foreach (var pair in publicChannelList.Entries)
 699            this.publicChannelList.Add(pair.Key, pair.Value);
 100
 6101        privateChatList.Clear(false);
 6102        publicChannelList.Clear(false);
 103
 6104        UpdateEmptyState();
 6105    }
 106}