< Summary

Class:DCL.Social.Chat.ChannelLimitReachedWindowController
Assembly:WorldChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/WorldChatWindowHUD/ChannelLimitReachedWindowController.cs
Covered lines:11
Uncovered lines:5
Coverable lines:16
Total lines:40
Line coverage:68.7% (11 of 16)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:4
Method coverage:75% (3 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ChannelLimitReachedWindowController(...)0%110100%
Dispose()0%6200%
Show(...)0%2.062075%
Close()0%110100%

File(s)

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

#LineLine coverage
 1using DCL.Social.Chat;
 2using System;
 3
 4namespace DCL.Social.Chat
 5{
 6    public class ChannelLimitReachedWindowController : IDisposable
 7    {
 8        private readonly IChannelLimitReachedWindowView view;
 9        private readonly DataStore dataStore;
 10
 211        public ChannelLimitReachedWindowController(IChannelLimitReachedWindowView view,
 12            DataStore dataStore)
 13        {
 214            this.view = view;
 215            view.Hide();
 216            view.OnClose += Close;
 217            this.dataStore = dataStore;
 218            dataStore.channels.currentChannelLimitReached.OnChange += Show;
 219        }
 20
 21        public void Dispose()
 22        {
 023            dataStore.channels.currentChannelLimitReached.OnChange -= Show;
 24
 025            if (view != null)
 26            {
 027                view.OnClose -= Close;
 028                view.Dispose();
 29            }
 030        }
 31
 32        private void Show(string currentChannelId, string previousChannelId)
 33        {
 234            if (string.IsNullOrEmpty(currentChannelId)) return;
 235            view.Show();
 236        }
 37
 138        private void Close() => view.Hide();
 39    }
 40}