Skip to content

Commit

Permalink
fix(actions): generic action had exit and init reversed
Browse files Browse the repository at this point in the history
Didn't seem to cause any problems. But would have definitely caused issues with extending the
ActionGeneric class.

#35
  • Loading branch information
ashblue committed Mar 24, 2021
1 parent 0e330d7 commit ff7dbc2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ protected override void OnStart () {
}

protected override void OnExit () {
initLogic?.Invoke();
exitLogic?.Invoke();
}

protected override void OnInit () {
exitLogic?.Invoke();
initLogic?.Invoke();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ public void It_should_execute_a_init_hook () {
Assert.AreEqual(1, test);
}

[Test]
public void It_should_execute_init_hook_on_continue () {
var test = 0;
var task = new ActionGeneric {
initLogic = () => { test++; },
updateLogic = () => TaskStatus.Continue,
};

task.Update();

Assert.AreEqual(1, test);
}

[Test]
public void It_should_execute_a_exit_hook () {
var test = 0;
Expand All @@ -57,4 +70,4 @@ public void It_should_execute_a_exit_hook () {
}
}
}
}
}

0 comments on commit ff7dbc2

Please sign in to comment.