예제 #1
0
        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"));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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"));
        }
예제 #4
0
        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"));
        }