public void MyTestInitialize() { underTest = new GlobalCommand("app", "app", Access.Administrator); underTest.AddToConsole(); testWriter = new TestConsoleWriter(); ConsoleBase.RegisterConsoleWriter(testWriter); }
public void MyTestInitialize() { global = new GlobalCommand("app", "App Command", Access.Administrator); global.AddToConsole(); command = new TestCommand(); global.AddCommand(command); global.AddCommand(new TestCommand2()); }
public void AddToConsole_ReturnsTrue_WhenServer_AndConsoleReturnsFalse() { Crestron.SimplSharp.CrestronConsole.AddNewConsoleCommandResult = false; Crestron.SimplSharp.CrestronEnvironment.DevicePlatform = Crestron.SimplSharp.eDevicePlatform.Server; var gc = new GlobalCommand("spa", "Help", Access.Administrator); var actual = gc.AddToConsole(); Assert.IsTrue(actual); }
public void Dispose_RemovesFromConsole_When_Called() { var c1 = new TestCommand(); var gc = new GlobalCommand("temp", "help", Access.Administrator); gc.AddToConsole(); gc.Dispose(); Assert.IsFalse(gc.RemoveFromConsole()); }
public void RemoveFromConsole_ReturnsTrue_WhenCommandAdded() { var expected = true; var gc = new GlobalCommand("aps", "help", Access.Administrator); Crestron.SimplSharp.CrestronConsole.AddNewConsoleCommandResult = true; gc.AddToConsole(); var actual = gc.RemoveFromConsole(); Assert.IsTrue(actual == expected); }
public void AddToConsole_ReturnsFalse_WhenSameCommandAdded() { var expected = false; var gc = new GlobalCommand("aps", "help", Access.Administrator); gc.AddToConsole(); var gc2 = new GlobalCommand("aps", "help", Access.Administrator); var actual = gc2.AddToConsole(); Assert.IsTrue(expected == actual); gc.RemoveFromConsole(); }
public void Dispose_RemovesAllCommands_When_Called() { var c1 = new TestCommand(); var gc = new GlobalCommand("temp", "help", Access.Administrator); gc.AddToConsole(); gc.AddCommand(c1); Assert.IsTrue(gc.IsCommandRegistered(c1)); gc.Dispose(); Assert.IsFalse(gc.IsCommandRegistered(c1)); }
public void GetAllGlobalCommands_ReturnsAllGlobalCommands() { Crestron.SimplSharp.CrestronConsole.AddNewConsoleCommandResult = true; var gc2 = new GlobalCommand("sap", "Test", Access.Administrator); gc2.AddToConsole(); var gc3 = new GlobalCommand("spsa", "Test", Access.Operator); gc3.AddToConsole(); var values = GlobalCommand.GetAllGlobalCommands(); Assert.IsTrue(values.Contains(gc2)); Assert.IsTrue(values.Contains(gc3)); Assert.IsTrue(values.Contains(underTest)); }
public void RegisterCommand_WithExistingName_Returns_CommandInUse() { Crestron.SimplSharp.CrestronConsole.AddNewConsoleCommandResult = true; var expected = RegisterResult.CommandNameAlreadyExists; var gc = new GlobalCommand("temp", "temp", Access.Administrator); gc.AddToConsole(); var c1 = new TestCommand(); var c2 = new TestCommand(); c1.RegisterCommand("temp"); var actual = c2.RegisterCommand("temp"); System.Diagnostics.Trace.WriteLine("Register result: '" + actual + "'"); Assert.IsTrue(expected == actual); c1.UnregisterCommand(); gc = null; }