public void VerifyExceptionForDuplicateCommandStrings() { ITextBoxCommand command1 = new TextBoxCommand("command:", null, null); ITextBoxCommand command2 = new TextBoxCommand("command:", null, null); CommandTextBox commandTextBox = GetCommandTextBox(command1, command2); }
public CommandTextBoxTesterViewModel() { LoadTypes(); var typeFilter = new TextBoxCommand("", "Retrieves all types whose type name contains the command text.\nThis is the default command.", TypeNameFilter); var baseTypeFilter = new TextBoxCommand("base:", "Retrieves all types that have a base type whose name contains the command text.\nThis applies to all base types in the hierarchy.", BaseTypeFilter); var interfaceTypeFilter = new TextBoxCommand("interface:", "Retrieves all types that have an interface whose name contains the command text.", InterfaceFilter); var methodNameFilter = new TextBoxCommand("method:", "Retrieves all types that have a method whose name contains the command text.", MethodFilter); Commands = new List<ITextBoxCommand>() { typeFilter, baseTypeFilter, interfaceTypeFilter, methodNameFilter }; }
public void VerifyDefaultEmptyCommandIsSetWhenListIsMissingDefaultCommand() { var nonDefaultCommand1 = new TextBoxCommand("nondefault1:", null, null); var nonDefaultCommand2 = new TextBoxCommand("nondefault2:", null, null); CommandTextBox commandTextBox = GetCommandTextBox(); Assert.AreEqual(TextBoxCommand.Empty, commandTextBox.ActiveCommand); commandTextBox.Commands = new List<ITextBoxCommand> { nonDefaultCommand1, nonDefaultCommand2 }; Assert.AreEqual(TextBoxCommand.Empty, commandTextBox.ActiveCommand); }
public void VerifyCorrectCommandTextAfterRemovingCommandString(bool useTextProperty) { string commandText = null; ITextBoxCommand command = new TextBoxCommand("command:", null, s => { commandText = s; }); CommandTextBox commandTextBox = GetCommandTextBox(command); Action<string> setText = s => SetText(commandTextBox, useTextProperty, s); setText("command:command:"); commandTextBox.ExecuteCommand(); Assert.AreEqual("command:", commandText); setText("command:cshcommand:"); commandTextBox.ExecuteCommand(); Assert.AreEqual("cshcommand:", commandText); setText("command:ccommand:sh"); commandTextBox.ExecuteCommand(); Assert.AreEqual("ccommand:sh", commandText); }
public void VerifyCommandSwitch(bool useTextProperty) { int command1Count = 0, command2Count = 0; string command1Text = null, command2Text = null; ITextBoxCommand command1 = new TextBoxCommand("", null, s => { command1Count++; command1Text = s; }); ITextBoxCommand command2 = new TextBoxCommand("command2:", null, s => { command2Count++; command2Text = s; }); CommandTextBox commandTextBox = GetCommandTextBox(command1, command2); Assert.AreEqual(commandTextBox.ActiveCommand, command1); commandTextBox.ExecuteCommand(); Assert.AreEqual(1, command1Count); Assert.AreEqual("", command1Text); Action<string> setText = s => SetText(commandTextBox, useTextProperty, s); setText("command2:csh"); Assert.AreEqual(commandTextBox.ActiveCommand, command2); commandTextBox.ExecuteCommand(); Assert.AreEqual(1, command2Count); Assert.AreEqual("csh", command2Text); setText("csh"); Assert.AreEqual(commandTextBox.ActiveCommand, command1); commandTextBox.ExecuteCommand(); Assert.AreEqual(2, command1Count); Assert.AreEqual("csh", command1Text); }
public void VerifyDefaultCommand() { int commandCount = 0; string commandText = null; ITextBoxCommand defaultCommand = new TextBoxCommand("", null, s => { commandCount++; commandText = s; }); CommandTextBox commandTextBox = GetCommandTextBox(defaultCommand); commandTextBox.ExecuteCommand(); Assert.AreEqual(1, commandCount); Assert.AreEqual("", commandText); commandTextBox.SetTextBoxText("c"); commandTextBox.ExecuteCommand(); Assert.AreEqual(2, commandCount); Assert.AreEqual("c", commandText); commandTextBox.SetTextBoxText("cs"); commandTextBox.ExecuteCommand(); Assert.AreEqual(3, commandCount); Assert.AreEqual("cs", commandText); commandTextBox.SetTextBoxText(""); commandTextBox.ExecuteCommand(); Assert.AreEqual(4, commandCount); Assert.AreEqual("", commandText); }