mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-24 04:02:50 +08:00
Removed the additional registration of ICommand
This commit is contained in:
parent
d34012cad0
commit
49e8a980a7
@ -27,7 +27,6 @@ namespace Spectre.Console.Cli
|
|||||||
|
|
||||||
if (command.CommandType != null)
|
if (command.CommandType != null)
|
||||||
{
|
{
|
||||||
registrar?.Register(typeof(ICommand), command.CommandType);
|
|
||||||
registrar?.Register(command.CommandType, command.CommandType);
|
registrar?.Register(command.CommandType, command.CommandType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,10 +382,12 @@ namespace Spectre.Console.Tests.Unit.Cli
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
registrar.Registrations.ContainsKey(typeof(ICommand)).ShouldBeTrue();
|
registrar.Registrations.ContainsKey(typeof(GenericCommand<FooCommandSettings>)).ShouldBeTrue();
|
||||||
registrar.Registrations[typeof(ICommand)].ShouldContain(typeof(GenericCommand<FooCommandSettings>));
|
registrar.Registrations.ContainsKey(typeof(DogCommand)).ShouldBeTrue();
|
||||||
registrar.Registrations[typeof(ICommand)].ShouldContain(typeof(DogCommand));
|
registrar.Registrations.ContainsKey(typeof(HorseCommand)).ShouldBeTrue();
|
||||||
registrar.Registrations[typeof(ICommand)].ShouldContain(typeof(HorseCommand));
|
registrar.Registrations[typeof(GenericCommand<FooCommandSettings>)].ShouldContain(typeof(GenericCommand<FooCommandSettings>));
|
||||||
|
registrar.Registrations[typeof(DogCommand)].ShouldContain(typeof(DogCommand));
|
||||||
|
registrar.Registrations[typeof(HorseCommand)].ShouldContain(typeof(HorseCommand));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@ -406,8 +408,8 @@ namespace Spectre.Console.Tests.Unit.Cli
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
registrar.Registrations.ContainsKey(typeof(ICommand)).ShouldBeTrue();
|
registrar.Registrations.ContainsKey(typeof(DogCommand)).ShouldBeTrue();
|
||||||
registrar.Registrations[typeof(ICommand)].ShouldContain(typeof(DogCommand));
|
registrar.Registrations[typeof(DogCommand)].ShouldContain(typeof(DogCommand));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user