public void GetAll_returns_expected_when_empty() { var sut = new DefaultCommandRegistry(); var result = sut.GetAll(); Assert.Empty(result); }
public void registers_with_expected_command_name(Type commandType, string expectedCommandName) { var sut = new DefaultCommandRegistry(); sut.Register(commandType); var result = sut.GetAll().Single(); Assert.Equal(expectedCommandName, result.CommandName); }
public void favor_command_name_from_class_annotation() { var sut = new DefaultCommandRegistry(); sut.Register(typeof(NamedByClassAnnotationCommand)); var result = sut.GetAll().Single(); Assert.Equal("foo", result.CommandName); }
public void GetAll_returns_expected_when_single_command_is_added() { var sut = new DefaultCommandRegistry(); sut.Register(typeof(FooCommand)); var result = sut .GetAll() .Select(x => x.ImplementationType) .ToArray(); Assert.Equal(new[] { typeof(FooCommand) }, result); }
public void can_add_multiple_commands_at_once() { var sut = new DefaultCommandRegistry(); sut.Register(new[] { typeof(FooCommand), typeof(BarCommand), }); var result = sut .GetAll() .Select(x => x.ImplementationType) .ToArray(); Assert.Equal(new[] { typeof(FooCommand), typeof(BarCommand), }, result); }