Skip to content
Permalink
Browse files

Fixing unit test as always

  • Loading branch information...
Splamy committed Dec 1, 2019
1 parent f6875eb commit b6a68d48cce4fce3e087fe1cb430e525152212db
Showing with 11 additions and 6 deletions.
  1. +9 −4 TS3ABotUnitTests/BotCommandTests.cs
  2. +2 −2 TS3AudioBot/MainCommands.cs
@@ -145,7 +145,7 @@ public void XCommandSystemFilterTest()
[Test]
public void XCommandSystemTest()
{
var execInfo = Utils.GetExecInfo("ic3");
var execInfo = Utils.GetExecInfo("ic3", false);
var group = execInfo.GetModule<CommandManager>().RootGroup;
group.AddCommand("one", new FunctionCommand(() => "ONE"));
group.AddCommand("two", new FunctionCommand(() => "TWO"));
@@ -230,10 +230,14 @@ public void EnsureAllCommandsHaveEnglishDocumentationEntry()

var execInfo = Utils.GetExecInfo("exact");
var cmdMgr = execInfo.GetModule<CommandManager>();
var errors = new List<string>();
foreach (var cmd in cmdMgr.AllCommands)
{
Assert.IsFalse(string.IsNullOrEmpty(cmd.Description), $"Command {cmd.FullQualifiedName} has no documentation");
if (string.IsNullOrEmpty(cmd.Description))
errors.Add($"Command {cmd.FullQualifiedName} has no documentation");
}
if (errors.Count > 0)
Assert.Fail(string.Join("\n", errors));
}

[Test]
@@ -268,10 +272,11 @@ public static void TestStringParsing(string inp, string outp)

internal static class Utils
{
public static ExecutionInformation GetExecInfo(string matcher)
public static ExecutionInformation GetExecInfo(string matcher, bool addMainCommands = true)
{
var cmdMgr = new CommandManager(null);
cmdMgr.RegisterCollection(MainCommands.Bag);
if (addMainCommands)
cmdMgr.RegisterCollection(MainCommands.Bag);

var execInfo = new ExecutionInformation();
execInfo.AddModule(new CallerInfo(false) { SkipRightsChecks = true, CommandComplexityMax = int.MaxValue });
@@ -370,7 +370,7 @@ public static object CommandEval(ExecutionInformation info, IReadOnlyList<IComma
return cmd.Execute(info, leftArguments, returnTypes);
}

[Command("from")]
[Command("from", "_undocumented")]
public static void CommandFrom(PlayManager playManager, InvokerData invoker, string factoryName, string url)
{
playManager.Play(invoker, url, factoryName).UnwrapThrow();
@@ -916,7 +916,7 @@ string ResponseListDelete(string message)
public static void CommandListDelete(PlaylistManager playlistManager, ApiCall _, string listId)
=> playlistManager.DeletePlaylist(listId).UnwrapThrow();

[Command("list from")]
[Command("list from", "_undocumented")]
public static JsonValue<PlaylistInfo> PropagiateLoad(PlaylistManager playlistManager, ResolveContext resolver, string resolverName, string listId, string url)
{
var getList = resolver.LoadPlaylistFrom(url, resolverName).UnwrapThrow();

0 comments on commit b6a68d4

Please sign in to comment.
You can’t perform that action at this time.