public void GetDescriptor_ReturnsRegisteredSubCommand() { CommandRegistry commandRegistry = new CommandRegistry(); commandRegistry.Register(typeof(RemoteCommand)); CommandDescriptor remoteDescriptor = commandRegistry.GetDescriptor("remote", null); CommandDescriptor addDescriptor = commandRegistry.GetDescriptor("add", remoteDescriptor); Assert.That(remoteDescriptor.Name, Is.EqualTo("remote")); Assert.That(addDescriptor.Name, Is.EqualTo("add")); }
public void GetDescriptor_ReturnsRegisteredCommandUsingCommandAttribute() { CommandRegistry commandRegistry = new CommandRegistry(); commandRegistry.Register(typeof(TestAttributedCommand)); CommandDescriptor descriptor = commandRegistry.GetDescriptor("overridden", null); Assert.That(descriptor.Name, Is.EqualTo("overridden")); }
public void GetDescriptor_ReturnsRegisteredCommand() { CommandRegistry commandRegistry = new CommandRegistry(); commandRegistry.Register(typeof(TestCommand)); CommandDescriptor descriptor = commandRegistry.GetDescriptor("test", null); Assert.That(descriptor.Name, Is.EqualTo("test")); }
public void SetDefaultCommand_UpdatesRegisteredCommandsDescriptor() { CommandRegistry commandRegistry = new CommandRegistry(); commandRegistry.Register(typeof(TestCommand)); commandRegistry.SetDefaultCommand(typeof(TestCommand)); CommandDescriptor descriptor = commandRegistry.GetDescriptor("", null); Assert.That(descriptor.Name, Is.EqualTo("test")); }