< Summary

Class:GDX.Developer.ConsoleCommandBase
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommandBase.cs
Covered lines:1
Uncovered lines:15
Coverable lines:16
Total lines:69
Line coverage:6.2% (1 of 16)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:6
Method coverage:16.6% (1 of 6)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ConsoleCommandBase()0%110100%
GetAccessLevel()0%2100%
GetHelpUsage()0%2100%
GetArgumentAutoCompleteSuggestions(...)0%2100%
IsEditorOnly()0%2100%
GetInstance(...)0%2100%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommandBase.cs

#LineLine coverage
 1// Copyright (c) 2020-2022 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using System;
 6
 7namespace GDX.Developer
 8{
 9#if UNITY_2022_2_OR_NEWER
 10    public abstract class ConsoleCommandBase
 11    {
 212        public static Guid PlayerConnectionGuid = new Guid("5bccf3e4-1f16-4500-95c9-060e9c3d61c0");
 13
 14
 15        /// <summary>
 16        ///     Executes the logic for the command.
 17        /// </summary>
 18        /// <returns>
 19        ///     Returns false it means this is blocking further progression through
 20        ///     the queue of outstanding commands.
 21        /// </returns>
 22        public abstract bool Evaluate(float deltaTime);
 23
 24        /// <summary>
 25        ///     Returns the minimum access level required to execute a command.
 26        /// </summary>
 27        /// <remarks>Overrideable, but defaults to having user level access.</remarks>
 28        /// <returns>The required user access level to utilize a given command.</returns>
 29        public virtual Console.ConsoleAccessLevel GetAccessLevel()
 030        {
 031            return Console.ConsoleAccessLevel.User;
 032        }
 33
 34        public abstract string GetKeyword();
 35
 36        public virtual string GetHelpUsage()
 037        {
 038            return GetKeyword();
 039        }
 40
 41        public abstract string GetHelpMessage();
 42
 43        public virtual string[] GetArgumentAutoCompleteSuggestions(string hint, string[] existingSet = null)
 044        {
 045            return null;
 046        }
 47
 48        public virtual bool IsEditorOnly()
 049        {
 050            return false;
 051        }
 52
 53        /// <summary>
 54        ///     Gets the instance of the work to be added to the <see cref="Console" />'s command buffer.
 55        /// </summary>
 56        /// <remarks>
 57        ///     This work is processed later so in the case where context is needed, a new instance should be returned,
 58        ///     however if it is a pure functionality you can just return the existing instance, which is the default
 59        ///     non-overridden behaviour.
 60        /// </remarks>
 61        /// <param name="context">Unique information needed to configure a newly created instance.</param>
 62        /// <returns>A qualified instance of the class ready to be executed, null if something went wrong.</returns>
 63        public virtual ConsoleCommandBase GetInstance(string context)
 064        {
 065            return this;
 066        }
 67    }
 68#endif // UNITY_2022_2_OR_NEWER
 69}

Coverage by test methods


Methods/Properties

ConsoleCommandBase()
GetAccessLevel()
GetHelpUsage()
GetArgumentAutoCompleteSuggestions(System.String, System.String[])
IsEditorOnly()
GetInstance(System.String)