< Summary

Class:DCL.SettingsPanelHUD.Sections.SettingsSectionController
Assembly:SettingsPanelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/SectionsModule/SettingsSectionController.cs
Covered lines:4
Uncovered lines:0
Coverable lines:4
Total lines:44
Line coverage:100% (4 of 4)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SettingsSectionController()0%110100%
AddWidget(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/SectionsModule/SettingsSectionController.cs

#LineLine coverage
 1using DCL.SettingsPanelHUD.Widgets;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using System.Linq;
 5
 6namespace DCL.SettingsPanelHUD.Sections
 7{
 8    /// <summary>
 9    /// Interface to implement a controller for a SECTION.
 10    /// </summary>
 11    public interface ISettingsSectionController
 12    {
 13        /// <summary>
 14        /// List of all WIDGETS added to the SECTION.
 15        /// </summary>
 16        List<ISettingsWidgetView> widgets { get; }
 17
 18        /// <summary>
 19        /// Adds a WIDGET into the SECTION.
 20        /// </summary>
 21        /// <param name="newWidget">New WIDGET that will be added.</param>
 22        /// <param name="newWidgetController">Controller belonging to the new WIDGET.</param>
 23        /// <param name="widgetConfig">Model that will contain the configuration of the new WIDGET.</param>
 24        void AddWidget(ISettingsWidgetView newWidget, ISettingsWidgetController newWidgetController, SettingsWidgetModel
 25    }
 26
 27    /// <summary>
 28    /// This controller is in charge of manage all the logic related to a SECTION.
 29    /// </summary>
 30    [CreateAssetMenu(menuName = "Settings/Controllers/Section", fileName = "SettingsSectionController")]
 31    public class SettingsSectionController : ScriptableObject, ISettingsSectionController
 32    {
 633        public List<ISettingsWidgetView> widgets { get; } = new List<ISettingsWidgetView>();
 34
 35        public void AddWidget(
 36            ISettingsWidgetView newWidget,
 37            ISettingsWidgetController newWidgetController,
 38            SettingsWidgetModel widgetConfig)
 39        {
 440            newWidget.Initialize(widgetConfig.title, newWidgetController, widgetConfig.controlColumns.ToList());
 441            widgets.Add(newWidget);
 442        }
 43    }
 44}