Skip to content

Commit

Permalink
Update command dispatch API usage in DialogueRunnerTests
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Dec 5, 2023
1 parent c3f5581 commit 8390f8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Tests/Runtime/DialogueRunnerTests/DialogueRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void HandleCommand_DispatchesCommands(string test, string expectedLogResu
var dispatcher = runner.CommandDispatcher;

LogAssert.Expect(LogType.Log, expectedLogResult);
var result = dispatcher.DispatchCommand(test, out var commandCoroutine);
var result = dispatcher.DispatchCommand(test, runner, out var commandCoroutine);

Assert.AreEqual(CommandDispatchResult.StatusType.SucceededSync, result.Status);
Assert.IsNull(commandCoroutine);
Expand All @@ -354,7 +354,7 @@ public IEnumerator HandleCommand_DispatchedCommands_StartCoroutines() {

var framesToWait = 5;

var result = dispatcher.DispatchCommand($"testCommandCoroutine DialogueRunner {framesToWait}", out var commandCoroutine);
var result = dispatcher.DispatchCommand($"testCommandCoroutine DialogueRunner {framesToWait}", runner, out var commandCoroutine);

Assert.AreEqual(CommandDispatchResult.StatusType.SucceededAsync, result.Status);
Assert.IsNotNull(commandCoroutine);
Expand All @@ -377,7 +377,7 @@ public void HandleCommand_FailsWhenParameterCountNotCorrect(string command, stri
var dispatcher = runner.CommandDispatcher;
var regex = new Regex(error);

var result = dispatcher.DispatchCommand(command, out _);
var result = dispatcher.DispatchCommand(command, runner, out _);

Assert.AreEqual(CommandDispatchResult.StatusType.InvalidParameterCount, result.Status);
Assert.That(regex.IsMatch(result.Message));
Expand All @@ -389,7 +389,7 @@ public void HandleCommand_FailsWhenParameterTypesNotValid(string command, string
var dispatcher = runner.CommandDispatcher;
var regex = new Regex(error);

var result = dispatcher.DispatchCommand(command, out _);
var result = dispatcher.DispatchCommand(command, runner, out _);
Assert.AreEqual(CommandDispatchResult.StatusType.InvalidParameterCount, result.Status);
Assert.That(regex.IsMatch(result.Message));
}
Expand All @@ -405,8 +405,8 @@ public void AddCommandHandler_RegistersCommands() {
LogAssert.Expect(LogType.Log, "success 1");
LogAssert.Expect(LogType.Log, "success 2");

var result1 = dispatcher.DispatchCommand("test1", out _);
var result2 = dispatcher.DispatchCommand("test2 2", out _);
var result1 = dispatcher.DispatchCommand("test1", runner, out _);
var result2 = dispatcher.DispatchCommand("test2 2", runner, out _);

Assert.IsNull(result1.Message);
Assert.IsNull(result2.Message);
Expand Down Expand Up @@ -434,7 +434,7 @@ IEnumerator TestCommandCoroutine(int frameDelay) {

LogAssert.Expect(LogType.Log, $"success {Time.frameCount + framesToWait}");

dispatcher.DispatchCommand("test", out var coroutine);
dispatcher.DispatchCommand("test", runner, out var coroutine);

Assert.IsNotNull(coroutine);

Expand Down

0 comments on commit 8390f8f

Please sign in to comment.