private static TestPlugin GetTestPlugin() { var manager = new PluginManager(); var plugin = new TestPlugin(); plugin.Manager = manager; manager.Plugins.Add(plugin); return(plugin); }
public void StringCommandTest() { // arrange TestPlugin plugin = GetTestPlugin(); MethodInfo method = plugin.GetMethodInfo(nameof(TestPlugin.CmdString)); // act bool successful = plugin.Manager.ExecuteCommand(method, new Player(null, null), new[] { "text" }, out object result); // assert Assert.IsTrue(successful); Assert.AreEqual("text", result); }
public void RelValueCommandTest() { // arrange TestPlugin plugin = GetTestPlugin(); MethodInfo method = plugin.GetMethodInfo(nameof(TestPlugin.CmdRelValue)); // act bool successful = plugin.Manager.ExecuteCommand(method, new Player(null, null), new[] { "1.2", "~3.4" }, out object result); // assert Assert.IsTrue(successful); Assert.AreEqual("Value: 1.2, Relative: False, Value: 3.4, Relative: True", result); }
public void EntityPosCommandTest() { // arrange TestPlugin plugin = GetTestPlugin(); MethodInfo method = plugin.GetMethodInfo(nameof(TestPlugin.CmdEntityPos)); // act bool successful = plugin.Manager.ExecuteCommand(method, new Player(null, null), new[] { "1.2", "3.4", "~5.6" }, out object result); // assert Assert.IsTrue(successful); Assert.AreEqual("X: 1.2, XRelative: False, Y: 3.4, YRelative: False, Z: 5.6, ZRelative: True", result); }